Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers version.h Source File

version.h

Go to the documentation of this file.
00001 /**
00002  * \file version.h
00003  *
00004  * \brief Run-time version information
00005  */
00006 /*
00007  *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
00008  *  SPDX-License-Identifier: Apache-2.0
00009  *
00010  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00011  *  not use this file except in compliance with the License.
00012  *  You may obtain a copy of the License at
00013  *
00014  *  http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  *  Unless required by applicable law or agreed to in writing, software
00017  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00018  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  *  See the License for the specific language governing permissions and
00020  *  limitations under the License.
00021  *
00022  *  This file is part of mbed TLS (https://tls.mbed.org)
00023  */
00024 /*
00025  * This set of compile-time defines and run-time variables can be used to
00026  * determine the version number of the mbed TLS library used.
00027  */
00028 #ifndef MBEDTLS_VERSION_H
00029 #define MBEDTLS_VERSION_H
00030 
00031 #if !defined(MBEDTLS_CONFIG_FILE)
00032 #include "config.h"
00033 #else
00034 #include MBEDTLS_CONFIG_FILE
00035 #endif
00036 
00037 /**
00038  * The version number x.y.z is split into three parts.
00039  * Major, Minor, Patchlevel
00040  */
00041 #define MBEDTLS_VERSION_MAJOR  2
00042 #define MBEDTLS_VERSION_MINOR  7
00043 #define MBEDTLS_VERSION_PATCH  1
00044 
00045 /**
00046  * The single version number has the following structure:
00047  *    MMNNPP00
00048  *    Major version | Minor version | Patch version
00049  */
00050 #define MBEDTLS_VERSION_NUMBER         0x02070100
00051 #define MBEDTLS_VERSION_STRING         "2.7.1"
00052 #define MBEDTLS_VERSION_STRING_FULL    "mbed TLS 2.7.1"
00053 
00054 #if defined(MBEDTLS_VERSION_C)
00055 
00056 #ifdef __cplusplus
00057 extern "C" {
00058 #endif
00059 
00060 /**
00061  * Get the version number.
00062  *
00063  * \return          The constructed version number in the format
00064  *                  MMNNPP00 (Major, Minor, Patch).
00065  */
00066 unsigned int mbedtls_version_get_number( void );
00067 
00068 /**
00069  * Get the version string ("x.y.z").
00070  *
00071  * \param string    The string that will receive the value.
00072  *                  (Should be at least 9 bytes in size)
00073  */
00074 void mbedtls_version_get_string( char *string );
00075 
00076 /**
00077  * Get the full version string ("mbed TLS x.y.z").
00078  *
00079  * \param string    The string that will receive the value. The mbed TLS version
00080  *                  string will use 18 bytes AT MOST including a terminating
00081  *                  null byte.
00082  *                  (So the buffer should be at least 18 bytes to receive this
00083  *                  version string).
00084  */
00085 void mbedtls_version_get_string_full( char *string );
00086 
00087 /**
00088  * \brief           Check if support for a feature was compiled into this
00089  *                  mbed TLS binary. This allows you to see at runtime if the
00090  *                  library was for instance compiled with or without
00091  *                  Multi-threading support.
00092  *
00093  * \note            only checks against defines in the sections "System
00094  *                  support", "mbed TLS modules" and "mbed TLS feature
00095  *                  support" in config.h
00096  *
00097  * \param feature   The string for the define to check (e.g. "MBEDTLS_AES_C")
00098  *
00099  * \return          0 if the feature is present,
00100  *                  -1 if the feature is not present and
00101  *                  -2 if support for feature checking as a whole was not
00102  *                  compiled in.
00103  */
00104 int mbedtls_version_check_feature( const char *feature );
00105 
00106 #ifdef __cplusplus
00107 }
00108 #endif
00109 
00110 #endif /* MBEDTLS_VERSION_C */
00111 
00112 #endif /* version.h */