summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/hw_nuron.c
diff options
context:
space:
mode:
authormarkus <>2002-09-10 16:31:57 +0000
committermarkus <>2002-09-10 16:31:57 +0000
commit7d038e9d4d83e7c7120e78418e108df70b9025d6 (patch)
treebaf775b286ff801a89f746b1938a3c700bba6822 /src/lib/libcrypto/engine/hw_nuron.c
parent3bd21dd4c3a3e3106321a5f6b3641ab9f18a6e3b (diff)
downloadopenbsd-7d038e9d4d83e7c7120e78418e108df70b9025d6.tar.gz
openbsd-7d038e9d4d83e7c7120e78418e108df70b9025d6.tar.bz2
openbsd-7d038e9d4d83e7c7120e78418e108df70b9025d6.zip
merge openssl-0.9.7-beta3, tested on vax by miod@
Diffstat (limited to 'src/lib/libcrypto/engine/hw_nuron.c')
-rw-r--r--src/lib/libcrypto/engine/hw_nuron.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/lib/libcrypto/engine/hw_nuron.c b/src/lib/libcrypto/engine/hw_nuron.c
index 2672012154..130b6d8b40 100644
--- a/src/lib/libcrypto/engine/hw_nuron.c
+++ b/src/lib/libcrypto/engine/hw_nuron.c
@@ -69,8 +69,24 @@
69#define NURON_LIB_NAME "nuron engine" 69#define NURON_LIB_NAME "nuron engine"
70#include "hw_nuron_err.c" 70#include "hw_nuron_err.c"
71 71
72static const char def_NURON_LIBNAME[] = "nuronssl"; 72static const char *NURON_LIBNAME = NULL;
73static const char *NURON_LIBNAME = def_NURON_LIBNAME; 73static const char *get_NURON_LIBNAME(void)
74 {
75 if(NURON_LIBNAME)
76 return NURON_LIBNAME;
77 return "nuronssl";
78 }
79static void free_NURON_LIBNAME(void)
80 {
81 if(NURON_LIBNAME)
82 OPENSSL_free((void*)NURON_LIBNAME);
83 NURON_LIBNAME = NULL;
84 }
85static long set_NURON_LIBNAME(const char *name)
86 {
87 free_NURON_LIBNAME();
88 return (((NURON_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
89 }
74static const char *NURON_F1 = "nuron_mod_exp"; 90static const char *NURON_F1 = "nuron_mod_exp";
75 91
76/* The definitions for control commands specific to this engine */ 92/* The definitions for control commands specific to this engine */
@@ -90,6 +106,7 @@ static DSO *pvDSOHandle = NULL;
90 106
91static int nuron_destroy(ENGINE *e) 107static int nuron_destroy(ENGINE *e)
92 { 108 {
109 free_NURON_LIBNAME();
93 ERR_unload_NURON_strings(); 110 ERR_unload_NURON_strings();
94 return 1; 111 return 1;
95 } 112 }
@@ -102,7 +119,7 @@ static int nuron_init(ENGINE *e)
102 return 0; 119 return 0;
103 } 120 }
104 121
105 pvDSOHandle = DSO_load(NULL, NURON_LIBNAME, NULL, 122 pvDSOHandle = DSO_load(NULL, get_NURON_LIBNAME(), NULL,
106 DSO_FLAG_NAME_TRANSLATION_EXT_ONLY); 123 DSO_FLAG_NAME_TRANSLATION_EXT_ONLY);
107 if(!pvDSOHandle) 124 if(!pvDSOHandle)
108 { 125 {
@@ -122,6 +139,7 @@ static int nuron_init(ENGINE *e)
122 139
123static int nuron_finish(ENGINE *e) 140static int nuron_finish(ENGINE *e)
124 { 141 {
142 free_NURON_LIBNAME();
125 if(pvDSOHandle == NULL) 143 if(pvDSOHandle == NULL)
126 { 144 {
127 NURONerr(NURON_F_NURON_FINISH,NURON_R_NOT_LOADED); 145 NURONerr(NURON_F_NURON_FINISH,NURON_R_NOT_LOADED);
@@ -153,8 +171,7 @@ static int nuron_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
153 NURONerr(NURON_F_NURON_CTRL,NURON_R_ALREADY_LOADED); 171 NURONerr(NURON_F_NURON_CTRL,NURON_R_ALREADY_LOADED);
154 return 0; 172 return 0;
155 } 173 }
156 NURON_LIBNAME = (const char *)p; 174 return set_NURON_LIBNAME((const char *)p);
157 return 1;
158 default: 175 default:
159 break; 176 break;
160 } 177 }