blob: 637f9d38bf6df3ef5c45ca61f4c7a2c7e4d86675 [file] [log] [blame]
Antonio de Angelis8bb98512024-01-16 14:13:36 +00001/**
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 run-time variables can be used to determine the version number of
12 * the Mbed TLS library used. Compile-time version defines for the same can be
13 * found in build_info.h
14 */
15#ifndef MBEDTLS_VERSION_H
16#define MBEDTLS_VERSION_H
17
18#include "mbedtls/build_info.h"
19
20#if defined(MBEDTLS_VERSION_C)
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/**
27 * Get the version number.
28 *
29 * \return The constructed version number in the format
30 * MMNNPP00 (Major, Minor, Patch).
31 */
32unsigned int mbedtls_version_get_number(void);
33
34/**
35 * Get the version string ("x.y.z").
36 *
37 * \param string The string that will receive the value.
38 * (Should be at least 9 bytes in size)
39 */
40void mbedtls_version_get_string(char *string);
41
42/**
43 * Get the full version string ("Mbed TLS x.y.z").
44 *
45 * \param string The string that will receive the value. The Mbed TLS version
46 * string will use 18 bytes AT MOST including a terminating
47 * null byte.
48 * (So the buffer should be at least 18 bytes to receive this
49 * version string).
50 */
51void mbedtls_version_get_string_full(char *string);
52
53/**
54 * \brief Check if support for a feature was compiled into this
55 * Mbed TLS binary. This allows you to see at runtime if the
56 * library was for instance compiled with or without
57 * Multi-threading support.
58 *
59 * \note only checks against defines in the sections "System
60 * support", "Mbed TLS modules" and "Mbed TLS feature
61 * support" in mbedtls_config.h
62 *
63 * \param feature The string for the define to check (e.g. "MBEDTLS_AES_C")
64 *
65 * \return 0 if the feature is present,
66 * -1 if the feature is not present and
67 * -2 if support for feature checking as a whole was not
68 * compiled in.
69 */
70int mbedtls_version_check_feature(const char *feature);
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif /* MBEDTLS_VERSION_C */
77
78#endif /* version.h */