OpenSSL_version.pod 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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,
  6. OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch,
  7. OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version,
  8. OPENSSL_VERSION_NUMBER, 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. #include <openssl/crypto.h>
  20. unsigned int OPENSSL_version_major(void);
  21. unsigned int OPENSSL_version_minor(void);
  22. unsigned int OPENSSL_version_patch(void);
  23. const char *OPENSSL_version_pre_release(void);
  24. const char *OPENSSL_version_build_metadata(void);
  25. const char *OpenSSL_version(int t);
  26. const char *OPENSSL_info(int t);
  27. Deprecated:
  28. /* from openssl/opensslv.h */
  29. #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL
  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. =head2 Functions
  54. OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(),
  55. OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return
  56. the values of the macros above for the build of the library, respectively.
  57. OpenSSL_version() returns different strings depending on I<t>:
  58. =over 4
  59. =item OPENSSL_VERSION
  60. The value of B<OPENSSL_VERSION_TEXT>
  61. =item OPENSSL_VERSION_STRING
  62. The value of B<OPENSSL_VERSION_STR>
  63. =item OPENSSL_FULL_VERSION_STRING
  64. The value of B<OPENSSL_FULL_VERSION_STR>
  65. =item OPENSSL_CFLAGS
  66. The compiler flags set for the compilation process in the form
  67. C<compiler: ...> if available, or C<compiler: information not available>
  68. otherwise.
  69. =item OPENSSL_BUILT_ON
  70. The date of the build process in the form C<built on: ...> if available
  71. or C<built on: date not available> otherwise.
  72. The date would not be available in a reproducible build, for example.
  73. =item OPENSSL_PLATFORM
  74. The "Configure" target of the library build in the form C<platform: ...>
  75. if available, or C<platform: information not available> otherwise.
  76. =item OPENSSL_DIR
  77. The B<OPENSSLDIR> setting of the library build in the form C<OPENSSLDIR: "...">
  78. if available, or C<OPENSSLDIR: N/A> otherwise.
  79. =item OPENSSL_ENGINES_DIR
  80. The B<ENGINESDIR> setting of the library build in the form C<ENGINESDIR: "...">
  81. if available, or C<ENGINESDIR: N/A> otherwise. This option is deprecated in
  82. OpenSSL 3.0.
  83. =item OPENSSL_MODULES_DIR
  84. The B<MODULESDIR> setting of the library build in the form C<MODULESDIR: "...">
  85. if available, or C<MODULESDIR: N/A> otherwise.
  86. =item OPENSSL_CPU_INFO
  87. The current OpenSSL cpu settings.
  88. This is the current setting of the cpu capability flags. It is usually
  89. automatically configured but may be set via an environment variable.
  90. The value has the same syntax as the environment variable.
  91. For x86 the string looks like C<CPUINFO: OPENSSL_ia32cap=0x123:0x456>
  92. or C<CPUINFO: N/A> if not available.
  93. =back
  94. For an unknown I<t>, the text C<not available> is returned.
  95. OPENSSL_info() also returns different strings depending on I<t>:
  96. =over 4
  97. =item OPENSSL_INFO_CONFIG_DIR
  98. The configured C<OPENSSLDIR>, which is the default location for
  99. OpenSSL configuration files.
  100. =item OPENSSL_INFO_ENGINES_DIR
  101. The configured C<ENGINESDIR>, which is the default location for
  102. OpenSSL engines.
  103. =item OPENSSL_INFO_MODULES_DIR
  104. The configured C<MODULESDIR>, which is the default location for
  105. dynamically loadable OpenSSL modules other than engines.
  106. =item OPENSSL_INFO_DSO_EXTENSION
  107. The configured dynamically loadable module extension.
  108. =item OPENSSL_INFO_DIR_FILENAME_SEPARATOR
  109. The separator between a directory specification and a filename.
  110. Note that on some operating systems, this is not the same as the
  111. separator between directory elements.
  112. =item OPENSSL_INFO_LIST_SEPARATOR
  113. The OpenSSL list separator.
  114. This is typically used in strings that are lists of items, such as the
  115. value of the environment variable C<$PATH> on Unix (where the
  116. separator is C<:>) or C<%PATH%> on Windows (where the separator is
  117. C<;>).
  118. =item OPENSSL_INFO_CPU_SETTINGS
  119. The current OpenSSL cpu settings.
  120. This is the current setting of the cpu capability flags. It is usually
  121. automatically configured but may be set via an environment variable.
  122. The value has the same syntax as the environment variable.
  123. For x86 the string looks like C<OPENSSL_ia32cap=0x123:0x456>.
  124. =back
  125. For an unknown I<t>, NULL is returned.
  126. =head1 BACKWARD COMPATIBILITY
  127. For compatibility, some older macros and functions are retained or
  128. synthesised.
  129. They are all considered deprecated.
  130. =head2 Macros
  131. B<OPENSSL_VERSION_NUMBER> is a combination of the major, minor and
  132. patch version into a single integer 0xMNN00PP0L, where:
  133. =over 4
  134. =item M
  135. is the number from B<OPENSSL_VERSION_MAJOR>, in hexadecimal notation
  136. =item NN
  137. is the number from B<OPENSSL_VERSION_MINOR>, in hexadecimal notation
  138. =item PP
  139. is the number from B<OPENSSL_VERSION_PATCH>, in hexadecimal notation
  140. =back
  141. =head2 Functions
  142. OpenSSL_version_num() returns the value of B<OPENSSL_VERSION_NUMBER>.
  143. =head1 RETURN VALUES
  144. OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch()
  145. return the version number parts as integers.
  146. OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return
  147. the values of B<OPENSSL_VERSION_PRE_RELEASE> and
  148. B<OPENSSL_VERSION_BUILD_METADATA> respectively as constant strings.
  149. For any of them that is undefined, the empty string is returned.
  150. OpenSSL_version() returns constant strings.
  151. =head1 SEE ALSO
  152. L<crypto(7)>
  153. =head1 HISTORY
  154. The macros and functions described here were added in OpenSSL 3.0,
  155. with the exception of the L</BACKWARD COMPATIBILITY> ones.
  156. =head1 COPYRIGHT
  157. Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
  158. Licensed under the Apache License 2.0 (the "License"). You may not use
  159. this file except in compliance with the License. You can obtain a copy
  160. in the file LICENSE in the source distribution or at
  161. L<https://www.openssl.org/source/license.html>.
  162. =cut