#include "vendor_defns/atalla.h"
#endif
+static int atalla_destroy(ENGINE *e);
static int atalla_init(ENGINE *e);
static int atalla_finish(ENGINE *e);
static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
ERR_load_strings(atalla_err_lib,atalla_str_functs);
}
}
+static void atalla_unload_error_strings(void)
+ {
+ if (atalla_err_lib >= 0)
+ {
+ ERR_unload_strings(atalla_err_lib,atalla_str_functs);
+ atalla_err_lib = -1;
+ }
+ }
#else
#define ATALLAerr(f,r) /* NOP */
static void atalla_load_error_strings(void) { } /* NOP */
+static void atalla_unload_error_strings(void) { } /* NOP */
#endif
/* Constants used when creating the ENGINE */
!ENGINE_set_DH(e, &atalla_dh) ||
#endif
!ENGINE_set_BN_mod_exp(e, atalla_mod_exp) ||
+ !ENGINE_set_destroy_function(e, atalla_destroy) ||
!ENGINE_set_init_function(e, atalla_init) ||
!ENGINE_set_finish_function(e, atalla_finish) ||
!ENGINE_set_ctrl_function(e, atalla_ctrl) ||
static const char *ATALLA_F2 = "ASI_RSAPrivateKeyOpFn";
static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics";
+/* Destructor (complements the "ENGINE_atalla()" constructor) */
+static int atalla_destroy(ENGINE *e)
+ {
+ /* Unload the atalla error strings so any error state including our
+ * functs or reasons won't lead to a segfault (they simply get displayed
+ * without corresponding string data because none will be found). */
+ atalla_unload_error_strings();
+ return 1;
+ }
+
/* (de)initialisation functions. */
static int atalla_init(ENGINE *e)
{
#include "vendor_defns/cswift.h"
#endif
+static int cswift_destroy(ENGINE *e);
static int cswift_init(ENGINE *e);
static int cswift_finish(ENGINE *e);
static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
ERR_load_strings(cswift_err_lib, cswift_str_functs);
}
}
+static void cswift_unload_error_strings(void)
+ {
+ if(cswift_err_lib >= 0)
+ {
+ ERR_unload_strings(cswift_err_lib, cswift_str_functs);
+ cswift_err_lib = -1;
+ }
+ }
#else
#define CSWIFTerr(f,r) /* NOP */
static void cswift_load_error_strings(void) { } /* NOP */
+static void cswift_unload_error_strings(void) { } /* NOP */
#endif
/* Constants used when creating the ENGINE */
#endif
!ENGINE_set_BN_mod_exp(e, &cswift_mod_exp) ||
!ENGINE_set_BN_mod_exp_crt(e, &cswift_mod_exp_crt) ||
+ !ENGINE_set_destroy_function(e, cswift_destroy) ||
!ENGINE_set_init_function(e, cswift_init) ||
!ENGINE_set_finish_function(e, cswift_finish) ||
!ENGINE_set_ctrl_function(e, cswift_ctrl) ||
p_CSwift_ReleaseAccContext(hac);
}
+/* Destructor (complements the "ENGINE_cswift()" constructor) */
+static int cswift_destroy(ENGINE *e)
+ {
+ cswift_unload_error_strings();
+ return 1;
+ }
+
/* (de)initialisation functions. */
static int cswift_init(ENGINE *e)
{
#include "vendor_defns/hwcryptohook.h"
#endif
+static int hwcrhk_destroy(ENGINE *e);
static int hwcrhk_init(ENGINE *e);
static int hwcrhk_finish(ENGINE *e);
static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
ERR_load_strings(hwcrhk_err_lib, hwcrhk_str_functs);
}
}
+static void hwcrhk_unload_error_strings(void)
+ {
+ if(hwcrhk_err_lib >= 0)
+ {
+ ERR_unload_strings(hwcrhk_err_lib, hwcrhk_str_functs);
+ hwcrhk_err_lib = -1;
+ }
+ }
#else
-#define HWCRHKerr(f,r) /* NOP */
-static void hwcrhk_load_error_strings(void) { } /* NOP */
+#define HWCRHKerr(f,r) /* NOP */
+static void hwcrhk_load_error_strings(void) { } /* NOP */
+static void hwcrhk_unload_error_strings(void) { } /* NOP */
#endif
/* Constants used when creating the ENGINE */
#endif
!ENGINE_set_RAND(e, &hwcrhk_rand) ||
!ENGINE_set_BN_mod_exp(e, hwcrhk_mod_exp) ||
+ !ENGINE_set_destroy_function(e, hwcrhk_destroy) ||
!ENGINE_set_init_function(e, hwcrhk_init) ||
!ENGINE_set_finish_function(e, hwcrhk_finish) ||
!ENGINE_set_ctrl_function(e, hwcrhk_ctrl) ||
p_hwcrhk_Finish(hac);
}
+/* Destructor (complements the "ENGINE_ncipher()" constructor) */
+static int hwcrhk_destroy(ENGINE *e)
+ {
+ hwcrhk_unload_error_strings();
+ return 1;
+ }
+
/* (de)initialisation functions. */
static int hwcrhk_init(ENGINE *e)
{
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);
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)
!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) ||
#include "vendor_defns/hw_ubsec.h"
#endif
+static int ubsec_destroy(ENGINE *e);
static int ubsec_init(ENGINE *e);
static int ubsec_finish(ENGINE *e);
static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
ERR_load_strings(ubsec_err_lib, ubsec_str_functs);
}
}
+static void ubsec_unload_error_strings(void)
+ {
+ if(ubsec_err_lib >= 0)
+ {
+ ERR_unload_strings(ubsec_err_lib, ubsec_str_functs);
+ ubsec_err_lib = -1;
+ }
+ }
#else
-#define UBSECerr(f,r) /* NOP */
-static void ubsec_load_error_strings(void) { } /* NOP */
+#define UBSECerr(f,r) /* NOP */
+static void ubsec_load_error_strings(void) { } /* NOP */
+static void ubsec_unload_error_strings(void) { } /* NOP */
#endif
/* Constants used when creating the ENGINE */
#endif
!ENGINE_set_BN_mod_exp(e, ubsec_mod_exp) ||
!ENGINE_set_BN_mod_exp_crt(e, ubsec_mod_exp_crt) ||
+ !ENGINE_set_destroy_function(e, ubsec_destroy) ||
!ENGINE_set_init_function(e, ubsec_init) ||
!ENGINE_set_finish_function(e, ubsec_finish) ||
!ENGINE_set_ctrl_function(e, ubsec_ctrl) ||
static const char *UBSEC_F11 = "math_accelerate_ioctl";
static const char *UBSEC_F12 = "rng_ioctl";
+/* Destructor (complements the "ENGINE_ubsec()" constructor) */
+static int ubsec_destroy(ENGINE *e)
+ {
+ ubsec_unload_error_strings();
+ return 1;
+ }
+
/* (de)initialisation functions. */
static int ubsec_init(ENGINE *e)
{