opensslv.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef HEADER_OPENSSLV_H
  10. # define HEADER_OPENSSLV_H
  11. # ifdef __cplusplus
  12. extern "C" {
  13. # endif
  14. /*
  15. * SECTION 1: VERSION DATA. These will change for each release
  16. */
  17. /*
  18. * Base version macros
  19. *
  20. * These macros express version number MAJOR.MINOR.PATCH exactly
  21. */
  22. # define OPENSSL_VERSION_MAJOR 3
  23. # define OPENSSL_VERSION_MINOR 0
  24. # define OPENSSL_VERSION_PATCH 0
  25. /*
  26. * Additional version information, defined only when used.
  27. *
  28. * These are also part of the new version scheme, but aren't part
  29. * of the version number itself.
  30. */
  31. /* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */
  32. # define OPENSSL_VERSION_PRE_RELEASE "-dev"
  33. /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */
  34. /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */
  35. # undef OPENSSL_VERSION_BUILD_METADATA
  36. /*
  37. * Note: OPENSSL_VERSION_BUILD_METADATA will never be defined by
  38. * the OpenSSL Project, it's entirely reserved for others vendors
  39. */
  40. /*
  41. * Absolute string versions of OPENSSL_VERSION_PRE_RELEASE and
  42. * OPENSSL_VERSION_BUILD_METADATA. As opposed to those, which
  43. * may be undefined, these are guaranteed to have strings as
  44. * values.
  45. */
  46. # ifdef OPENSSL_VERSION_PRE_RELEASE
  47. # define OPENSSL_VERSION_PRE_RELEASE_STR OPENSSL_VERSION_PRE_RELEASE
  48. # else
  49. # define OPENSSL_VERSION_PRE_RELEASE_STR ""
  50. # endif
  51. # ifdef OPENSSL_VERSION_BUILD_METADATA
  52. # define OPENSSL_VERSION_BUILD_METADATA_STR OPENSSL_VERSION_BUILD_METADATA
  53. # else
  54. # define OPENSSL_VERSION_BUILD_METADATA_STR ""
  55. # endif
  56. /*
  57. * Shared library version
  58. *
  59. * This is strictly to express ABI version, which may or may not
  60. * be related to the API version expressed with the macros above.
  61. * This is defined in free form.
  62. */
  63. # define OPENSSL_SHLIB_VERSION 3
  64. /*
  65. * SECTION 2: USEFUL MACROS AND FUNCTIONS
  66. */
  67. /* For checking general API compatibility when preprocessing */
  68. # define OPENSSL_VERSION_PREREQ(maj,min) \
  69. ((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= (maj << 16) + min)
  70. /* Helper macros for CPP string composition */
  71. # define OPENSSL_MSTR_HELPER(x) #x
  72. # define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x)
  73. /*
  74. * These return the values of OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR,
  75. * OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE and
  76. * OPENSSL_VERSION_BUILD_METADATA, respectively.
  77. */
  78. unsigned int OPENSSL_version_major(void);
  79. unsigned int OPENSSL_version_minor(void);
  80. unsigned int OPENSSL_version_patch(void);
  81. const char *OPENSSL_version_pre_release(void);
  82. const char *OPENSSL_version_build_metadata(void);
  83. /*
  84. * Macros to get the version in easily digested string form, both the short
  85. * "MAJOR.MINOR.PATCH" variant (where MAJOR, MINOR and PATCH are replaced
  86. * with the values from the corresponding OPENSSL_VERSION_ macros) and the
  87. * longer variant with OPENSSL_VERSION_PRE_RELEASE_STR and
  88. * OPENSSL_VERSION_BUILD_METADATA_STR appended.
  89. */
  90. # define OPENSSL_VERSION_STR \
  91. OPENSSL_MSTR(OPENSSL_VERSION_MAJOR) "." \
  92. OPENSSL_MSTR(OPENSSL_VERSION_MINOR) "." \
  93. OPENSSL_MSTR(OPENSSL_VERSION_PATCH)
  94. # define OPENSSL_FULL_VERSION_STR \
  95. OPENSSL_VERSION_STR \
  96. OPENSSL_VERSION_PRE_RELEASE_STR \
  97. OPENSSL_VERSION_BUILD_METADATA_STR
  98. /*
  99. * SECTION 3: ADDITIONAL METADATA
  100. */
  101. # define OPENSSL_RELEASE_DATE "xx XXX xxxx"
  102. # define OPENSSL_VERSION_TEXT \
  103. "OpenSSL " OPENSSL_FULL_VERSION_STR " " OPENSSL_RELEASE_DATE
  104. /*
  105. * SECTION 3: BACKWARD COMPATIBILITY
  106. */
  107. # include <openssl/opensslconf.h>
  108. # if !OPENSSL_API_4
  109. /* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */
  110. # ifdef OPENSSL_VERSION_PRE_RELEASE
  111. # define _OPENSSL_VERSION_PRE_RELEASE 0x0
  112. # else
  113. # define _OPENSSL_VERSION_PRE_RELEASE 0xf
  114. # endif
  115. # define OPENSSL_VERSION_NUMBER \
  116. ( (OPENSSL_VERSION_MAJOR<<28) \
  117. |(OPENSSL_VERSION_MINOR<<20) \
  118. |(OPENSSL_VERSION_PATCH<<4) \
  119. |_OPENSSL_VERSION_PRE_RELEASE )
  120. # endif
  121. # ifdef __cplusplus
  122. }
  123. # endif
  124. #endif /* HEADER_OPENSSLV_H */