From: Aram Sargsyan Date: Sat, 4 Sep 2021 18:33:25 +0000 (+0000) Subject: Use thinner shims for OpenSSL's EVP_MD_CTX_new() and EVP_MD_CTX_free() X-Git-Tag: v9.17.20~19^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a6febd5d263afe7181ef6f94c93a7105fcb519f;p=thirdparty%2Fbind9.git Use thinner shims for OpenSSL's EVP_MD_CTX_new() and EVP_MD_CTX_free() The EVP_MD_CTX_new() and EVP_MD_CTX_free() functions are renamed APIs which were previously available as EVP_MD_CTX_create() and EVP_MD_CTX_destroy() respectively, which means that we can use them instead of providing our own shim functions. --- diff --git a/lib/isc/openssl_shim.c b/lib/isc/openssl_shim.c index bc1baa92bbb..aadeedc16e3 100644 --- a/lib/isc/openssl_shim.c +++ b/lib/isc/openssl_shim.c @@ -51,27 +51,6 @@ EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) { } #endif /* if !HAVE_EVP_CIPHER_CTX_FREE */ -#if !HAVE_EVP_MD_CTX_NEW -EVP_MD_CTX * -EVP_MD_CTX_new(void) { - EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof(*ctx)); - if (ctx != NULL) { - memset(ctx, 0, sizeof(*ctx)); - } - return (ctx); -} -#endif /* if !HAVE_EVP_MD_CTX_NEW */ - -#if !HAVE_EVP_MD_CTX_FREE -void -EVP_MD_CTX_free(EVP_MD_CTX *ctx) { - if (ctx != NULL) { - EVP_MD_CTX_cleanup(ctx); - OPENSSL_free(ctx); - } -} -#endif /* if !HAVE_EVP_MD_CTX_FREE */ - #if !HAVE_EVP_MD_CTX_RESET int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) { diff --git a/lib/isc/openssl_shim.h b/lib/isc/openssl_shim.h index 87fcf29bc81..4ea067af926 100644 --- a/lib/isc/openssl_shim.h +++ b/lib/isc/openssl_shim.h @@ -38,13 +38,11 @@ EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx); #endif /* if !HAVE_EVP_CIPHER_CTX_FREE */ #if !HAVE_EVP_MD_CTX_NEW -EVP_MD_CTX * -EVP_MD_CTX_new(void); +#define EVP_MD_CTX_new EVP_MD_CTX_create #endif /* if !HAVE_EVP_MD_CTX_NEW */ #if !HAVE_EVP_MD_CTX_FREE -void -EVP_MD_CTX_free(EVP_MD_CTX *ctx); +#define EVP_MD_CTX_free EVP_MD_CTX_destroy #endif /* if !HAVE_EVP_MD_CTX_FREE */ #if !HAVE_EVP_MD_CTX_RESET