]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add ENGINE_init and ENGINE_finish calls
authorPetr Menšík <pemensik@redhat.com>
Wed, 7 Sep 2022 11:46:31 +0000 (13:46 +0200)
committerMark Andrews <marka@isc.org>
Fri, 23 Sep 2022 04:05:16 +0000 (14:05 +1000)
According to manual page of ENGINE_init, it should be called explicitly
before any key operations happens. Make it active whole lifetime.

(cherry picked from commit 71a8f1e7cd83075416a4edd71572c9aec0ec49d5)

lib/dns/openssl_link.c

index 333f34cb37a4bcca6c696a09b45fa83c56b19e4d..a3f63885fa3ffaba9a5133ed7c3ee42d910a69a8 100644 (file)
@@ -85,14 +85,20 @@ dst__openssl_init(const char *engine) {
                        result = DST_R_NOENGINE;
                        goto cleanup_rm;
                }
+               if (!ENGINE_init(e)) {
+                       result = DST_R_NOENGINE;
+                       goto cleanup_rm;
+               }
                /* This will init the engine. */
                if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
                        result = DST_R_NOENGINE;
-                       goto cleanup_rm;
+                       goto cleanup_init;
                }
        }
 
        return (ISC_R_SUCCESS);
+cleanup_init:
+       ENGINE_finish(e);
 cleanup_rm:
        if (e != NULL) {
                ENGINE_free(e);
@@ -108,6 +114,7 @@ void
 dst__openssl_destroy(void) {
 #if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000
        if (e != NULL) {
+               ENGINE_finish(e);
                ENGINE_free(e);
        }
        e = NULL;