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