summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/hw_aep.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_aep.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_aep.c')
-rw-r--r--src/lib/libcrypto/engine/hw_aep.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/lib/libcrypto/engine/hw_aep.c b/src/lib/libcrypto/engine/hw_aep.c
index cf4507cff1..8b8380a582 100644
--- a/src/lib/libcrypto/engine/hw_aep.c
+++ b/src/lib/libcrypto/engine/hw_aep.c
@@ -60,7 +60,7 @@
60#include <string.h> 60#include <string.h>
61 61
62#include <openssl/e_os2.h> 62#include <openssl/e_os2.h>
63#ifndef OPENSSL_SYS_MSDOS 63#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
64#include <sys/types.h> 64#include <sys/types.h>
65#include <unistd.h> 65#include <unistd.h>
66#else 66#else
@@ -71,6 +71,7 @@ typedef int pid_t;
71#include <openssl/crypto.h> 71#include <openssl/crypto.h>
72#include <openssl/dso.h> 72#include <openssl/dso.h>
73#include <openssl/engine.h> 73#include <openssl/engine.h>
74#include <openssl/buffer.h>
74 75
75#ifndef OPENSSL_NO_HW 76#ifndef OPENSSL_NO_HW
76#ifndef OPENSSL_NO_HW_AEP 77#ifndef OPENSSL_NO_HW_AEP
@@ -363,7 +364,24 @@ static DSO *aep_dso = NULL;
363/* These are the static string constants for the DSO file name and the function 364/* These are the static string constants for the DSO file name and the function
364 * symbol names to bind to. 365 * symbol names to bind to.
365*/ 366*/
366static const char *AEP_LIBNAME = "aep"; 367static const char *AEP_LIBNAME = NULL;
368static const char *get_AEP_LIBNAME(void)
369 {
370 if(AEP_LIBNAME)
371 return AEP_LIBNAME;
372 return "aep";
373 }
374static void free_AEP_LIBNAME(void)
375 {
376 if(AEP_LIBNAME)
377 OPENSSL_free((void*)AEP_LIBNAME);
378 AEP_LIBNAME = NULL;
379 }
380static long set_AEP_LIBNAME(const char *name)
381 {
382 free_AEP_LIBNAME();
383 return ((AEP_LIBNAME = BUF_strdup(name)) != NULL ? 1 : 0);
384 }
367 385
368static const char *AEP_F1 = "AEP_ModExp"; 386static const char *AEP_F1 = "AEP_ModExp";
369static const char *AEP_F2 = "AEP_ModExpCrt"; 387static const char *AEP_F2 = "AEP_ModExpCrt";
@@ -412,7 +430,7 @@ static int aep_init(ENGINE *e)
412 } 430 }
413 /* Attempt to load libaep.so. */ 431 /* Attempt to load libaep.so. */
414 432
415 aep_dso = DSO_load(NULL, AEP_LIBNAME, NULL, 0); 433 aep_dso = DSO_load(NULL, get_AEP_LIBNAME(), NULL, 0);
416 434
417 if(aep_dso == NULL) 435 if(aep_dso == NULL)
418 { 436 {
@@ -474,6 +492,7 @@ static int aep_init(ENGINE *e)
474/* Destructor (complements the "ENGINE_aep()" constructor) */ 492/* Destructor (complements the "ENGINE_aep()" constructor) */
475static int aep_destroy(ENGINE *e) 493static int aep_destroy(ENGINE *e)
476 { 494 {
495 free_AEP_LIBNAME();
477 ERR_unload_AEPHK_strings(); 496 ERR_unload_AEPHK_strings();
478 return 1; 497 return 1;
479 } 498 }
@@ -549,8 +568,7 @@ static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
549 AEPHK_R_ALREADY_LOADED); 568 AEPHK_R_ALREADY_LOADED);
550 return 0; 569 return 0;
551 } 570 }
552 AEP_LIBNAME = (const char *)p; 571 return set_AEP_LIBNAME((const char*)p);
553 return 1;
554 default: 572 default:
555 break; 573 break;
556 } 574 }