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