mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
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:
parent
a29570a1e2
commit
c22f275744
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user