summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/hw_ubsec.c
diff options
context:
space:
mode:
authormarkus <>2002-09-05 22:45:21 +0000
committermarkus <>2002-09-05 22:45:21 +0000
commit2a6851ef8adb0e84ff2515493d3704a13c6256b0 (patch)
tree9df5b497548eaf51e9f234d27aaf988cd14882c2 /src/lib/libcrypto/engine/hw_ubsec.c
parent5514995a9d5ed91db089875adb509c7781357c0e (diff)
downloadopenbsd-2a6851ef8adb0e84ff2515493d3704a13c6256b0.tar.gz
openbsd-2a6851ef8adb0e84ff2515493d3704a13c6256b0.tar.bz2
openbsd-2a6851ef8adb0e84ff2515493d3704a13c6256b0.zip
import openssl-0.9.7-beta3
Diffstat (limited to 'src/lib/libcrypto/engine/hw_ubsec.c')
-rw-r--r--src/lib/libcrypto/engine/hw_ubsec.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lib/libcrypto/engine/hw_ubsec.c b/src/lib/libcrypto/engine/hw_ubsec.c
index 743c06043c..63397f868c 100644
--- a/src/lib/libcrypto/engine/hw_ubsec.c
+++ b/src/lib/libcrypto/engine/hw_ubsec.c
@@ -304,7 +304,24 @@ static int max_key_len = 1024; /* ??? */
304 * symbol names to bind to. 304 * symbol names to bind to.
305 */ 305 */
306 306
307static const char *UBSEC_LIBNAME = "ubsec"; 307static const char *UBSEC_LIBNAME = NULL;
308static const char *get_UBSEC_LIBNAME(void)
309 {
310 if(UBSEC_LIBNAME)
311 return UBSEC_LIBNAME;
312 return "ubsec";
313 }
314static void free_UBSEC_LIBNAME(void)
315 {
316 if(UBSEC_LIBNAME)
317 OPENSSL_free((void*)UBSEC_LIBNAME);
318 UBSEC_LIBNAME = NULL;
319 }
320static long set_UBSEC_LIBNAME(const char *name)
321 {
322 free_UBSEC_LIBNAME();
323 return (((UBSEC_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
324 }
308static const char *UBSEC_F1 = "ubsec_bytes_to_bits"; 325static const char *UBSEC_F1 = "ubsec_bytes_to_bits";
309static const char *UBSEC_F2 = "ubsec_bits_to_bytes"; 326static const char *UBSEC_F2 = "ubsec_bits_to_bytes";
310static const char *UBSEC_F3 = "ubsec_open"; 327static const char *UBSEC_F3 = "ubsec_open";
@@ -328,6 +345,7 @@ static const char *UBSEC_F13 = "ubsec_max_key_len_ioctl";
328/* Destructor (complements the "ENGINE_ubsec()" constructor) */ 345/* Destructor (complements the "ENGINE_ubsec()" constructor) */
329static int ubsec_destroy(ENGINE *e) 346static int ubsec_destroy(ENGINE *e)
330 { 347 {
348 free_UBSEC_LIBNAME();
331 ERR_unload_UBSEC_strings(); 349 ERR_unload_UBSEC_strings();
332 return 1; 350 return 1;
333 } 351 }
@@ -364,7 +382,7 @@ static int ubsec_init(ENGINE *e)
364 /* 382 /*
365 * Attempt to load libubsec.so/ubsec.dll/whatever. 383 * Attempt to load libubsec.so/ubsec.dll/whatever.
366 */ 384 */
367 ubsec_dso = DSO_load(NULL, UBSEC_LIBNAME, NULL, 0); 385 ubsec_dso = DSO_load(NULL, get_UBSEC_LIBNAME(), NULL, 0);
368 if(ubsec_dso == NULL) 386 if(ubsec_dso == NULL)
369 { 387 {
370 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE); 388 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE);
@@ -459,6 +477,7 @@ err:
459 477
460static int ubsec_finish(ENGINE *e) 478static int ubsec_finish(ENGINE *e)
461 { 479 {
480 free_UBSEC_LIBNAME();
462 if(ubsec_dso == NULL) 481 if(ubsec_dso == NULL)
463 { 482 {
464 UBSECerr(UBSEC_F_UBSEC_FINISH, UBSEC_R_NOT_LOADED); 483 UBSECerr(UBSEC_F_UBSEC_FINISH, UBSEC_R_NOT_LOADED);
@@ -508,8 +527,7 @@ static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
508 UBSECerr(UBSEC_F_UBSEC_CTRL,UBSEC_R_ALREADY_LOADED); 527 UBSECerr(UBSEC_F_UBSEC_CTRL,UBSEC_R_ALREADY_LOADED);
509 return 0; 528 return 0;
510 } 529 }
511 UBSEC_LIBNAME = (const char *)p; 530 return set_UBSEC_LIBNAME((const char *)p);
512 return 1;
513 default: 531 default:
514 break; 532 break;
515 } 533 }