]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use thinner shims for OpenSSL's EVP_MD_CTX_new() and EVP_MD_CTX_free()
authorAram Sargsyan <aram@isc.org>
Sat, 4 Sep 2021 18:33:25 +0000 (18:33 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 28 Oct 2021 07:38:56 +0000 (07:38 +0000)
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.

lib/isc/openssl_shim.c
lib/isc/openssl_shim.h

index bc1baa92bbb3d0efd02e360f44efdc00e5b13891..aadeedc16e345a69b1ec1d0bfea55708163d9f71 100644 (file)
@@ -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) {
index 87fcf29bc81b7a70d9d79e0facd7f6097a8bf9b4..4ea067af926b659964992199c8a3fd2ee39616ea 100644 (file)
@@ -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