blob: bae12443f29fe4dd52153f172c6d48e9cc84c0c3 [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 *
Paul Bakker0f90d7d2014-04-30 11:49:44 +02006 * Copyright (C) 2006-2014, Brainspark B.V.
Paul Bakkerb96f1542010-07-18 20:36:00 +00007 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
Paul Bakker84f12b72010-07-18 10:13:04 +00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
Paul Bakkerb96f1542010-07-18 20:36:00 +000010 *
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000011 * 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 Bakkerf3b86c12011-01-27 15:24:17 +000026 */
27/*
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000028 * This set of compile-time defines and run-time variables can be used to
29 * determine the version number of the PolarSSL library used.
30 */
31#ifndef POLARSSL_VERSION_H
32#define POLARSSL_VERSION_H
33
Paul Bakker314052f2011-08-15 09:07:52 +000034#include "config.h"
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000035
36/**
37 * The version number x.y.z is split into three parts.
38 * Major, Minor, Patchlevel
39 */
Paul Bakker968bc982011-07-27 17:03:00 +000040#define POLARSSL_VERSION_MAJOR 1
Paul Bakker5ad403f2013-09-18 21:21:30 +020041#define POLARSSL_VERSION_MINOR 3
Paul Bakker784b04f2014-04-11 15:33:59 +020042#define POLARSSL_VERSION_PATCH 6
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000043
44/**
45 * The single version number has the following structure:
46 * MMNNPP00
47 * Major version | Minor version | Patch version
48 */
Paul Bakker784b04f2014-04-11 15:33:59 +020049#define POLARSSL_VERSION_NUMBER 0x01030600
50#define POLARSSL_VERSION_STRING "1.3.6"
51#define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.3.6"
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000052
53#if defined(POLARSSL_VERSION_C)
54
Paul Bakker407a0da2013-06-27 14:29:21 +020055#ifdef __cplusplus
56extern "C" {
57#endif
58
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000059/**
60 * Get the version number.
61 *
Paul Bakker0f5f72e2011-01-18 14:58:55 +000062 * \return The constructed version number in the format
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000063 * MMNNPP00 (Major, Minor, Patch).
64 */
Paul Bakker684ddce2011-07-01 09:25:54 +000065unsigned int version_get_number( void );
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000066
67/**
68 * Get the version string ("x.y.z").
69 *
Paul Bakker0f5f72e2011-01-18 14:58:55 +000070 * \param string The string that will receive the value.
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000071 * (Should be at least 9 bytes in size)
72 */
73void version_get_string( char *string );
74
75/**
76 * Get the full version string ("PolarSSL x.y.z").
77 *
Paul Bakker83946842014-04-30 10:21:23 +020078 * \param string The string that will receive the value. The PolarSSL version
79 * string will use 18 bytes AT MOST including a terminating
80 * null byte.
81 * (So the buffer should be at least 18 bytes to receive this
82 * version string).
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000083 */
84void version_get_string_full( char *string );
85
Paul Bakker0f90d7d2014-04-30 11:49:44 +020086/**
87 * \brief Check if support for a feature was compiled into this
88 * PolarSSL binary. This allows you to see at runtime if the
89 * library was for instance compiled with or without
90 * Multi-threading support.
91 *
92 * Note: only checks against defines in the sections "System
93 * support", "PolarSSL modules" and "PolarSSL feature
94 * support" in config.h
95 *
96 * \param feature The string for the define to check (e.g. "POLARSSL_AES_C")
97 *
98 * \return 0 if the feature is present, -1 if not.
99 */
100int version_check_feature( const char *feature );
101
Paul Bakker407a0da2013-06-27 14:29:21 +0200102#ifdef __cplusplus
103}
104#endif
105
Paul Bakker3ac1b2d2010-06-18 22:47:29 +0000106#endif /* POLARSSL_VERSION_C */
107
108#endif /* version.h */