Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)

Since OpenSSL 3.0 there is new OPENSSL_VERSION_MAJOR, but previous
releases does not have it.

So let's use plain old OPENSSL_VERSION_NUMBER to avoid more preprocessor
macros.
This commit is contained in:
Azat Khuzhin 2022-07-09 23:27:23 +03:00
parent a29570a1e2
commit c22f275744
3 changed files with 4 additions and 4 deletions

View File

@ -188,7 +188,7 @@ static void ssl_ctx_free(struct ssl_context *ssl)
static int ssl_load_key(struct ssl_context *ssl)
{
int err = 1;
#if OPENSSL_VERSION_MAJOR >= 3
#if OPENSSL_VERSION_NUMBER >= 0x30000000
ssl->pkey = EVP_RSA_gen(4096);
err = ssl->pkey == NULL;
#else
@ -391,7 +391,7 @@ static void be_ssl_errors(struct bufferevent *bev)
while ((err = bufferevent_get_openssl_error(bev))) {
const char *msg = ERR_reason_error_string(err);
const char *lib = ERR_lib_error_string(err);
#if OPENSSL_VERSION_MAJOR >= 3
#if OPENSSL_VERSION_NUMBER >= 0x30000000
error("ssl/err=%d/%s in %s\n", err, msg, lib);
#else
const char *func = ERR_func_error_string(err);

View File

@ -113,7 +113,7 @@ eventcb(struct bufferevent *bev, short what, void *ctx)
ERR_reason_error_string(err);
const char *lib = (const char*)
ERR_lib_error_string(err);
#if OPENSSL_VERSION_MAJOR >= 3
#if OPENSSL_VERSION_NUMBER >= 0x30000000
fprintf(stderr,
"%s in %s\n", msg, lib);
#else

View File

@ -224,7 +224,7 @@ eventcb(struct bufferevent *bev, short what, void *ctx)
++n_connected;
ssl = bufferevent_ssl_get_ssl(bev);
tt_assert(ssl);
#if OPENSSL_VERSION_MAJOR >= 3
#if OPENSSL_VERSION_NUMBER >= 0x30000000
/* SSL_get1_peer_certificate() means we want
* to increase the reference count on the cert
* and so we will need to free it ourselves later