Example program to test AES-GCM functionality. Used for a workshop

Dependencies:   mbed

Committer:
HannesTschofenig
Date:
Thu Sep 27 06:34:22 2018 +0000
Revision:
0:796d0f61a05b
Example AES-GCM test program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HannesTschofenig 0:796d0f61a05b 1 /**
HannesTschofenig 0:796d0f61a05b 2 * \file version.h
HannesTschofenig 0:796d0f61a05b 3 *
HannesTschofenig 0:796d0f61a05b 4 * \brief Run-time version information
HannesTschofenig 0:796d0f61a05b 5 *
HannesTschofenig 0:796d0f61a05b 6 * Copyright (C) 2006-2014, Brainspark B.V.
HannesTschofenig 0:796d0f61a05b 7 *
HannesTschofenig 0:796d0f61a05b 8 * This file is part of PolarSSL (http://www.polarssl.org)
HannesTschofenig 0:796d0f61a05b 9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
HannesTschofenig 0:796d0f61a05b 10 *
HannesTschofenig 0:796d0f61a05b 11 * All rights reserved.
HannesTschofenig 0:796d0f61a05b 12 *
HannesTschofenig 0:796d0f61a05b 13 * This program is free software; you can redistribute it and/or modify
HannesTschofenig 0:796d0f61a05b 14 * it under the terms of the GNU General Public License as published by
HannesTschofenig 0:796d0f61a05b 15 * the Free Software Foundation; either version 2 of the License, or
HannesTschofenig 0:796d0f61a05b 16 * (at your option) any later version.
HannesTschofenig 0:796d0f61a05b 17 *
HannesTschofenig 0:796d0f61a05b 18 * This program is distributed in the hope that it will be useful,
HannesTschofenig 0:796d0f61a05b 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
HannesTschofenig 0:796d0f61a05b 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
HannesTschofenig 0:796d0f61a05b 21 * GNU General Public License for more details.
HannesTschofenig 0:796d0f61a05b 22 *
HannesTschofenig 0:796d0f61a05b 23 * You should have received a copy of the GNU General Public License along
HannesTschofenig 0:796d0f61a05b 24 * with this program; if not, write to the Free Software Foundation, Inc.,
HannesTschofenig 0:796d0f61a05b 25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
HannesTschofenig 0:796d0f61a05b 26 */
HannesTschofenig 0:796d0f61a05b 27 /*
HannesTschofenig 0:796d0f61a05b 28 * This set of compile-time defines and run-time variables can be used to
HannesTschofenig 0:796d0f61a05b 29 * determine the version number of the PolarSSL library used.
HannesTschofenig 0:796d0f61a05b 30 */
HannesTschofenig 0:796d0f61a05b 31 #ifndef POLARSSL_VERSION_H
HannesTschofenig 0:796d0f61a05b 32 #define POLARSSL_VERSION_H
HannesTschofenig 0:796d0f61a05b 33
HannesTschofenig 0:796d0f61a05b 34 #if !defined(POLARSSL_CONFIG_FILE)
HannesTschofenig 0:796d0f61a05b 35 #include "config.h"
HannesTschofenig 0:796d0f61a05b 36 #else
HannesTschofenig 0:796d0f61a05b 37 #include POLARSSL_CONFIG_FILE
HannesTschofenig 0:796d0f61a05b 38 #endif
HannesTschofenig 0:796d0f61a05b 39
HannesTschofenig 0:796d0f61a05b 40 /**
HannesTschofenig 0:796d0f61a05b 41 * The version number x.y.z is split into three parts.
HannesTschofenig 0:796d0f61a05b 42 * Major, Minor, Patchlevel
HannesTschofenig 0:796d0f61a05b 43 */
HannesTschofenig 0:796d0f61a05b 44 #define POLARSSL_VERSION_MAJOR 1
HannesTschofenig 0:796d0f61a05b 45 #define POLARSSL_VERSION_MINOR 3
HannesTschofenig 0:796d0f61a05b 46 #define POLARSSL_VERSION_PATCH 7
HannesTschofenig 0:796d0f61a05b 47
HannesTschofenig 0:796d0f61a05b 48 /**
HannesTschofenig 0:796d0f61a05b 49 * The single version number has the following structure:
HannesTschofenig 0:796d0f61a05b 50 * MMNNPP00
HannesTschofenig 0:796d0f61a05b 51 * Major version | Minor version | Patch version
HannesTschofenig 0:796d0f61a05b 52 */
HannesTschofenig 0:796d0f61a05b 53 #define POLARSSL_VERSION_NUMBER 0x01030700
HannesTschofenig 0:796d0f61a05b 54 #define POLARSSL_VERSION_STRING "1.3.7"
HannesTschofenig 0:796d0f61a05b 55 #define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.3.7"
HannesTschofenig 0:796d0f61a05b 56
HannesTschofenig 0:796d0f61a05b 57 #if defined(POLARSSL_VERSION_C)
HannesTschofenig 0:796d0f61a05b 58
HannesTschofenig 0:796d0f61a05b 59 #ifdef __cplusplus
HannesTschofenig 0:796d0f61a05b 60 extern "C" {
HannesTschofenig 0:796d0f61a05b 61 #endif
HannesTschofenig 0:796d0f61a05b 62
HannesTschofenig 0:796d0f61a05b 63 /**
HannesTschofenig 0:796d0f61a05b 64 * Get the version number.
HannesTschofenig 0:796d0f61a05b 65 *
HannesTschofenig 0:796d0f61a05b 66 * \return The constructed version number in the format
HannesTschofenig 0:796d0f61a05b 67 * MMNNPP00 (Major, Minor, Patch).
HannesTschofenig 0:796d0f61a05b 68 */
HannesTschofenig 0:796d0f61a05b 69 unsigned int version_get_number( void );
HannesTschofenig 0:796d0f61a05b 70
HannesTschofenig 0:796d0f61a05b 71 /**
HannesTschofenig 0:796d0f61a05b 72 * Get the version string ("x.y.z").
HannesTschofenig 0:796d0f61a05b 73 *
HannesTschofenig 0:796d0f61a05b 74 * \param string The string that will receive the value.
HannesTschofenig 0:796d0f61a05b 75 * (Should be at least 9 bytes in size)
HannesTschofenig 0:796d0f61a05b 76 */
HannesTschofenig 0:796d0f61a05b 77 void version_get_string( char *string );
HannesTschofenig 0:796d0f61a05b 78
HannesTschofenig 0:796d0f61a05b 79 /**
HannesTschofenig 0:796d0f61a05b 80 * Get the full version string ("PolarSSL x.y.z").
HannesTschofenig 0:796d0f61a05b 81 *
HannesTschofenig 0:796d0f61a05b 82 * \param string The string that will receive the value. The PolarSSL version
HannesTschofenig 0:796d0f61a05b 83 * string will use 18 bytes AT MOST including a terminating
HannesTschofenig 0:796d0f61a05b 84 * null byte.
HannesTschofenig 0:796d0f61a05b 85 * (So the buffer should be at least 18 bytes to receive this
HannesTschofenig 0:796d0f61a05b 86 * version string).
HannesTschofenig 0:796d0f61a05b 87 */
HannesTschofenig 0:796d0f61a05b 88 void version_get_string_full( char *string );
HannesTschofenig 0:796d0f61a05b 89
HannesTschofenig 0:796d0f61a05b 90 /**
HannesTschofenig 0:796d0f61a05b 91 * \brief Check if support for a feature was compiled into this
HannesTschofenig 0:796d0f61a05b 92 * PolarSSL binary. This allows you to see at runtime if the
HannesTschofenig 0:796d0f61a05b 93 * library was for instance compiled with or without
HannesTschofenig 0:796d0f61a05b 94 * Multi-threading support.
HannesTschofenig 0:796d0f61a05b 95 *
HannesTschofenig 0:796d0f61a05b 96 * Note: only checks against defines in the sections "System
HannesTschofenig 0:796d0f61a05b 97 * support", "PolarSSL modules" and "PolarSSL feature
HannesTschofenig 0:796d0f61a05b 98 * support" in config.h
HannesTschofenig 0:796d0f61a05b 99 *
HannesTschofenig 0:796d0f61a05b 100 * \param feature The string for the define to check (e.g. "POLARSSL_AES_C")
HannesTschofenig 0:796d0f61a05b 101 *
HannesTschofenig 0:796d0f61a05b 102 * \return 0 if the feature is present, -1 if the feature is not
HannesTschofenig 0:796d0f61a05b 103 * present and -2 if support for feature checking as a whole
HannesTschofenig 0:796d0f61a05b 104 * was not compiled in.
HannesTschofenig 0:796d0f61a05b 105 */
HannesTschofenig 0:796d0f61a05b 106 int version_check_feature( const char *feature );
HannesTschofenig 0:796d0f61a05b 107
HannesTschofenig 0:796d0f61a05b 108 #ifdef __cplusplus
HannesTschofenig 0:796d0f61a05b 109 }
HannesTschofenig 0:796d0f61a05b 110 #endif
HannesTschofenig 0:796d0f61a05b 111
HannesTschofenig 0:796d0f61a05b 112 #endif /* POLARSSL_VERSION_C */
HannesTschofenig 0:796d0f61a05b 113
HannesTschofenig 0:796d0f61a05b 114 #endif /* version.h */
HannesTschofenig 0:796d0f61a05b 115
HannesTschofenig 0:796d0f61a05b 116