From 7e8c3381937354cf171ceaf4c69315e9a45d4858 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Sun, 9 Dec 2018 17:10:29 -0500 Subject: [PATCH] Undeprecate OpenSSL_version_num and OPENSSL_VERSION_NUMBER The OpenSSL_version_num() function returns at runtime the OPENSSL_VERSION_NUMBER of the compiled OpenSSL library. This is a used and useful interface, and should not (at least yet) be deprecated, we just introduced the new versioning schema, it seems too early to deprecate the old. Reviewed-by: Tim Hudson Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/7853) --- crypto/cversion.c | 2 -- include/openssl/crypto.h | 2 +- include/openssl/opensslv.h | 22 +++++++++------------- util/libcrypto.num | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/crypto/cversion.c b/crypto/cversion.c index 2a0dcf9445..c81f56f42b 100644 --- a/crypto/cversion.c +++ b/crypto/cversion.c @@ -11,12 +11,10 @@ #include "buildinf.h" -#if !OPENSSL_API_3 unsigned long OpenSSL_version_num(void) { return OPENSSL_VERSION_NUMBER; } -#endif unsigned int OPENSSL_version_major(void) { diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index 05580ad93c..da62eef1b1 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -158,7 +158,7 @@ int OPENSSL_hexchar2int(unsigned char c); # define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) -DEPRECATEDIN_3(unsigned long OpenSSL_version_num(void)) +unsigned long OpenSSL_version_num(void); const char *OpenSSL_version(int type); # define OPENSSL_VERSION 0 # define OPENSSL_CFLAGS 1 diff --git a/include/openssl/opensslv.h b/include/openssl/opensslv.h index c1d4b6f9b6..6a62b495b2 100644 --- a/include/openssl/opensslv.h +++ b/include/openssl/opensslv.h @@ -121,21 +121,17 @@ const char *OPENSSL_version_build_metadata(void); /* * SECTION 4: BACKWARD COMPATIBILITY */ -# include - -# if !OPENSSL_API_4 /* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */ -# ifdef OPENSSL_VERSION_PRE_RELEASE -# define _OPENSSL_VERSION_PRE_RELEASE 0x0L -# else -# define _OPENSSL_VERSION_PRE_RELEASE 0xfL -# endif -# define OPENSSL_VERSION_NUMBER \ - ( (OPENSSL_VERSION_MAJOR<<28) \ - |(OPENSSL_VERSION_MINOR<<20) \ - |(OPENSSL_VERSION_PATCH<<4) \ - |_OPENSSL_VERSION_PRE_RELEASE ) +# ifdef OPENSSL_VERSION_PRE_RELEASE +# define _OPENSSL_VERSION_PRE_RELEASE 0x0 +# else +# define _OPENSSL_VERSION_PRE_RELEASE 0xf # endif +# define OPENSSL_VERSION_NUMBER \ + ( (OPENSSL_VERSION_MAJOR<<28) \ + |(OPENSSL_VERSION_MINOR<<20) \ + |(OPENSSL_VERSION_PATCH<<4) \ + |_OPENSSL_VERSION_PRE_RELEASE ) # ifdef __cplusplus } diff --git a/util/libcrypto.num b/util/libcrypto.num index 9f7b0fd7c6..e6567aefe2 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -3150,7 +3150,7 @@ CMS_RecipientInfo_get0_pkey_ctx 3215 3_0_0 EXIST::FUNCTION:CMS OCSP_REQINFO_free 3216 3_0_0 EXIST::FUNCTION:OCSP AUTHORITY_KEYID_new 3217 3_0_0 EXIST::FUNCTION: i2d_DIST_POINT_NAME 3218 3_0_0 EXIST::FUNCTION: -OpenSSL_version_num 3219 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3 +OpenSSL_version_num 3219 3_0_0 EXIST::FUNCTION: OCSP_CERTID_free 3220 3_0_0 EXIST::FUNCTION:OCSP BIO_hex_string 3221 3_0_0 EXIST::FUNCTION: X509_REQ_sign_ctx 3222 3_0_0 EXIST::FUNCTION: -- 2.25.1