Skip to content

Commit

Permalink
Undeprecate OpenSSL_version_num and OPENSSL_VERSION_NUMBER
Browse files Browse the repository at this point in the history
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 <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #7853)
  • Loading branch information
Viktor Dukhovni authored and levitte committed Sep 5, 2019
1 parent 464ac47 commit 7e8c338
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
2 changes: 0 additions & 2 deletions crypto/cversion.c
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion include/openssl/crypto.h
Expand Up @@ -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
Expand Down
22 changes: 9 additions & 13 deletions include/openssl/opensslv.h
Expand Up @@ -121,21 +121,17 @@ const char *OPENSSL_version_build_metadata(void);
/*
* SECTION 4: BACKWARD COMPATIBILITY
*/
# include <openssl/macros.h>

# 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
}
Expand Down
2 changes: 1 addition & 1 deletion util/libcrypto.num
Expand Up @@ -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:
Expand Down

0 comments on commit 7e8c338

Please sign in to comment.