summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/hw_cswift.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_cswift.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_cswift.c')
-rw-r--r--src/lib/libcrypto/engine/hw_cswift.c27
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;
280t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL; 280t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL;
281 281
282/* Used in the DSO operations. */ 282/* Used in the DSO operations. */
283static const char def_CSWIFT_LIBNAME[] = "swift"; 283static const char *CSWIFT_LIBNAME = NULL;
284static const char *CSWIFT_LIBNAME = def_CSWIFT_LIBNAME; 284static const char *get_CSWIFT_LIBNAME(void)
285 {
286 if(CSWIFT_LIBNAME)
287 return CSWIFT_LIBNAME;
288 return "swift";
289 }
290static void free_CSWIFT_LIBNAME(void)
291 {
292 if(CSWIFT_LIBNAME)
293 OPENSSL_free((void*)CSWIFT_LIBNAME);
294 CSWIFT_LIBNAME = NULL;
295 }
296static long set_CSWIFT_LIBNAME(const char *name)
297 {
298 free_CSWIFT_LIBNAME();
299 return (((CSWIFT_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
300 }
285static const char *CSWIFT_F1 = "swAcquireAccContext"; 301static const char *CSWIFT_F1 = "swAcquireAccContext";
286static const char *CSWIFT_F2 = "swAttachKeyParam"; 302static const char *CSWIFT_F2 = "swAttachKeyParam";
287static const char *CSWIFT_F3 = "swSimpleRequest"; 303static 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) */
314static int cswift_destroy(ENGINE *e) 330static 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
378static int cswift_finish(ENGINE *e) 395static 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 }