1 /** 2 * \file version.h 3 * 4 * \brief Run-time version information 5 */ 6 /* 7 * Copyright The Mbed TLS Contributors 8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 */ 10 /* 11 * This set of compile-time defines and run-time variables can be used to 12 * determine the version number of the Mbed TLS library used. 13 */ 14 #ifndef MBEDTLS_VERSION_H 15 #define MBEDTLS_VERSION_H 16 17 #if !defined(MBEDTLS_CONFIG_FILE) 18 #include "mbedtls/config.h" 19 #else 20 #include MBEDTLS_CONFIG_FILE 21 #endif 22 23 /** 24 * The version number x.y.z is split into three parts. 25 * Major, Minor, Patchlevel 26 */ 27 #define MBEDTLS_VERSION_MAJOR 2 28 #define MBEDTLS_VERSION_MINOR 28 29 #define MBEDTLS_VERSION_PATCH 7 30 31 /** 32 * The single version number has the following structure: 33 * MMNNPP00 34 * Major version | Minor version | Patch version 35 */ 36 #define MBEDTLS_VERSION_NUMBER 0x021C0700 37 #define MBEDTLS_VERSION_STRING "2.28.7" 38 #define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 2.28.7" 39 40 #if defined(MBEDTLS_VERSION_C) 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /** 47 * Get the version number. 48 * 49 * \return The constructed version number in the format 50 * MMNNPP00 (Major, Minor, Patch). 51 */ 52 unsigned int mbedtls_version_get_number(void); 53 54 /** 55 * Get the version string ("x.y.z"). 56 * 57 * \param string The string that will receive the value. 58 * (Should be at least 9 bytes in size) 59 */ 60 void mbedtls_version_get_string(char *string); 61 62 /** 63 * Get the full version string ("Mbed TLS x.y.z"). 64 * 65 * \param string The string that will receive the value. The Mbed TLS version 66 * string will use 18 bytes AT MOST including a terminating 67 * null byte. 68 * (So the buffer should be at least 18 bytes to receive this 69 * version string). 70 */ 71 void mbedtls_version_get_string_full(char *string); 72 73 /** 74 * \brief Check if support for a feature was compiled into this 75 * Mbed TLS binary. This allows you to see at runtime if the 76 * library was for instance compiled with or without 77 * Multi-threading support. 78 * 79 * \note only checks against defines in the sections "System 80 * support", "Mbed TLS modules" and "Mbed TLS feature 81 * support" in config.h 82 * 83 * \param feature The string for the define to check (e.g. "MBEDTLS_AES_C") 84 * 85 * \return 0 if the feature is present, 86 * -1 if the feature is not present and 87 * -2 if support for feature checking as a whole was not 88 * compiled in. 89 */ 90 int mbedtls_version_check_feature(const char *feature); 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif /* MBEDTLS_VERSION_C */ 97 98 #endif /* version.h */ 99