diff options
author | markus <> | 2002-09-10 16:31:57 +0000 |
---|---|---|
committer | markus <> | 2002-09-10 16:31:57 +0000 |
commit | 7d038e9d4d83e7c7120e78418e108df70b9025d6 (patch) | |
tree | baf775b286ff801a89f746b1938a3c700bba6822 /src/lib/libcrypto/engine/hw_cswift.c | |
parent | 3bd21dd4c3a3e3106321a5f6b3641ab9f18a6e3b (diff) | |
download | openbsd-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_cswift.c')
-rw-r--r-- | src/lib/libcrypto/engine/hw_cswift.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/lib/libcrypto/engine/hw_cswift.c b/src/lib/libcrypto/engine/hw_cswift.c index da732abce0..f5c897bdbb 100644 --- a/src/lib/libcrypto/engine/hw_cswift.c +++ b/src/lib/libcrypto/engine/hw_cswift.c | |||
@@ -280,8 +280,24 @@ t_swSimpleRequest *p_CSwift_SimpleRequest = NULL; | |||
280 | t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL; | 280 | t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL; |
281 | 281 | ||
282 | /* Used in the DSO operations. */ | 282 | /* Used in the DSO operations. */ |
283 | static const char def_CSWIFT_LIBNAME[] = "swift"; | 283 | static const char *CSWIFT_LIBNAME = NULL; |
284 | static const char *CSWIFT_LIBNAME = def_CSWIFT_LIBNAME; | 284 | static const char *get_CSWIFT_LIBNAME(void) |
285 | { | ||
286 | if(CSWIFT_LIBNAME) | ||
287 | return CSWIFT_LIBNAME; | ||
288 | return "swift"; | ||
289 | } | ||
290 | static void free_CSWIFT_LIBNAME(void) | ||
291 | { | ||
292 | if(CSWIFT_LIBNAME) | ||
293 | OPENSSL_free((void*)CSWIFT_LIBNAME); | ||
294 | CSWIFT_LIBNAME = NULL; | ||
295 | } | ||
296 | static long set_CSWIFT_LIBNAME(const char *name) | ||
297 | { | ||
298 | free_CSWIFT_LIBNAME(); | ||
299 | return (((CSWIFT_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
300 | } | ||
285 | static const char *CSWIFT_F1 = "swAcquireAccContext"; | 301 | static const char *CSWIFT_F1 = "swAcquireAccContext"; |
286 | static const char *CSWIFT_F2 = "swAttachKeyParam"; | 302 | static const char *CSWIFT_F2 = "swAttachKeyParam"; |
287 | static const char *CSWIFT_F3 = "swSimpleRequest"; | 303 | static const char *CSWIFT_F3 = "swSimpleRequest"; |
@@ -313,6 +329,7 @@ static void release_context(SW_CONTEXT_HANDLE hac) | |||
313 | /* Destructor (complements the "ENGINE_cswift()" constructor) */ | 329 | /* Destructor (complements the "ENGINE_cswift()" constructor) */ |
314 | static int cswift_destroy(ENGINE *e) | 330 | static int cswift_destroy(ENGINE *e) |
315 | { | 331 | { |
332 | free_CSWIFT_LIBNAME(); | ||
316 | ERR_unload_CSWIFT_strings(); | 333 | ERR_unload_CSWIFT_strings(); |
317 | return 1; | 334 | return 1; |
318 | } | 335 | } |
@@ -332,7 +349,7 @@ static int cswift_init(ENGINE *e) | |||
332 | goto err; | 349 | goto err; |
333 | } | 350 | } |
334 | /* Attempt to load libswift.so/swift.dll/whatever. */ | 351 | /* Attempt to load libswift.so/swift.dll/whatever. */ |
335 | cswift_dso = DSO_load(NULL, CSWIFT_LIBNAME, NULL, 0); | 352 | cswift_dso = DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0); |
336 | if(cswift_dso == NULL) | 353 | if(cswift_dso == NULL) |
337 | { | 354 | { |
338 | CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED); | 355 | CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED); |
@@ -377,6 +394,7 @@ err: | |||
377 | 394 | ||
378 | static int cswift_finish(ENGINE *e) | 395 | static int cswift_finish(ENGINE *e) |
379 | { | 396 | { |
397 | free_CSWIFT_LIBNAME(); | ||
380 | if(cswift_dso == NULL) | 398 | if(cswift_dso == NULL) |
381 | { | 399 | { |
382 | CSWIFTerr(CSWIFT_F_CSWIFT_FINISH,CSWIFT_R_NOT_LOADED); | 400 | CSWIFTerr(CSWIFT_F_CSWIFT_FINISH,CSWIFT_R_NOT_LOADED); |
@@ -411,8 +429,7 @@ static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | |||
411 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_ALREADY_LOADED); | 429 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_ALREADY_LOADED); |
412 | return 0; | 430 | return 0; |
413 | } | 431 | } |
414 | CSWIFT_LIBNAME = (const char *)p; | 432 | return set_CSWIFT_LIBNAME((const char *)p); |
415 | return 1; | ||
416 | default: | 433 | default: |
417 | break; | 434 | break; |
418 | } | 435 | } |