version.h 2.2 KB

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