From 35338b41058b0bcebb137eb098e785f171d0476f Mon Sep 17 00:00:00 2001 From: Artem Boldariev Date: Mon, 9 May 2022 19:08:29 +0300 Subject: [PATCH] Add SSL_SESSION_is_resumable() implementation shim This commit adds SSL_SESSION_is_resumable() implementation if it is missing. --- configure.ac | 1 + lib/isc/openssl_shim.c | 8 ++++++++ lib/isc/openssl_shim.h | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/configure.ac b/configure.ac index 84108c9820..7b284ef6da 100644 --- a/configure.ac +++ b/configure.ac @@ -667,6 +667,7 @@ AC_CHECK_FUNCS([SSL_CTX_up_ref]) AC_CHECK_FUNCS([SSL_read_ex SSL_peek_ex SSL_write_ex]) AC_CHECK_FUNCS([SSL_CTX_set1_cert_store X509_STORE_up_ref]) AC_CHECK_FUNCS([SSL_CTX_up_ref]) +AC_CHECK_FUNCS([SSL_SESSION_is_resumable]) # # Check for algorithm support in OpenSSL diff --git a/lib/isc/openssl_shim.c b/lib/isc/openssl_shim.c index c39ba8c682..040fc68fbb 100644 --- a/lib/isc/openssl_shim.c +++ b/lib/isc/openssl_shim.c @@ -196,3 +196,11 @@ SSL_CTX_up_ref(SSL_CTX *ctx) { return (CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX) > 0); } #endif /* !HAVE_SSL_CTX_UP_REF */ + +#if !HAVE_SSL_SESSION_IS_RESUMABLE +int +SSL_SESSION_is_resumable(const SSL_SESSION *sess) { + return (!sess->not_resumable && + (sess->session_id_length > 0 || sess->tlsext_ticklen > 0)); +} +#endif /* HAVE_SSL_SESSION_IS_RESUMABLE */ diff --git a/lib/isc/openssl_shim.h b/lib/isc/openssl_shim.h index b2916e20a9..6b3a30b288 100644 --- a/lib/isc/openssl_shim.h +++ b/lib/isc/openssl_shim.h @@ -135,3 +135,8 @@ SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store); int SSL_CTX_up_ref(SSL_CTX *store); #endif /* !HAVE_SSL_CTX_UP_REF */ + +#if !HAVE_SSL_SESSION_IS_RESUMABLE +int +SSL_SESSION_is_resumable(const SSL_SESSION *s); +#endif /* HAVE_SSL_SESSION_IS_RESUMABLE */