OpenSSL_version.pod 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. =pod
  2. =head1 NAME
  3. OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH,
  4. OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA,
  5. OPENSSL_VERSION_TEXT, OPENSSL_VERSION_PREREQ, OPENSSL_version_major,
  6. OPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release,
  7. OPENSSL_version_build_metadata, OpenSSL_version, OPENSSL_VERSION_NUMBER,
  8. OpenSSL_version_num, OPENSSL_info
  9. - get OpenSSL version number and other information
  10. =head1 SYNOPSIS
  11. #include <openssl/opensslv.h>
  12. #define OPENSSL_VERSION_MAJOR x
  13. #define OPENSSL_VERSION_MINOR y
  14. #define OPENSSL_VERSION_PATCH z
  15. /* The definitions here are typical release values */
  16. #define OPENSSL_VERSION_PRE_RELEASE ""
  17. #define OPENSSL_VERSION_BUILD_METADATA ""
  18. #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
  19. #define OPENSSL_VERSION_PREREQ(maj,min)
  20. #include <openssl/crypto.h>
  21. unsigned int OPENSSL_version_major(void);
  22. unsigned int OPENSSL_version_minor(void);
  23. unsigned int OPENSSL_version_patch(void);
  24. const char *OPENSSL_version_pre_release(void);
  25. const char *OPENSSL_version_build_metadata(void);
  26. const char *OpenSSL_version(int t);
  27. const char *OPENSSL_info(int t);
  28. /* from openssl/opensslv.h */
  29. #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnL
  30. /* from openssl/crypto.h */
  31. unsigned long OpenSSL_version_num();
  32. =head1 DESCRIPTION
  33. =head2 Macros
  34. The three macros B<OPENSSL_VERSION_MAJOR>, B<OPENSSL_VERSION_MINOR> and
  35. B<OPENSSL_VERSION_PATCH> represent the three parts of a version
  36. identifier, B<I<MAJOR>.I<MINOR>.I<PATCH>>.
  37. The macro B<OPENSSL_VERSION_PRE_RELEASE> is an added bit of text that
  38. indicates that this is a pre-release version, such as C<"-dev"> for an
  39. ongoing development snapshot or C<"-alpha3"> for an alpha release.
  40. The value must be a string.
  41. The macro B<OPENSSL_VERSION_BUILD_METADATA> is extra information, reserved
  42. for other parties, such as C<"+fips">, or C<"+vendor.1">).
  43. The OpenSSL project will not touch this macro (will leave it an empty string).
  44. The value must be a string.
  45. B<OPENSSL_VERSION_STR> is a convenience macro to get the short version
  46. identifier string, C<"I<MAJOR>.I<MINOR>.I<PATCH>">.
  47. B<OPENSSL_FULL_VERSION_STR> is a convenience macro to get the longer
  48. version identifier string, which combines B<OPENSSL_VERSION_STR>,
  49. B<OPENSSL_VERSION_PRE_RELEASE> and B<OPENSSL_VERSION_BUILD_METADATA>.
  50. B<OPENSSL_VERSION_TEXT> is a convenience macro to get a full descriptive
  51. version text, which includes B<OPENSSL_FULL_VERSION_STR> and the release
  52. date.
  53. B<OPENSSL_VERSION_PREREQ> is a useful macro for checking whether the OpenSSL
  54. version for the headers in use is at least at the given pre-requisite major
  55. (B<maj>) and minor (B<min>) number or not. It will evaluate to true if the
  56. header version number (B<OPENSSL_VERSION_MAJOR>.B<OPENSSL_VERSION_MINOR>) is
  57. greater than or equal to B<maj>.B<min>.
  58. B<OPENSSL_VERSION_NUMBER> is a combination of the major, minor and
  59. patch version into a single integer 0xMNN00PP0L, where:
  60. =over 4
  61. =item M
  62. is the number from B<OPENSSL_VERSION_MAJOR>, in hexadecimal notation
  63. =item NN
  64. is the number from B<OPENSSL_VERSION_MINOR>, in hexadecimal notation
  65. =item PP
  66. is the number from B<OPENSSL_VERSION_PATCH>, in hexadecimal notation
  67. =back
  68. =head2 Functions
  69. OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(),
  70. OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return
  71. the values of the macros above for the build of the library, respectively.
  72. OpenSSL_version() returns different strings depending on I<t>:
  73. =over 4
  74. =item OPENSSL_VERSION
  75. The value of B<OPENSSL_VERSION_TEXT>
  76. =item OPENSSL_VERSION_STRING
  77. The value of B<OPENSSL_VERSION_STR>
  78. =item OPENSSL_FULL_VERSION_STRING
  79. The value of B<OPENSSL_FULL_VERSION_STR>
  80. =item OPENSSL_CFLAGS
  81. The compiler flags set for the compilation process in the form
  82. C<compiler: ...> if available, or C<compiler: information not available>
  83. otherwise.
  84. =item OPENSSL_BUILT_ON
  85. The date of the build process in the form C<built on: ...> if available
  86. or C<built on: date not available> otherwise.
  87. The date would not be available in a reproducible build, for example.
  88. =item OPENSSL_PLATFORM
  89. The "Configure" target of the library build in the form C<platform: ...>
  90. if available, or C<platform: information not available> otherwise.
  91. =item OPENSSL_DIR
  92. The B<OPENSSLDIR> setting of the library build in the form C<OPENSSLDIR: "...">
  93. if available, or C<OPENSSLDIR: N/A> otherwise.
  94. =item OPENSSL_ENGINES_DIR
  95. The B<ENGINESDIR> setting of the library build in the form C<ENGINESDIR: "...">
  96. if available, or C<ENGINESDIR: N/A> otherwise. This option is deprecated in
  97. OpenSSL 3.0.
  98. =item OPENSSL_MODULES_DIR
  99. The B<MODULESDIR> setting of the library build in the form C<MODULESDIR: "...">
  100. if available, or C<MODULESDIR: N/A> otherwise.
  101. =item OPENSSL_CPU_INFO
  102. The current OpenSSL cpu settings.
  103. This is the current setting of the cpu capability flags. It is usually
  104. automatically configured but may be set via an environment variable.
  105. The value has the same syntax as the environment variable.
  106. For x86 the string looks like C<CPUINFO: OPENSSL_ia32cap=0x123:0x456>
  107. or C<CPUINFO: N/A> if not available.
  108. =back
  109. For an unknown I<t>, the text C<not available> is returned.
  110. OPENSSL_info() also returns different strings depending on I<t>:
  111. =over 4
  112. =item OPENSSL_INFO_CONFIG_DIR
  113. The configured C<OPENSSLDIR>, which is the default location for
  114. OpenSSL configuration files.
  115. =item OPENSSL_INFO_ENGINES_DIR
  116. The configured C<ENGINESDIR>, which is the default location for
  117. OpenSSL engines.
  118. =item OPENSSL_INFO_MODULES_DIR
  119. The configured C<MODULESDIR>, which is the default location for
  120. dynamically loadable OpenSSL modules other than engines.
  121. =item OPENSSL_INFO_DSO_EXTENSION
  122. The configured dynamically loadable module extension.
  123. =item OPENSSL_INFO_DIR_FILENAME_SEPARATOR
  124. The separator between a directory specification and a filename.
  125. Note that on some operating systems, this is not the same as the
  126. separator between directory elements.
  127. =item OPENSSL_INFO_LIST_SEPARATOR
  128. The OpenSSL list separator.
  129. This is typically used in strings that are lists of items, such as the
  130. value of the environment variable C<$PATH> on Unix (where the
  131. separator is C<:>) or C<%PATH%> on Windows (where the separator is
  132. C<;>).
  133. =item OPENSSL_INFO_CPU_SETTINGS
  134. The current OpenSSL cpu settings.
  135. This is the current setting of the cpu capability flags. It is usually
  136. automatically configured but may be set via an environment variable.
  137. The value has the same syntax as the environment variable.
  138. For x86 the string looks like C<OPENSSL_ia32cap=0x123:0x456>.
  139. =back
  140. For an unknown I<t>, NULL is returned.
  141. OpenSSL_version_num() returns the value of B<OPENSSL_VERSION_NUMBER>.
  142. =head1 RETURN VALUES
  143. OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch()
  144. return the version number parts as integers.
  145. OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return
  146. the values of B<OPENSSL_VERSION_PRE_RELEASE> and
  147. B<OPENSSL_VERSION_BUILD_METADATA> respectively as constant strings.
  148. For any of them that is undefined, the empty string is returned.
  149. OpenSSL_version() returns constant strings.
  150. =head1 SEE ALSO
  151. L<crypto(7)>
  152. =head1 HISTORY
  153. The macros and functions described here were added in OpenSSL 3.0,
  154. except for OPENSSL_VERSION_NUMBER and OpenSSL_version_num().
  155. =head1 COPYRIGHT
  156. Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  157. Licensed under the Apache License 2.0 (the "License"). You may not use
  158. this file except in compliance with the License. You can obtain a copy
  159. in the file LICENSE in the source distribution or at
  160. L<https://www.openssl.org/source/license.html>.
  161. =cut