diff options
author | 2002-09-10 16:31:53 +0000 | |
---|---|---|
committer | 2002-09-10 16:31:53 +0000 | |
commit | 1f9308f95cf5f2eb77b454500c9bb49d76673ef3 (patch) | |
tree | c6825952eba2bd0bea9ff46656b25ab7eea8284b /lib/libssl/src/crypto/engine/hw_cswift.c | |
parent | Update list of supported CMD and Promise devices. (diff) | |
download | wireguard-openbsd-1f9308f95cf5f2eb77b454500c9bb49d76673ef3.tar.xz wireguard-openbsd-1f9308f95cf5f2eb77b454500c9bb49d76673ef3.zip |
merge openssl-0.9.7-beta3, tested on vax by miod@
Diffstat (limited to 'lib/libssl/src/crypto/engine/hw_cswift.c')
-rw-r--r-- | lib/libssl/src/crypto/engine/hw_cswift.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/libssl/src/crypto/engine/hw_cswift.c b/lib/libssl/src/crypto/engine/hw_cswift.c index da732abce0a..f5c897bdbba 100644 --- a/lib/libssl/src/crypto/engine/hw_cswift.c +++ b/lib/libssl/src/crypto/engine/hw_cswift.c @@ -280,8 +280,24 @@ t_swSimpleRequest *p_CSwift_SimpleRequest = NULL; t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL; /* Used in the DSO operations. */ -static const char def_CSWIFT_LIBNAME[] = "swift"; -static const char *CSWIFT_LIBNAME = def_CSWIFT_LIBNAME; +static const char *CSWIFT_LIBNAME = NULL; +static const char *get_CSWIFT_LIBNAME(void) + { + if(CSWIFT_LIBNAME) + return CSWIFT_LIBNAME; + return "swift"; + } +static void free_CSWIFT_LIBNAME(void) + { + if(CSWIFT_LIBNAME) + OPENSSL_free((void*)CSWIFT_LIBNAME); + CSWIFT_LIBNAME = NULL; + } +static long set_CSWIFT_LIBNAME(const char *name) + { + free_CSWIFT_LIBNAME(); + return (((CSWIFT_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); + } static const char *CSWIFT_F1 = "swAcquireAccContext"; static const char *CSWIFT_F2 = "swAttachKeyParam"; static const char *CSWIFT_F3 = "swSimpleRequest"; @@ -313,6 +329,7 @@ static void release_context(SW_CONTEXT_HANDLE hac) /* Destructor (complements the "ENGINE_cswift()" constructor) */ static int cswift_destroy(ENGINE *e) { + free_CSWIFT_LIBNAME(); ERR_unload_CSWIFT_strings(); return 1; } @@ -332,7 +349,7 @@ static int cswift_init(ENGINE *e) goto err; } /* Attempt to load libswift.so/swift.dll/whatever. */ - cswift_dso = DSO_load(NULL, CSWIFT_LIBNAME, NULL, 0); + cswift_dso = DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0); if(cswift_dso == NULL) { CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED); @@ -377,6 +394,7 @@ err: static int cswift_finish(ENGINE *e) { + free_CSWIFT_LIBNAME(); if(cswift_dso == NULL) { 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)()) CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_ALREADY_LOADED); return 0; } - CSWIFT_LIBNAME = (const char *)p; - return 1; + return set_CSWIFT_LIBNAME((const char *)p); default: break; } |