From 26b7cc0d20d180df28831931b5e75c14c015c5b9 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 17 Oct 2019 18:40:47 +0200 Subject: [PATCH] Cleanup include/openssl/opensslv.h.in Now that we generate include/openssl/opensslv.h, there's no point keeping some macross around, we can just set a simpler set to their respective value and be done with it. Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/10218) --- crypto/cversion.c | 4 +-- doc/man3/OpenSSL_version.pod | 18 ++++++-------- include/openssl/opensslv.h.in | 47 +++++++---------------------------- 3 files changed, 18 insertions(+), 51 deletions(-) diff --git a/crypto/cversion.c b/crypto/cversion.c index c81f56f42b..530b0e805e 100644 --- a/crypto/cversion.c +++ b/crypto/cversion.c @@ -33,12 +33,12 @@ unsigned int OPENSSL_version_patch(void) const char *OPENSSL_version_pre_release(void) { - return OPENSSL_VERSION_PRE_RELEASE_STR; + return OPENSSL_VERSION_PRE_RELEASE; } const char *OPENSSL_version_build_metadata(void) { - return OPENSSL_VERSION_BUILD_METADATA_STR; + return OPENSSL_VERSION_BUILD_METADATA; } extern char ossl_cpu_info_str[]; diff --git a/doc/man3/OpenSSL_version.pod b/doc/man3/OpenSSL_version.pod index 0c835b77d8..4d6a1fef40 100644 --- a/doc/man3/OpenSSL_version.pod +++ b/doc/man3/OpenSSL_version.pod @@ -4,7 +4,6 @@ OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA, -OPENSSL_VERSION_PRE_RELEASE_STR, OPENSSL_VERSION_BUILD_METADATA_STR, OPENSSL_VERSION_TEXT, OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version, @@ -20,10 +19,8 @@ OPENSSL_VERSION_NUMBER, OpenSSL_version_num, OPENSSL_info #define OPENSSL_VERSION_PATCH z /* The definitions here are typical release values */ - #undef OPENSSL_VERSION_PRE_RELEASE - #undef OPENSSL_VERSION_BUILD_METADATA - #define OPENSSL_VERSION_PRE_RELEASE_STR "" - #define OPENSSL_VERSION_BUILD_METADATA_STR "" + #define OPENSSL_VERSION_PRE_RELEASE "" + #define OPENSSL_VERSION_BUILD_METADATA "" #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx" @@ -55,15 +52,14 @@ The three macros B, B and B represent the three parts of a version identifier, B.I.I>. -The macro B is an added bit of text that, -when defined, indicates that this is a pre-release version, such as -C<"-dev"> for an ongoing development snapshot or C<"-alpha3"> for an -alpha release. +The macro B is an added bit of text that +indicates that this is a pre-release version, such as C<"-dev"> for an +ongoing development snapshot or C<"-alpha3"> for an alpha release. The value must be a string. The macro B is extra information, reserved -for other parties, such as C<"+fips">, or C<"+vendor.1">. -The OpenSSL project will not touch this macro. +for other parties, such as C<"+fips">, or C<"+vendor.1">). +The OpenSSL project will not touch this macro (will leave it an empty string). The value must be a string. B is a convenience macro to get the short version diff --git a/include/openssl/opensslv.h.in b/include/openssl/opensslv.h.in index 9380504721..ffd2bfff32 100644 --- a/include/openssl/opensslv.h.in +++ b/include/openssl/opensslv.h.in @@ -31,55 +31,24 @@ extern "C" { # define OPENSSL_VERSION_PATCH {- $config{patch} -} /* - * Additional version information, defined only when used. + * Additional version information * * These are also part of the new version scheme, but aren't part * of the version number itself. */ /* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */ -{- $config{prerelease} - ? << "_____" -# define OPENSSL_VERSION_PRE_RELEASE "$config{prerelease}" -_____ - : << "_____" -# undef OPENSSL_VERSION_PRE_RELEASE -_____ --} +# define OPENSSL_VERSION_PRE_RELEASE "{- $config{prerelease} -}" /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */ /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */ -{- $build_metadata - ? << "_____" # define OPENSSL_VERSION_BUILD_METADATA "{- $config{build_metadata} -}" -_____ - : << "_____" -# undef OPENSSL_VERSION_BUILD_METADATA -_____ --} /* - * Note: OPENSSL_VERSION_BUILD_METADATA will never be defined by - * the OpenSSL Project, it's entirely reserved for others vendors + * Note: The OpenSSL Project will never define OPENSSL_VERSION_BUILD_METADATA + * to be anything but the empty string. Its use is entirely reserved for + * others */ -/* - * Absolute string versions of OPENSSL_VERSION_PRE_RELEASE and - * OPENSSL_VERSION_BUILD_METADATA. As opposed to those, which - * may be undefined, these are guaranteed to have strings as - * values. - */ - -# ifdef OPENSSL_VERSION_PRE_RELEASE -# define OPENSSL_VERSION_PRE_RELEASE_STR OPENSSL_VERSION_PRE_RELEASE -# else -# define OPENSSL_VERSION_PRE_RELEASE_STR "" -# endif -# ifdef OPENSSL_VERSION_BUILD_METADATA -# define OPENSSL_VERSION_BUILD_METADATA_STR OPENSSL_VERSION_BUILD_METADATA -# else -# define OPENSSL_VERSION_BUILD_METADATA_STR "" -# endif - /* * Shared library version * @@ -90,7 +59,7 @@ _____ # define OPENSSL_SHLIB_VERSION {- $config{shlib_version} -} /* - * SECTION 2: USEFUL MACROS AND FUNCTIONS + * SECTION 2: USEFUL MACROS */ /* For checking general API compatibility when preprocessing */ @@ -113,11 +82,13 @@ _____ * These strings are defined separately to allow them to be parsable. */ # define OPENSSL_RELEASE_DATE "{- $config{release_date} -}" -# define OPENSSL_VERSION_TEXT "OpenSSL {- "$config{full_version} $config{release_date}" -}" /* * SECTION 4: BACKWARD COMPATIBILITY */ + +# define OPENSSL_VERSION_TEXT "OpenSSL {- "$config{full_version} $config{release_date}" -}" + /* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */ # ifdef OPENSSL_VERSION_PRE_RELEASE # define _OPENSSL_VERSION_PRE_RELEASE 0x0 -- 2.25.1