summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/hw_atalla.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_atalla.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_atalla.c')
-rw-r--r--src/lib/libcrypto/engine/hw_atalla.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/lib/libcrypto/engine/hw_atalla.c b/src/lib/libcrypto/engine/hw_atalla.c
index 696cfcf156..6151c46902 100644
--- a/src/lib/libcrypto/engine/hw_atalla.c
+++ b/src/lib/libcrypto/engine/hw_atalla.c
@@ -286,8 +286,24 @@ static tfnASI_GetPerformanceStatistics *p_Atalla_GetPerformanceStatistics = NULL
286 * atasi.dll on win32). For the purposes of testing, I have created a symbollic 286 * atasi.dll on win32). For the purposes of testing, I have created a symbollic
287 * link called "libatasi.so" so that we can use native name-translation - a 287 * link called "libatasi.so" so that we can use native name-translation - a
288 * better solution will be needed. */ 288 * better solution will be needed. */
289static const char def_ATALLA_LIBNAME[] = "atasi"; 289static const char *ATALLA_LIBNAME = NULL;
290static const char *ATALLA_LIBNAME = def_ATALLA_LIBNAME; 290static const char *get_ATALLA_LIBNAME(void)
291 {
292 if(ATALLA_LIBNAME)
293 return ATALLA_LIBNAME;
294 return "atasi";
295 }
296static void free_ATALLA_LIBNAME(void)
297 {
298 if(ATALLA_LIBNAME)
299 OPENSSL_free((void*)ATALLA_LIBNAME);
300 ATALLA_LIBNAME = NULL;
301 }
302static long set_ATALLA_LIBNAME(const char *name)
303 {
304 free_ATALLA_LIBNAME();
305 return (((ATALLA_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
306 }
291static const char *ATALLA_F1 = "ASI_GetHardwareConfig"; 307static const char *ATALLA_F1 = "ASI_GetHardwareConfig";
292static const char *ATALLA_F2 = "ASI_RSAPrivateKeyOpFn"; 308static const char *ATALLA_F2 = "ASI_RSAPrivateKeyOpFn";
293static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics"; 309static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics";
@@ -295,6 +311,7 @@ static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics";
295/* Destructor (complements the "ENGINE_atalla()" constructor) */ 311/* Destructor (complements the "ENGINE_atalla()" constructor) */
296static int atalla_destroy(ENGINE *e) 312static int atalla_destroy(ENGINE *e)
297 { 313 {
314 free_ATALLA_LIBNAME();
298 /* Unload the atalla error strings so any error state including our 315 /* Unload the atalla error strings so any error state including our
299 * functs or reasons won't lead to a segfault (they simply get displayed 316 * functs or reasons won't lead to a segfault (they simply get displayed
300 * without corresponding string data because none will be found). */ 317 * without corresponding string data because none will be found). */
@@ -324,7 +341,7 @@ static int atalla_init(ENGINE *e)
324 * drivers really use - for now a symbollic link needs to be 341 * drivers really use - for now a symbollic link needs to be
325 * created on the host system from libatasi.so to atasi.so on 342 * created on the host system from libatasi.so to atasi.so on
326 * unix variants. */ 343 * unix variants. */
327 atalla_dso = DSO_load(NULL, ATALLA_LIBNAME, NULL, 0); 344 atalla_dso = DSO_load(NULL, get_ATALLA_LIBNAME(), NULL, 0);
328 if(atalla_dso == NULL) 345 if(atalla_dso == NULL)
329 { 346 {
330 ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_NOT_LOADED); 347 ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_NOT_LOADED);
@@ -364,6 +381,7 @@ err:
364 381
365static int atalla_finish(ENGINE *e) 382static int atalla_finish(ENGINE *e)
366 { 383 {
384 free_ATALLA_LIBNAME();
367 if(atalla_dso == NULL) 385 if(atalla_dso == NULL)
368 { 386 {
369 ATALLAerr(ATALLA_F_ATALLA_FINISH,ATALLA_R_NOT_LOADED); 387 ATALLAerr(ATALLA_F_ATALLA_FINISH,ATALLA_R_NOT_LOADED);
@@ -397,8 +415,7 @@ static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
397 ATALLAerr(ATALLA_F_ATALLA_CTRL,ATALLA_R_ALREADY_LOADED); 415 ATALLAerr(ATALLA_F_ATALLA_CTRL,ATALLA_R_ALREADY_LOADED);
398 return 0; 416 return 0;
399 } 417 }
400 ATALLA_LIBNAME = (const char *)p; 418 return set_ATALLA_LIBNAME((const char *)p);
401 return 1;
402 default: 419 default:
403 break; 420 break;
404 } 421 }