diff options
author | William Marlow <william.marlow@ibm.com> | 2022-06-18 21:43:31 +0100 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2022-07-09 23:24:53 +0300 |
commit | 29c420c418aeb497e5e8b7abd45dee39194ca5fc (patch) | |
tree | f2858d903feacf8b5c6322c213ed4ffaaea8090e /sample/becat.c | |
parent | 20977eae0d67f3b4f02aca2b891391517749b121 (diff) | |
download | libevent-29c420c418aeb497e5e8b7abd45dee39194ca5fc.tar.gz |
Initial OpenSSL 3.0 support
* Don't use deprecated functions when building against OpenSSL 3.0.
* Recognise that OpenSSL 3.0 can signal a dirty shutdown as a protocol.
error in addition to the expected IO error produced by OpenSSL 1.1.1
* Update regress_mbedtls.c for compatibility with OpenSSL 3
Diffstat (limited to 'sample/becat.c')
-rw-r--r-- | sample/becat.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sample/becat.c b/sample/becat.c index 00c5a55e..c6daf90a 100644 --- a/sample/becat.c +++ b/sample/becat.c @@ -188,6 +188,10 @@ 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 + ssl->pkey = EVP_RSA_gen(4096); + err = ssl->pkey == NULL; +#else BIGNUM *bn; RSA *key; @@ -205,6 +209,7 @@ static int ssl_load_key(struct ssl_context *ssl) err = 0; err: BN_free(bn); +#endif return err; } static int ssl_load_cert(struct ssl_context *ssl) @@ -386,8 +391,12 @@ 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 + error("ssl/err=%d/%s in %s\n", err, msg, lib); +#else const char *func = ERR_func_error_string(err); error("ssl/err=%d/%s in %s %s\n", err, msg, lib, func); +#endif } } static int event_cb_(struct bufferevent *bev, short what, int ssl, int stop) |