double definition
[openssl.git] / crypto / engine / hw_nuron.c
index 1a8570c47e4140fd04ccfdd3971b06540310caa9..7469b8ceae9ac52c6b39d353433cef5f121a653a 100644 (file)
@@ -93,7 +93,6 @@ static const ENGINE_CMD_DEFN nuron_cmd_defns[] = {
 #define NURON_R_NOT_LOADED                     107
 #define NURON_R_DSO_FAILURE                    108
 #define NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED   109
-#define NURON_R_NOT_LOADED                     110
 static ERR_STRING_DATA nuron_str_functs[] =
        {
        /* This first element is changed to match the dynamic 'lib' number */
@@ -125,9 +124,18 @@ static void nuron_load_error_strings(void)
                ERR_load_strings(nuron_err_lib, nuron_str_functs);
                }
        }
+static void nuron_unload_error_strings(void)
+       {
+       if(nuron_err_lib >= 0)
+               {
+               ERR_unload_strings(nuron_err_lib, nuron_str_functs);
+               nuron_err_lib = -1;
+               }
+       }
 #else
-#define NURONerr(f,r)                            /* NOP */
-static void nuron_load_error_strings(void) { }  /* NOP */
+#define NURONerr(f,r)                                  /* NOP */
+static void nuron_load_error_strings(void) { }         /* NOP */
+static void nuron_unload_error_strings(void) { }       /* NOP */
 #endif
 
 typedef int tfnModExp(BIGNUM *r,const BIGNUM *a,const BIGNUM *p,const BIGNUM *m);
@@ -135,6 +143,12 @@ static tfnModExp *pfnModExp = NULL;
 
 static DSO *pvDSOHandle = NULL;
 
+static int nuron_destroy(ENGINE *e)
+       {
+       nuron_unload_error_strings();
+       return 1;
+       }
+
 static int nuron_init(ENGINE *e)
        {
        if(pvDSOHandle != NULL)
@@ -356,6 +370,7 @@ static int bind_helper(ENGINE *e)
                        !ENGINE_set_DH(e, &nuron_dh) ||
 #endif
                        !ENGINE_set_BN_mod_exp(e, nuron_mod_exp) ||
+                       !ENGINE_set_destroy_function(e, nuron_destroy) ||
                        !ENGINE_set_init_function(e, nuron_init) ||
                        !ENGINE_set_finish_function(e, nuron_finish) ||
                        !ENGINE_set_ctrl_function(e, nuron_ctrl) ||