blob: bed886895097c50bccb1f0770da6aaf0320ac091 [file] [log] [blame]
Paul Bakker3ac1b2d2010-06-18 22:47:29 +00001/**
2 * \file version.h
3 *
Paul Bakkerf3b86c12011-01-27 15:24:17 +00004 * \brief Run-time version information
5 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00006 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
Paul Bakkerb96f1542010-07-18 20:36:00 +00007 *
Manuel Pégourié-Gonnard860b5162015-01-28 17:12:07 +00008 * This file is part of mbed TLS (https://polarssl.org)
Paul Bakkerb96f1542010-07-18 20:36:00 +00009 *
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000010 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Paul Bakkerf3b86c12011-01-27 15:24:17 +000023 */
24/*
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000025 * This set of compile-time defines and run-time variables can be used to
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000026 * determine the version number of the mbed TLS library used.
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000027 */
28#ifndef POLARSSL_VERSION_H
29#define POLARSSL_VERSION_H
30
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020031#if !defined(POLARSSL_CONFIG_FILE)
Paul Bakker314052f2011-08-15 09:07:52 +000032#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020033#else
34#include POLARSSL_CONFIG_FILE
35#endif
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000036
37/**
38 * The version number x.y.z is split into three parts.
39 * Major, Minor, Patchlevel
40 */
Paul Bakker968bc982011-07-27 17:03:00 +000041#define POLARSSL_VERSION_MAJOR 1
Paul Bakker5ad403f2013-09-18 21:21:30 +020042#define POLARSSL_VERSION_MINOR 3
Paul Bakker9eac4f72014-10-20 13:56:15 +020043#define POLARSSL_VERSION_PATCH 9
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000044
45/**
46 * The single version number has the following structure:
47 * MMNNPP00
48 * Major version | Minor version | Patch version
49 */
Paul Bakker9eac4f72014-10-20 13:56:15 +020050#define POLARSSL_VERSION_NUMBER 0x01030900
51#define POLARSSL_VERSION_STRING "1.3.9"
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000052#define POLARSSL_VERSION_STRING_FULL "mbed TLS 1.3.9"
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000053
54#if defined(POLARSSL_VERSION_C)
55
Paul Bakker407a0da2013-06-27 14:29:21 +020056#ifdef __cplusplus
57extern "C" {
58#endif
59
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000060/**
61 * Get the version number.
62 *
Paul Bakker0f5f72e2011-01-18 14:58:55 +000063 * \return The constructed version number in the format
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000064 * MMNNPP00 (Major, Minor, Patch).
65 */
Paul Bakker684ddce2011-07-01 09:25:54 +000066unsigned int version_get_number( void );
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000067
68/**
69 * Get the version string ("x.y.z").
70 *
Paul Bakker0f5f72e2011-01-18 14:58:55 +000071 * \param string The string that will receive the value.
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000072 * (Should be at least 9 bytes in size)
73 */
74void version_get_string( char *string );
75
76/**
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000077 * Get the full version string ("mbed TLS x.y.z").
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000078 *
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000079 * \param string The string that will receive the value. The mbed TLS version
Paul Bakker83946842014-04-30 10:21:23 +020080 * string will use 18 bytes AT MOST including a terminating
81 * null byte.
82 * (So the buffer should be at least 18 bytes to receive this
83 * version string).
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000084 */
85void version_get_string_full( char *string );
86
Paul Bakker0f90d7d2014-04-30 11:49:44 +020087/**
88 * \brief Check if support for a feature was compiled into this
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000089 * mbed TLS binary. This allows you to see at runtime if the
Paul Bakker0f90d7d2014-04-30 11:49:44 +020090 * library was for instance compiled with or without
91 * Multi-threading support.
92 *
93 * Note: only checks against defines in the sections "System
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000094 * support", "mbed TLS modules" and "mbed TLS feature
Paul Bakker0f90d7d2014-04-30 11:49:44 +020095 * support" in config.h
96 *
97 * \param feature The string for the define to check (e.g. "POLARSSL_AES_C")
98 *
Paul Bakker790e3952014-04-30 16:48:32 +020099 * \return 0 if the feature is present, -1 if the feature is not
100 * present and -2 if support for feature checking as a whole
101 * was not compiled in.
Paul Bakker0f90d7d2014-04-30 11:49:44 +0200102 */
103int version_check_feature( const char *feature );
104
Paul Bakker407a0da2013-06-27 14:29:21 +0200105#ifdef __cplusplus
106}
107#endif
108
Paul Bakker3ac1b2d2010-06-18 22:47:29 +0000109#endif /* POLARSSL_VERSION_C */
110
111#endif /* version.h */