File openssl-ibmca-sles15sp1-Move-ERR_load-unload-to-bind_helper-resp-destroy-fun.patch of Package openssl-ibmca.11764

From dd7a13ce717e6a169d1031b91c3ca8d8ae94d0c1 Mon Sep 17 00:00:00 2001
From: Patrick Steuer <patrick.steuer@de.ibm.com>
Date: Tue, 23 Apr 2019 17:53:32 +0200
Subject: Move ERR_load/unload to bind_helper resp destroy function

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
---
 src/e_ibmca.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/e_ibmca.c b/src/e_ibmca.c
index 723654d..f0b9f30 100644
--- a/src/e_ibmca.c
+++ b/src/e_ibmca.c
@@ -259,6 +259,8 @@ static int ibmca_destroy(ENGINE *e)
 #ifndef NO_EC
     ibmca_ec_destroy();
 #endif
+
+    ERR_unload_IBMCA_strings();
     return 1;
 }
 
@@ -634,8 +636,6 @@ static void ibmca_constructor(void)
     if (init)
         return;
 
-    ERR_load_IBMCA_strings();
-
     ibmca_dso = dlopen(LIBICA_SHARED_LIB, RTLD_NOW);
     if (ibmca_dso == NULL) {
         DEBUG_PRINTF("%s: dlopen(%s) failed\n", __func__, LIBICA_SHARED_LIB);
@@ -751,8 +751,6 @@ err:
 __attribute__((destructor))
 static void ibmca_destructor(void)
 {
-    ERR_unload_IBMCA_strings();
-
     if (ibmca_dso == NULL) {
         IBMCAerr(IBMCA_F_IBMCA_FINISH, IBMCA_R_NOT_LOADED);
         return;
@@ -808,6 +806,8 @@ static int ibmca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) ())
  */
 static int bind_helper(ENGINE *e)
 {
+    ERR_load_IBMCA_strings();
+
     if (!ENGINE_set_id(e, engine_ibmca_id) ||
         !ENGINE_set_name(e, engine_ibmca_name) ||
         !ENGINE_set_destroy_function(e, ibmca_destroy) ||
-- 
2.13.7