diff options
| author | markus <> | 2003-05-12 02:18:40 +0000 |
|---|---|---|
| committer | markus <> | 2003-05-12 02:18:40 +0000 |
| commit | d4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch) | |
| tree | d52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/engine | |
| parent | 582bbd139cd2afd58d10dc051c5b0b989b441074 (diff) | |
| download | openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2 openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip | |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/engine')
23 files changed, 281 insertions, 111 deletions
diff --git a/src/lib/libcrypto/engine/Makefile.ssl b/src/lib/libcrypto/engine/Makefile.ssl index 8bc8985e02..30a4446ff9 100644 --- a/src/lib/libcrypto/engine/Makefile.ssl +++ b/src/lib/libcrypto/engine/Makefile.ssl | |||
| @@ -50,7 +50,7 @@ all: lib | |||
| 50 | 50 | ||
| 51 | lib: $(LIBOBJ) | 51 | lib: $(LIBOBJ) |
| 52 | $(AR) $(LIB) $(LIBOBJ) | 52 | $(AR) $(LIB) $(LIBOBJ) |
| 53 | $(RANLIB) $(LIB) | 53 | $(RANLIB) $(LIB) || echo Never mind. |
| 54 | @touch lib | 54 | @touch lib |
| 55 | 55 | ||
| 56 | files: | 56 | files: |
| @@ -82,7 +82,7 @@ lint: | |||
| 82 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 82 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
| 83 | 83 | ||
| 84 | depend: | 84 | depend: |
| 85 | $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) | 85 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
| 86 | 86 | ||
| 87 | dclean: | 87 | dclean: |
| 88 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | 88 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new |
| @@ -304,6 +304,27 @@ hw_atalla.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | |||
| 304 | hw_atalla.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 304 | hw_atalla.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 305 | hw_atalla.o: ../cryptlib.h hw_atalla.c hw_atalla_err.c hw_atalla_err.h | 305 | hw_atalla.o: ../cryptlib.h hw_atalla.c hw_atalla_err.c hw_atalla_err.h |
| 306 | hw_atalla.o: vendor_defns/atalla.h | 306 | hw_atalla.o: vendor_defns/atalla.h |
| 307 | hw_cryptodev.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 308 | hw_cryptodev.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 309 | hw_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 310 | hw_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 311 | hw_cryptodev.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 312 | hw_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 313 | hw_cryptodev.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 314 | hw_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 315 | hw_cryptodev.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 316 | hw_cryptodev.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 317 | hw_cryptodev.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 318 | hw_cryptodev.o: ../../include/openssl/objects.h | ||
| 319 | hw_cryptodev.o: ../../include/openssl/opensslconf.h | ||
| 320 | hw_cryptodev.o: ../../include/openssl/opensslv.h | ||
| 321 | hw_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 322 | hw_cryptodev.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 323 | hw_cryptodev.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 324 | hw_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 325 | hw_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 326 | hw_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 327 | hw_cryptodev.o: ../../include/openssl/ui_compat.h hw_cryptodev.c | ||
| 307 | hw_cswift.o: ../../e_os.h ../../include/openssl/asn1.h | 328 | hw_cswift.o: ../../e_os.h ../../include/openssl/asn1.h |
| 308 | hw_cswift.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 329 | hw_cswift.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 309 | hw_cswift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 330 | hw_cswift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| @@ -354,45 +375,6 @@ hw_nuron.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | |||
| 354 | hw_nuron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 375 | hw_nuron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 355 | hw_nuron.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 376 | hw_nuron.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 356 | hw_nuron.o: ../cryptlib.h hw_nuron.c hw_nuron_err.c hw_nuron_err.h | 377 | hw_nuron.o: ../cryptlib.h hw_nuron.c hw_nuron_err.c hw_nuron_err.h |
| 357 | hw_cryptodev.o: ../../include/openssl/aes.h | ||
| 358 | hw_cryptodev.o: ../../include/openssl/asn1.h | ||
| 359 | hw_cryptodev.o: ../../include/openssl/bio.h | ||
| 360 | hw_cryptodev.o: ../../include/openssl/blowfish.h | ||
| 361 | hw_cryptodev.o: ../../include/openssl/bn.h | ||
| 362 | hw_cryptodev.o: ../../include/openssl/cast.h | ||
| 363 | hw_cryptodev.o: ../../include/openssl/conf.h | ||
| 364 | hw_cryptodev.o: ../../include/openssl/crypto.h | ||
| 365 | hw_cryptodev.o: ../../include/openssl/des.h | ||
| 366 | hw_cryptodev.o: ../../include/openssl/des_old.h | ||
| 367 | hw_cryptodev.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 368 | hw_cryptodev.o: ../../include/openssl/e_os2.h | ||
| 369 | hw_cryptodev.o: ../../include/openssl/engine.h | ||
| 370 | hw_cryptodev.o: ../../include/openssl/err.h | ||
| 371 | hw_cryptodev.o: ../../include/openssl/evp.h | ||
| 372 | hw_cryptodev.o: ../../include/openssl/idea.h | ||
| 373 | hw_cryptodev.o: ../../include/openssl/lhash.h | ||
| 374 | hw_cryptodev.o: ../../include/openssl/md2.h | ||
| 375 | hw_cryptodev.o: ../../include/openssl/md4.h | ||
| 376 | hw_cryptodev.o: ../../include/openssl/md5.h | ||
| 377 | hw_cryptodev.o: ../../include/openssl/mdc2.h | ||
| 378 | hw_cryptodev.o: ../../include/openssl/obj_mac.h | ||
| 379 | hw_cryptodev.o: ../../include/openssl/objects.h | ||
| 380 | hw_cryptodev.o: ../../include/openssl/opensslconf.h | ||
| 381 | hw_cryptodev.o: ../../include/openssl/opensslv.h | ||
| 382 | hw_cryptodev.o: ../../include/openssl/ossl_typ.h | ||
| 383 | hw_cryptodev.o: ../../include/openssl/rand.h | ||
| 384 | hw_cryptodev.o: ../../include/openssl/rc2.h | ||
| 385 | hw_cryptodev.o: ../../include/openssl/rc4.h | ||
| 386 | hw_cryptodev.o: ../../include/openssl/rc5.h | ||
| 387 | hw_cryptodev.o: ../../include/openssl/ripemd.h | ||
| 388 | hw_cryptodev.o: ../../include/openssl/rsa.h | ||
| 389 | hw_cryptodev.o: ../../include/openssl/safestack.h | ||
| 390 | hw_cryptodev.o: ../../include/openssl/sha.h | ||
| 391 | hw_cryptodev.o: ../../include/openssl/stack.h | ||
| 392 | hw_cryptodev.o: ../../include/openssl/symhacks.h | ||
| 393 | hw_cryptodev.o: ../../include/openssl/ui.h | ||
| 394 | hw_cryptodev.o: ../../include/openssl/ui_compat.h ../evp/evp_locl.h | ||
| 395 | hw_cryptodev.o: eng_int.h hw_cryptodev.c | ||
| 396 | hw_sureware.o: ../../e_os.h ../../include/openssl/aes.h | 378 | hw_sureware.o: ../../e_os.h ../../include/openssl/aes.h |
| 397 | hw_sureware.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 379 | hw_sureware.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 398 | hw_sureware.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | 380 | hw_sureware.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h |
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c index bc50465422..0f6992a40d 100644 --- a/src/lib/libcrypto/engine/eng_all.c +++ b/src/lib/libcrypto/engine/eng_all.c | |||
| @@ -60,10 +60,6 @@ | |||
| 60 | #include <openssl/engine.h> | 60 | #include <openssl/engine.h> |
| 61 | #include "eng_int.h" | 61 | #include "eng_int.h" |
| 62 | 62 | ||
| 63 | #ifdef __OpenBSD__ | ||
| 64 | static int openbsd_default_loaded = 0; | ||
| 65 | #endif | ||
| 66 | |||
| 67 | void ENGINE_load_builtin_engines(void) | 63 | void ENGINE_load_builtin_engines(void) |
| 68 | { | 64 | { |
| 69 | /* There's no longer any need for an "openssl" ENGINE unless, one day, | 65 | /* There's no longer any need for an "openssl" ENGINE unless, one day, |
| @@ -99,21 +95,19 @@ void ENGINE_load_builtin_engines(void) | |||
| 99 | #ifndef OPENSSL_NO_HW_4758_CCA | 95 | #ifndef OPENSSL_NO_HW_4758_CCA |
| 100 | ENGINE_load_4758cca(); | 96 | ENGINE_load_4758cca(); |
| 101 | #endif | 97 | #endif |
| 102 | #ifdef OPENSSL_OPENBSD_DEV_CRYPTO | 98 | #if defined(__OpenBSD__) || defined(__FreeBSD__) |
| 103 | ENGINE_load_openbsd_dev_crypto(); | ||
| 104 | #endif | ||
| 105 | #ifdef __OpenBSD__ | ||
| 106 | ENGINE_load_cryptodev(); | 99 | ENGINE_load_cryptodev(); |
| 107 | #endif | 100 | #endif |
| 108 | #endif | 101 | #endif |
| 109 | } | 102 | } |
| 110 | 103 | ||
| 111 | #ifdef __OpenBSD__ | 104 | #if defined(__OpenBSD__) || defined(__FreeBSD__) |
| 112 | void ENGINE_setup_openbsd(void) { | 105 | void ENGINE_setup_bsd_cryptodev(void) { |
| 113 | if (!openbsd_default_loaded) { | 106 | static int bsd_cryptodev_default_loaded = 0; |
| 107 | if (!bsd_cryptodev_default_loaded) { | ||
| 114 | ENGINE_load_cryptodev(); | 108 | ENGINE_load_cryptodev(); |
| 115 | ENGINE_register_all_complete(); | 109 | ENGINE_register_all_complete(); |
| 116 | } | 110 | } |
| 117 | openbsd_default_loaded=1; | 111 | bsd_cryptodev_default_loaded=1; |
| 118 | } | 112 | } |
| 119 | #endif | 113 | #endif |
diff --git a/src/lib/libcrypto/engine/eng_err.c b/src/lib/libcrypto/engine/eng_err.c index f6c5630395..814d95ee32 100644 --- a/src/lib/libcrypto/engine/eng_err.c +++ b/src/lib/libcrypto/engine/eng_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/engine/eng_err.c */ | 1 | /* crypto/engine/eng_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -96,6 +96,7 @@ static ERR_STRING_DATA ENGINE_str_functs[]= | |||
| 96 | {ERR_PACK(0,ENGINE_F_ENGINE_SET_NAME,0), "ENGINE_set_name"}, | 96 | {ERR_PACK(0,ENGINE_F_ENGINE_SET_NAME,0), "ENGINE_set_name"}, |
| 97 | {ERR_PACK(0,ENGINE_F_ENGINE_TABLE_REGISTER,0), "ENGINE_TABLE_REGISTER"}, | 97 | {ERR_PACK(0,ENGINE_F_ENGINE_TABLE_REGISTER,0), "ENGINE_TABLE_REGISTER"}, |
| 98 | {ERR_PACK(0,ENGINE_F_ENGINE_UNLOAD_KEY,0), "ENGINE_UNLOAD_KEY"}, | 98 | {ERR_PACK(0,ENGINE_F_ENGINE_UNLOAD_KEY,0), "ENGINE_UNLOAD_KEY"}, |
| 99 | {ERR_PACK(0,ENGINE_F_ENGINE_UP_REF,0), "ENGINE_up_ref"}, | ||
| 99 | {ERR_PACK(0,ENGINE_F_INT_CTRL_HELPER,0), "INT_CTRL_HELPER"}, | 100 | {ERR_PACK(0,ENGINE_F_INT_CTRL_HELPER,0), "INT_CTRL_HELPER"}, |
| 100 | {ERR_PACK(0,ENGINE_F_INT_ENGINE_CONFIGURE,0), "INT_ENGINE_CONFIGURE"}, | 101 | {ERR_PACK(0,ENGINE_F_INT_ENGINE_CONFIGURE,0), "INT_ENGINE_CONFIGURE"}, |
| 101 | {ERR_PACK(0,ENGINE_F_LOG_MESSAGE,0), "LOG_MESSAGE"}, | 102 | {ERR_PACK(0,ENGINE_F_LOG_MESSAGE,0), "LOG_MESSAGE"}, |
diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c index f7edb5ad32..0d7dae00b2 100644 --- a/src/lib/libcrypto/engine/eng_fat.c +++ b/src/lib/libcrypto/engine/eng_fat.c | |||
| @@ -66,18 +66,18 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags) | |||
| 66 | if((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e)) | 66 | if((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e)) |
| 67 | return 0; | 67 | return 0; |
| 68 | #ifndef OPENSSL_NO_RSA | 68 | #ifndef OPENSSL_NO_RSA |
| 69 | if((flags & ENGINE_METHOD_RSA) & !ENGINE_set_default_RSA(e)) | 69 | if((flags & ENGINE_METHOD_RSA) && !ENGINE_set_default_RSA(e)) |
| 70 | return 0; | 70 | return 0; |
| 71 | #endif | 71 | #endif |
| 72 | #ifndef OPENSSL_NO_DSA | 72 | #ifndef OPENSSL_NO_DSA |
| 73 | if((flags & ENGINE_METHOD_DSA) & !ENGINE_set_default_DSA(e)) | 73 | if((flags & ENGINE_METHOD_DSA) && !ENGINE_set_default_DSA(e)) |
| 74 | return 0; | 74 | return 0; |
| 75 | #endif | 75 | #endif |
| 76 | #ifndef OPENSSL_NO_DH | 76 | #ifndef OPENSSL_NO_DH |
| 77 | if((flags & ENGINE_METHOD_DH) & !ENGINE_set_default_DH(e)) | 77 | if((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e)) |
| 78 | return 0; | 78 | return 0; |
| 79 | #endif | 79 | #endif |
| 80 | if((flags & ENGINE_METHOD_RAND) & !ENGINE_set_default_RAND(e)) | 80 | if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) |
| 81 | return 0; | 81 | return 0; |
| 82 | return 1; | 82 | return 1; |
| 83 | } | 83 | } |
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c index 0c220558e7..1cc3217f4c 100644 --- a/src/lib/libcrypto/engine/eng_list.c +++ b/src/lib/libcrypto/engine/eng_list.c | |||
| @@ -191,14 +191,14 @@ ENGINE *ENGINE_get_first(void) | |||
| 191 | { | 191 | { |
| 192 | ENGINE *ret; | 192 | ENGINE *ret; |
| 193 | 193 | ||
| 194 | CRYPTO_r_lock(CRYPTO_LOCK_ENGINE); | 194 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 195 | ret = engine_list_head; | 195 | ret = engine_list_head; |
| 196 | if(ret) | 196 | if(ret) |
| 197 | { | 197 | { |
| 198 | ret->struct_ref++; | 198 | ret->struct_ref++; |
| 199 | engine_ref_debug(ret, 0, 1) | 199 | engine_ref_debug(ret, 0, 1) |
| 200 | } | 200 | } |
| 201 | CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE); | 201 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 202 | return ret; | 202 | return ret; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| @@ -206,14 +206,14 @@ ENGINE *ENGINE_get_last(void) | |||
| 206 | { | 206 | { |
| 207 | ENGINE *ret; | 207 | ENGINE *ret; |
| 208 | 208 | ||
| 209 | CRYPTO_r_lock(CRYPTO_LOCK_ENGINE); | 209 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 210 | ret = engine_list_tail; | 210 | ret = engine_list_tail; |
| 211 | if(ret) | 211 | if(ret) |
| 212 | { | 212 | { |
| 213 | ret->struct_ref++; | 213 | ret->struct_ref++; |
| 214 | engine_ref_debug(ret, 0, 1) | 214 | engine_ref_debug(ret, 0, 1) |
| 215 | } | 215 | } |
| 216 | CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE); | 216 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 217 | return ret; | 217 | return ret; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| @@ -227,7 +227,7 @@ ENGINE *ENGINE_get_next(ENGINE *e) | |||
| 227 | ERR_R_PASSED_NULL_PARAMETER); | 227 | ERR_R_PASSED_NULL_PARAMETER); |
| 228 | return 0; | 228 | return 0; |
| 229 | } | 229 | } |
| 230 | CRYPTO_r_lock(CRYPTO_LOCK_ENGINE); | 230 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 231 | ret = e->next; | 231 | ret = e->next; |
| 232 | if(ret) | 232 | if(ret) |
| 233 | { | 233 | { |
| @@ -235,7 +235,7 @@ ENGINE *ENGINE_get_next(ENGINE *e) | |||
| 235 | ret->struct_ref++; | 235 | ret->struct_ref++; |
| 236 | engine_ref_debug(ret, 0, 1) | 236 | engine_ref_debug(ret, 0, 1) |
| 237 | } | 237 | } |
| 238 | CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE); | 238 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 239 | /* Release the structural reference to the previous ENGINE */ | 239 | /* Release the structural reference to the previous ENGINE */ |
| 240 | ENGINE_free(e); | 240 | ENGINE_free(e); |
| 241 | return ret; | 241 | return ret; |
| @@ -250,7 +250,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e) | |||
| 250 | ERR_R_PASSED_NULL_PARAMETER); | 250 | ERR_R_PASSED_NULL_PARAMETER); |
| 251 | return 0; | 251 | return 0; |
| 252 | } | 252 | } |
| 253 | CRYPTO_r_lock(CRYPTO_LOCK_ENGINE); | 253 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 254 | ret = e->prev; | 254 | ret = e->prev; |
| 255 | if(ret) | 255 | if(ret) |
| 256 | { | 256 | { |
| @@ -258,7 +258,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e) | |||
| 258 | ret->struct_ref++; | 258 | ret->struct_ref++; |
| 259 | engine_ref_debug(ret, 0, 1) | 259 | engine_ref_debug(ret, 0, 1) |
| 260 | } | 260 | } |
| 261 | CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE); | 261 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 262 | /* Release the structural reference to the previous ENGINE */ | 262 | /* Release the structural reference to the previous ENGINE */ |
| 263 | ENGINE_free(e); | 263 | ENGINE_free(e); |
| 264 | return ret; | 264 | return ret; |
| @@ -346,7 +346,7 @@ ENGINE *ENGINE_by_id(const char *id) | |||
| 346 | ERR_R_PASSED_NULL_PARAMETER); | 346 | ERR_R_PASSED_NULL_PARAMETER); |
| 347 | return NULL; | 347 | return NULL; |
| 348 | } | 348 | } |
| 349 | CRYPTO_r_lock(CRYPTO_LOCK_ENGINE); | 349 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 350 | iterator = engine_list_head; | 350 | iterator = engine_list_head; |
| 351 | while(iterator && (strcmp(id, iterator->id) != 0)) | 351 | while(iterator && (strcmp(id, iterator->id) != 0)) |
| 352 | iterator = iterator->next; | 352 | iterator = iterator->next; |
| @@ -372,7 +372,7 @@ ENGINE *ENGINE_by_id(const char *id) | |||
| 372 | engine_ref_debug(iterator, 0, 1) | 372 | engine_ref_debug(iterator, 0, 1) |
| 373 | } | 373 | } |
| 374 | } | 374 | } |
| 375 | CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE); | 375 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 376 | if(iterator == NULL) | 376 | if(iterator == NULL) |
| 377 | { | 377 | { |
| 378 | ENGINEerr(ENGINE_F_ENGINE_BY_ID, | 378 | ENGINEerr(ENGINE_F_ENGINE_BY_ID, |
| @@ -381,3 +381,14 @@ ENGINE *ENGINE_by_id(const char *id) | |||
| 381 | } | 381 | } |
| 382 | return iterator; | 382 | return iterator; |
| 383 | } | 383 | } |
| 384 | |||
| 385 | int ENGINE_up_ref(ENGINE *e) | ||
| 386 | { | ||
| 387 | if (e == NULL) | ||
| 388 | { | ||
| 389 | ENGINEerr(ENGINE_F_ENGINE_UP_REF,ERR_R_PASSED_NULL_PARAMETER); | ||
| 390 | return 0; | ||
| 391 | } | ||
| 392 | CRYPTO_add(&e->struct_ref,1,CRYPTO_LOCK_ENGINE); | ||
| 393 | return 1; | ||
| 394 | } | ||
diff --git a/src/lib/libcrypto/engine/eng_openssl.c b/src/lib/libcrypto/engine/eng_openssl.c index e9d976f46b..54579eea2e 100644 --- a/src/lib/libcrypto/engine/eng_openssl.c +++ b/src/lib/libcrypto/engine/eng_openssl.c | |||
| @@ -63,6 +63,7 @@ | |||
| 63 | #include <openssl/engine.h> | 63 | #include <openssl/engine.h> |
| 64 | #include <openssl/dso.h> | 64 | #include <openssl/dso.h> |
| 65 | #include <openssl/pem.h> | 65 | #include <openssl/pem.h> |
| 66 | #include <openssl/evp.h> | ||
| 66 | 67 | ||
| 67 | /* This testing gunk is implemented (and explained) lower down. It also assumes | 68 | /* This testing gunk is implemented (and explained) lower down. It also assumes |
| 68 | * the application explicitly calls "ENGINE_load_openssl()" because this is no | 69 | * the application explicitly calls "ENGINE_load_openssl()" because this is no |
| @@ -78,6 +79,21 @@ | |||
| 78 | /* #define TEST_ENG_OPENSSL_SHA_P_UPDATE */ | 79 | /* #define TEST_ENG_OPENSSL_SHA_P_UPDATE */ |
| 79 | /* #define TEST_ENG_OPENSSL_SHA_P_FINAL */ | 80 | /* #define TEST_ENG_OPENSSL_SHA_P_FINAL */ |
| 80 | 81 | ||
| 82 | /* Now check what of those algorithms are actually enabled */ | ||
| 83 | #ifdef OPENSSL_NO_RC4 | ||
| 84 | #undef TEST_ENG_OPENSSL_RC4 | ||
| 85 | #undef TEST_ENG_OPENSSL_RC4_OTHERS | ||
| 86 | #undef TEST_ENG_OPENSSL_RC4_P_INIT | ||
| 87 | #undef TEST_ENG_OPENSSL_RC4_P_CIPHER | ||
| 88 | #endif | ||
| 89 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0) || defined(OPENSSL_NO_SHA1) | ||
| 90 | #undef TEST_ENG_OPENSSL_SHA | ||
| 91 | #undef TEST_ENG_OPENSSL_SHA_OTHERS | ||
| 92 | #undef TEST_ENG_OPENSSL_SHA_P_INIT | ||
| 93 | #undef TEST_ENG_OPENSSL_SHA_P_UPDATE | ||
| 94 | #undef TEST_ENG_OPENSSL_SHA_P_FINAL | ||
| 95 | #endif | ||
| 96 | |||
| 81 | #ifdef TEST_ENG_OPENSSL_RC4 | 97 | #ifdef TEST_ENG_OPENSSL_RC4 |
| 82 | static int openssl_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | 98 | static int openssl_ciphers(ENGINE *e, const EVP_CIPHER **cipher, |
| 83 | const int **nids, int nid); | 99 | const int **nids, int nid); |
| @@ -180,7 +196,6 @@ IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | |||
| 180 | * the "init_key" handler is called. | 196 | * the "init_key" handler is called. |
| 181 | * TEST_ENG_OPENSSL_RC4_P_CIPHER - ditto for the "cipher" handler. | 197 | * TEST_ENG_OPENSSL_RC4_P_CIPHER - ditto for the "cipher" handler. |
| 182 | */ | 198 | */ |
| 183 | #include <openssl/evp.h> | ||
| 184 | #include <openssl/rc4.h> | 199 | #include <openssl/rc4.h> |
| 185 | #define TEST_RC4_KEY_SIZE 16 | 200 | #define TEST_RC4_KEY_SIZE 16 |
| 186 | static int test_cipher_nids[] = {NID_rc4,NID_rc4_40}; | 201 | static int test_cipher_nids[] = {NID_rc4,NID_rc4_40}; |
| @@ -265,7 +280,6 @@ static int openssl_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 265 | 280 | ||
| 266 | #ifdef TEST_ENG_OPENSSL_SHA | 281 | #ifdef TEST_ENG_OPENSSL_SHA |
| 267 | /* Much the same sort of comment as for TEST_ENG_OPENSSL_RC4 */ | 282 | /* Much the same sort of comment as for TEST_ENG_OPENSSL_RC4 */ |
| 268 | #include <openssl/evp.h> | ||
| 269 | #include <openssl/sha.h> | 283 | #include <openssl/sha.h> |
| 270 | static int test_digest_nids[] = {NID_sha1}; | 284 | static int test_digest_nids[] = {NID_sha1}; |
| 271 | static int test_digest_nids_number = 1; | 285 | static int test_digest_nids_number = 1; |
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h index fd17ff616d..8686879e1a 100644 --- a/src/lib/libcrypto/engine/engine.h +++ b/src/lib/libcrypto/engine/engine.h | |||
| @@ -59,6 +59,12 @@ | |||
| 59 | #ifndef HEADER_ENGINE_H | 59 | #ifndef HEADER_ENGINE_H |
| 60 | #define HEADER_ENGINE_H | 60 | #define HEADER_ENGINE_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> | ||
| 63 | |||
| 64 | #ifdef OPENSSL_NO_ENGINE | ||
| 65 | #error ENGINE is disabled. | ||
| 66 | #endif | ||
| 67 | |||
| 62 | #include <openssl/ossl_typ.h> | 68 | #include <openssl/ossl_typ.h> |
| 63 | #include <openssl/bn.h> | 69 | #include <openssl/bn.h> |
| 64 | #ifndef OPENSSL_NO_RSA | 70 | #ifndef OPENSSL_NO_RSA |
| @@ -307,11 +313,8 @@ void ENGINE_load_ubsec(void); | |||
| 307 | void ENGINE_load_aep(void); | 313 | void ENGINE_load_aep(void); |
| 308 | void ENGINE_load_sureware(void); | 314 | void ENGINE_load_sureware(void); |
| 309 | void ENGINE_load_4758cca(void); | 315 | void ENGINE_load_4758cca(void); |
| 310 | void ENGINE_load_openbsd_dev_crypto(void); | ||
| 311 | void ENGINE_load_builtin_engines(void); | ||
| 312 | #ifdef __OpenBSD__ | ||
| 313 | void ENGINE_load_cryptodev(void); | 316 | void ENGINE_load_cryptodev(void); |
| 314 | #endif | 317 | void ENGINE_load_builtin_engines(void); |
| 315 | 318 | ||
| 316 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation | 319 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation |
| 317 | * "registry" handling. */ | 320 | * "registry" handling. */ |
| @@ -409,6 +412,7 @@ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, | |||
| 409 | * compatibility! */ | 412 | * compatibility! */ |
| 410 | ENGINE *ENGINE_new(void); | 413 | ENGINE *ENGINE_new(void); |
| 411 | int ENGINE_free(ENGINE *e); | 414 | int ENGINE_free(ENGINE *e); |
| 415 | int ENGINE_up_ref(ENGINE *e); | ||
| 412 | int ENGINE_set_id(ENGINE *e, const char *id); | 416 | int ENGINE_set_id(ENGINE *e, const char *id); |
| 413 | int ENGINE_set_name(ENGINE *e, const char *name); | 417 | int ENGINE_set_name(ENGINE *e, const char *name); |
| 414 | int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); | 418 | int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); |
| @@ -665,6 +669,7 @@ void ERR_load_ENGINE_strings(void); | |||
| 665 | #define ENGINE_F_ENGINE_SET_NAME 130 | 669 | #define ENGINE_F_ENGINE_SET_NAME 130 |
| 666 | #define ENGINE_F_ENGINE_TABLE_REGISTER 184 | 670 | #define ENGINE_F_ENGINE_TABLE_REGISTER 184 |
| 667 | #define ENGINE_F_ENGINE_UNLOAD_KEY 152 | 671 | #define ENGINE_F_ENGINE_UNLOAD_KEY 152 |
| 672 | #define ENGINE_F_ENGINE_UP_REF 190 | ||
| 668 | #define ENGINE_F_INT_CTRL_HELPER 172 | 673 | #define ENGINE_F_INT_CTRL_HELPER 172 |
| 669 | #define ENGINE_F_INT_ENGINE_CONFIGURE 188 | 674 | #define ENGINE_F_INT_ENGINE_CONFIGURE 188 |
| 670 | #define ENGINE_F_LOG_MESSAGE 141 | 675 | #define ENGINE_F_LOG_MESSAGE 141 |
diff --git a/src/lib/libcrypto/engine/enginetest.c b/src/lib/libcrypto/engine/enginetest.c index 87fa8c57b7..c2d0297392 100644 --- a/src/lib/libcrypto/engine/enginetest.c +++ b/src/lib/libcrypto/engine/enginetest.c | |||
| @@ -56,9 +56,17 @@ | |||
| 56 | * | 56 | * |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/e_os2.h> | ||
| 60 | #include <stdio.h> | 59 | #include <stdio.h> |
| 61 | #include <string.h> | 60 | #include <string.h> |
| 61 | |||
| 62 | #ifdef OPENSSL_NO_ENGINE | ||
| 63 | int main(int argc, char *argv[]) | ||
| 64 | { | ||
| 65 | printf("No ENGINE support\n"); | ||
| 66 | return(0); | ||
| 67 | } | ||
| 68 | #else | ||
| 69 | #include <openssl/e_os2.h> | ||
| 62 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
| 63 | #include <openssl/crypto.h> | 71 | #include <openssl/crypto.h> |
| 64 | #include <openssl/engine.h> | 72 | #include <openssl/engine.h> |
| @@ -272,3 +280,4 @@ end: | |||
| 272 | CRYPTO_mem_leaks_fp(stderr); | 280 | CRYPTO_mem_leaks_fp(stderr); |
| 273 | return to_return; | 281 | return to_return; |
| 274 | } | 282 | } |
| 283 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_4758_cca.c b/src/lib/libcrypto/engine/hw_4758_cca.c index 6d41b9ed2a..4f5ae8a46d 100644 --- a/src/lib/libcrypto/engine/hw_4758_cca.c +++ b/src/lib/libcrypto/engine/hw_4758_cca.c | |||
| @@ -223,6 +223,7 @@ static int bind_helper(ENGINE *e) | |||
| 223 | return 1; | 223 | return 1; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 226 | static ENGINE *engine_4758_cca(void) | 227 | static ENGINE *engine_4758_cca(void) |
| 227 | { | 228 | { |
| 228 | ENGINE *ret = ENGINE_new(); | 229 | ENGINE *ret = ENGINE_new(); |
| @@ -244,6 +245,7 @@ void ENGINE_load_4758cca(void) | |||
| 244 | ENGINE_free(e_4758); | 245 | ENGINE_free(e_4758); |
| 245 | ERR_clear_error(); | 246 | ERR_clear_error(); |
| 246 | } | 247 | } |
| 248 | #endif | ||
| 247 | 249 | ||
| 248 | static int ibm_4758_cca_destroy(ENGINE *e) | 250 | static int ibm_4758_cca_destroy(ENGINE *e) |
| 249 | { | 251 | { |
| @@ -715,7 +717,7 @@ static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len, | |||
| 715 | 717 | ||
| 716 | if (type == NID_sha1 || type == NID_md5) | 718 | if (type == NID_sha1 || type == NID_md5) |
| 717 | { | 719 | { |
| 718 | memset(hashBuffer, 0, keyLength+1); | 720 | OPENSSL_cleanse(hashBuffer, keyLength+1); |
| 719 | OPENSSL_free(hashBuffer); | 721 | OPENSSL_free(hashBuffer); |
| 720 | } | 722 | } |
| 721 | 723 | ||
| @@ -838,7 +840,7 @@ static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, | |||
| 838 | 840 | ||
| 839 | if (type == NID_sha1 || type == NID_md5) | 841 | if (type == NID_sha1 || type == NID_md5) |
| 840 | { | 842 | { |
| 841 | memset(hashBuffer, 0, keyLength+1); | 843 | OPENSSL_cleanse(hashBuffer, keyLength+1); |
| 842 | OPENSSL_free(hashBuffer); | 844 | OPENSSL_free(hashBuffer); |
| 843 | } | 845 | } |
| 844 | 846 | ||
diff --git a/src/lib/libcrypto/engine/hw_atalla.c b/src/lib/libcrypto/engine/hw_atalla.c index 6151c46902..e9eff9fad1 100644 --- a/src/lib/libcrypto/engine/hw_atalla.c +++ b/src/lib/libcrypto/engine/hw_atalla.c | |||
| @@ -242,6 +242,7 @@ static int bind_helper(ENGINE *e) | |||
| 242 | return 1; | 242 | return 1; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 245 | static ENGINE *engine_atalla(void) | 246 | static ENGINE *engine_atalla(void) |
| 246 | { | 247 | { |
| 247 | ENGINE *ret = ENGINE_new(); | 248 | ENGINE *ret = ENGINE_new(); |
| @@ -264,6 +265,7 @@ void ENGINE_load_atalla(void) | |||
| 264 | ENGINE_free(toadd); | 265 | ENGINE_free(toadd); |
| 265 | ERR_clear_error(); | 266 | ERR_clear_error(); |
| 266 | } | 267 | } |
| 268 | #endif | ||
| 267 | 269 | ||
| 268 | /* This is a process-global DSO handle used for loading and unloading | 270 | /* This is a process-global DSO handle used for loading and unloading |
| 269 | * the Atalla library. NB: This is only set (or unset) during an | 271 | * the Atalla library. NB: This is only set (or unset) during an |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 034c7ca213..139119b80c 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
| @@ -29,8 +29,32 @@ | |||
| 29 | * | 29 | * |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #include <sys/types.h> | 32 | #include <openssl/objects.h> |
| 33 | #include <openssl/engine.h> | ||
| 34 | #include <openssl/evp.h> | ||
| 35 | |||
| 36 | #if (defined(__unix__) || defined(unix)) && !defined(USG) | ||
| 33 | #include <sys/param.h> | 37 | #include <sys/param.h> |
| 38 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | ||
| 39 | # define HAVE_CRYPTODEV | ||
| 40 | # endif | ||
| 41 | # if (OpenBSD >= 200110) | ||
| 42 | # define HAVE_SYSLOG_R | ||
| 43 | # endif | ||
| 44 | #endif | ||
| 45 | |||
| 46 | #ifndef HAVE_CRYPTODEV | ||
| 47 | |||
| 48 | void | ||
| 49 | ENGINE_load_cryptodev(void) | ||
| 50 | { | ||
| 51 | /* This is a NOP on platforms without /dev/crypto */ | ||
| 52 | return; | ||
| 53 | } | ||
| 54 | |||
| 55 | #else | ||
| 56 | |||
| 57 | #include <sys/types.h> | ||
| 34 | #include <crypto/cryptodev.h> | 58 | #include <crypto/cryptodev.h> |
| 35 | #include <sys/ioctl.h> | 59 | #include <sys/ioctl.h> |
| 36 | #include <errno.h> | 60 | #include <errno.h> |
| @@ -39,9 +63,6 @@ | |||
| 39 | #include <fcntl.h> | 63 | #include <fcntl.h> |
| 40 | #include <stdarg.h> | 64 | #include <stdarg.h> |
| 41 | #include <syslog.h> | 65 | #include <syslog.h> |
| 42 | #include <ssl/objects.h> | ||
| 43 | #include <ssl/engine.h> | ||
| 44 | #include <ssl/evp.h> | ||
| 45 | #include <errno.h> | 66 | #include <errno.h> |
| 46 | #include <string.h> | 67 | #include <string.h> |
| 47 | 68 | ||
| @@ -101,10 +122,6 @@ static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | |||
| 101 | void ENGINE_load_cryptodev(void); | 122 | void ENGINE_load_cryptodev(void); |
| 102 | 123 | ||
| 103 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | 124 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { |
| 104 | {ENGINE_CMD_BASE, | ||
| 105 | "SO_PATH", | ||
| 106 | "Specifies the path to the some stupid shared library", | ||
| 107 | ENGINE_CMD_FLAG_STRING}, | ||
| 108 | { 0, NULL, NULL, 0 } | 125 | { 0, NULL, NULL, 0 } |
| 109 | }; | 126 | }; |
| 110 | 127 | ||
| @@ -1011,12 +1028,18 @@ static DH_METHOD cryptodev_dh = { | |||
| 1011 | static int | 1028 | static int |
| 1012 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | 1029 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) |
| 1013 | { | 1030 | { |
| 1031 | #ifdef HAVE_SYSLOG_R | ||
| 1014 | struct syslog_data sd = SYSLOG_DATA_INIT; | 1032 | struct syslog_data sd = SYSLOG_DATA_INIT; |
| 1033 | #endif | ||
| 1015 | 1034 | ||
| 1016 | switch (cmd) { | 1035 | switch (cmd) { |
| 1017 | default: | 1036 | default: |
| 1037 | #ifdef HAVE_SYSLOG_R | ||
| 1018 | syslog_r(LOG_ERR, &sd, | 1038 | syslog_r(LOG_ERR, &sd, |
| 1019 | "cryptodev_ctrl: unknown command %d", cmd); | 1039 | "cryptodev_ctrl: unknown command %d", cmd); |
| 1040 | #else | ||
| 1041 | syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd); | ||
| 1042 | #endif | ||
| 1020 | break; | 1043 | break; |
| 1021 | } | 1044 | } |
| 1022 | return (1); | 1045 | return (1); |
| @@ -1043,7 +1066,7 @@ ENGINE_load_cryptodev(void) | |||
| 1043 | close(fd); | 1066 | close(fd); |
| 1044 | 1067 | ||
| 1045 | if (!ENGINE_set_id(engine, "cryptodev") || | 1068 | if (!ENGINE_set_id(engine, "cryptodev") || |
| 1046 | !ENGINE_set_name(engine, "OpenBSD cryptodev engine") || | 1069 | !ENGINE_set_name(engine, "BSD cryptodev engine") || |
| 1047 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || | 1070 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || |
| 1048 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || | 1071 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || |
| 1049 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || | 1072 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || |
| @@ -1104,3 +1127,5 @@ ENGINE_load_cryptodev(void) | |||
| 1104 | ENGINE_free(engine); | 1127 | ENGINE_free(engine); |
| 1105 | ERR_clear_error(); | 1128 | ERR_clear_error(); |
| 1106 | } | 1129 | } |
| 1130 | |||
| 1131 | #endif /* HAVE_CRYPTODEV */ | ||
diff --git a/src/lib/libcrypto/engine/hw_cswift.c b/src/lib/libcrypto/engine/hw_cswift.c index f5c897bdbb..f128ee5a68 100644 --- a/src/lib/libcrypto/engine/hw_cswift.c +++ b/src/lib/libcrypto/engine/hw_cswift.c | |||
| @@ -121,6 +121,10 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r, | |||
| 121 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 121 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | /* RAND stuff */ | ||
| 125 | static int cswift_rand_bytes(unsigned char *buf, int num); | ||
| 126 | static int cswift_rand_status(void); | ||
| 127 | |||
| 124 | /* The definitions for control commands specific to this engine */ | 128 | /* The definitions for control commands specific to this engine */ |
| 125 | #define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE | 129 | #define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE |
| 126 | static const ENGINE_CMD_DEFN cswift_cmd_defns[] = { | 130 | static const ENGINE_CMD_DEFN cswift_cmd_defns[] = { |
| @@ -183,6 +187,18 @@ static DH_METHOD cswift_dh = | |||
| 183 | }; | 187 | }; |
| 184 | #endif | 188 | #endif |
| 185 | 189 | ||
| 190 | static RAND_METHOD cswift_random = | ||
| 191 | { | ||
| 192 | /* "CryptoSwift RAND method", */ | ||
| 193 | NULL, | ||
| 194 | cswift_rand_bytes, | ||
| 195 | NULL, | ||
| 196 | NULL, | ||
| 197 | cswift_rand_bytes, | ||
| 198 | cswift_rand_status, | ||
| 199 | }; | ||
| 200 | |||
| 201 | |||
| 186 | /* Constants used when creating the ENGINE */ | 202 | /* Constants used when creating the ENGINE */ |
| 187 | static const char *engine_cswift_id = "cswift"; | 203 | static const char *engine_cswift_id = "cswift"; |
| 188 | static const char *engine_cswift_name = "CryptoSwift hardware engine support"; | 204 | static const char *engine_cswift_name = "CryptoSwift hardware engine support"; |
| @@ -208,6 +224,7 @@ static int bind_helper(ENGINE *e) | |||
| 208 | #ifndef OPENSSL_NO_DH | 224 | #ifndef OPENSSL_NO_DH |
| 209 | !ENGINE_set_DH(e, &cswift_dh) || | 225 | !ENGINE_set_DH(e, &cswift_dh) || |
| 210 | #endif | 226 | #endif |
| 227 | !ENGINE_set_RAND(e, &cswift_random) || | ||
| 211 | !ENGINE_set_destroy_function(e, cswift_destroy) || | 228 | !ENGINE_set_destroy_function(e, cswift_destroy) || |
| 212 | !ENGINE_set_init_function(e, cswift_init) || | 229 | !ENGINE_set_init_function(e, cswift_init) || |
| 213 | !ENGINE_set_finish_function(e, cswift_finish) || | 230 | !ENGINE_set_finish_function(e, cswift_finish) || |
| @@ -242,6 +259,7 @@ static int bind_helper(ENGINE *e) | |||
| 242 | return 1; | 259 | return 1; |
| 243 | } | 260 | } |
| 244 | 261 | ||
| 262 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 245 | static ENGINE *engine_cswift(void) | 263 | static ENGINE *engine_cswift(void) |
| 246 | { | 264 | { |
| 247 | ENGINE *ret = ENGINE_new(); | 265 | ENGINE *ret = ENGINE_new(); |
| @@ -264,6 +282,7 @@ void ENGINE_load_cswift(void) | |||
| 264 | ENGINE_free(toadd); | 282 | ENGINE_free(toadd); |
| 265 | ERR_clear_error(); | 283 | ERR_clear_error(); |
| 266 | } | 284 | } |
| 285 | #endif | ||
| 267 | 286 | ||
| 268 | /* This is a process-global DSO handle used for loading and unloading | 287 | /* This is a process-global DSO handle used for loading and unloading |
| 269 | * the CryptoSwift library. NB: This is only set (or unset) during an | 288 | * the CryptoSwift library. NB: This is only set (or unset) during an |
| @@ -905,6 +924,60 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r, | |||
| 905 | } | 924 | } |
| 906 | #endif | 925 | #endif |
| 907 | 926 | ||
| 927 | /* Random bytes are good */ | ||
| 928 | static int cswift_rand_bytes(unsigned char *buf, int num) | ||
| 929 | { | ||
| 930 | SW_CONTEXT_HANDLE hac; | ||
| 931 | SW_STATUS swrc; | ||
| 932 | SW_LARGENUMBER largenum; | ||
| 933 | size_t nbytes = 0; | ||
| 934 | int acquired = 0; | ||
| 935 | int to_return = 0; /* assume failure */ | ||
| 936 | |||
| 937 | if (!get_context(&hac)) | ||
| 938 | { | ||
| 939 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_UNIT_FAILURE); | ||
| 940 | goto err; | ||
| 941 | } | ||
| 942 | acquired = 1; | ||
| 943 | |||
| 944 | while (nbytes < (size_t)num) | ||
| 945 | { | ||
| 946 | /* tell CryptoSwift how many bytes we want and where we want it. | ||
| 947 | * Note: - CryptoSwift cannot do more than 4096 bytes at a time. | ||
| 948 | * - CryptoSwift can only do multiple of 32-bits. */ | ||
| 949 | largenum.value = (SW_BYTE *) buf + nbytes; | ||
| 950 | if (4096 > num - nbytes) | ||
| 951 | largenum.nbytes = num - nbytes; | ||
| 952 | else | ||
| 953 | largenum.nbytes = 4096; | ||
| 954 | |||
| 955 | swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1); | ||
| 956 | if (swrc != SW_OK) | ||
| 957 | { | ||
| 958 | char tmpbuf[20]; | ||
| 959 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_REQUEST_FAILED); | ||
| 960 | sprintf(tmpbuf, "%ld", swrc); | ||
| 961 | ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf); | ||
| 962 | goto err; | ||
| 963 | } | ||
| 964 | |||
| 965 | nbytes += largenum.nbytes; | ||
| 966 | } | ||
| 967 | to_return = 1; /* success */ | ||
| 968 | |||
| 969 | err: | ||
| 970 | if (acquired) | ||
| 971 | release_context(hac); | ||
| 972 | return to_return; | ||
| 973 | } | ||
| 974 | |||
| 975 | static int cswift_rand_status(void) | ||
| 976 | { | ||
| 977 | return 1; | ||
| 978 | } | ||
| 979 | |||
| 980 | |||
| 908 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | 981 | /* This stuff is needed if this ENGINE is being compiled into a self-contained |
| 909 | * shared-library. */ | 982 | * shared-library. */ |
| 910 | #ifdef ENGINE_DYNAMIC_SUPPORT | 983 | #ifdef ENGINE_DYNAMIC_SUPPORT |
diff --git a/src/lib/libcrypto/engine/hw_ncipher.c b/src/lib/libcrypto/engine/hw_ncipher.c index a43d4360f2..0d1c6b8df0 100644 --- a/src/lib/libcrypto/engine/hw_ncipher.c +++ b/src/lib/libcrypto/engine/hw_ncipher.c | |||
| @@ -91,11 +91,19 @@ static int hwcrhk_init(ENGINE *e); | |||
| 91 | static int hwcrhk_finish(ENGINE *e); | 91 | static int hwcrhk_finish(ENGINE *e); |
| 92 | static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | 92 | static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); |
| 93 | 93 | ||
| 94 | /* Functions to handle mutexes */ | 94 | /* Functions to handle mutexes if have dynamic locks */ |
| 95 | static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*); | 95 | static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*); |
| 96 | static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*); | 96 | static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*); |
| 97 | static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*); | 97 | static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*); |
| 98 | static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*); | 98 | static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*); |
| 99 | #if 1 /* This is a HACK which will disappear in 0.9.8 */ | ||
| 100 | /* Functions to handle mutexes if only have static locks */ | ||
| 101 | static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m, | ||
| 102 | HWCryptoHook_CallerContext *c); | ||
| 103 | static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m); | ||
| 104 | static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m); | ||
| 105 | static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m); | ||
| 106 | #endif | ||
| 99 | 107 | ||
| 100 | /* BIGNUM stuff */ | 108 | /* BIGNUM stuff */ |
| 101 | static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 109 | static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
| @@ -373,6 +381,7 @@ static int bind_helper(ENGINE *e) | |||
| 373 | return 1; | 381 | return 1; |
| 374 | } | 382 | } |
| 375 | 383 | ||
| 384 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 376 | static ENGINE *engine_ncipher(void) | 385 | static ENGINE *engine_ncipher(void) |
| 377 | { | 386 | { |
| 378 | ENGINE *ret = ENGINE_new(); | 387 | ENGINE *ret = ENGINE_new(); |
| @@ -395,6 +404,7 @@ void ENGINE_load_chil(void) | |||
| 395 | ENGINE_free(toadd); | 404 | ENGINE_free(toadd); |
| 396 | ERR_clear_error(); | 405 | ERR_clear_error(); |
| 397 | } | 406 | } |
| 407 | #endif | ||
| 398 | 408 | ||
| 399 | /* This is a process-global DSO handle used for loading and unloading | 409 | /* This is a process-global DSO handle used for loading and unloading |
| 400 | * the HWCryptoHook library. NB: This is only set (or unset) during an | 410 | * the HWCryptoHook library. NB: This is only set (or unset) during an |
| @@ -558,15 +568,31 @@ static int hwcrhk_init(ENGINE *e) | |||
| 558 | 568 | ||
| 559 | /* Check if the application decided to support dynamic locks, | 569 | /* Check if the application decided to support dynamic locks, |
| 560 | and if it does, use them. */ | 570 | and if it does, use them. */ |
| 561 | if (disable_mutex_callbacks == 0 && | 571 | if (disable_mutex_callbacks == 0) |
| 562 | CRYPTO_get_dynlock_create_callback() != NULL && | ||
| 563 | CRYPTO_get_dynlock_lock_callback() != NULL && | ||
| 564 | CRYPTO_get_dynlock_destroy_callback() != NULL) | ||
| 565 | { | 572 | { |
| 566 | hwcrhk_globals.mutex_init = hwcrhk_mutex_init; | 573 | if (CRYPTO_get_dynlock_create_callback() != NULL && |
| 567 | hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock; | 574 | CRYPTO_get_dynlock_lock_callback() != NULL && |
| 568 | hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock; | 575 | CRYPTO_get_dynlock_destroy_callback() != NULL) |
| 569 | hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy; | 576 | { |
| 577 | hwcrhk_globals.mutex_init = hwcrhk_mutex_init; | ||
| 578 | hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock; | ||
| 579 | hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock; | ||
| 580 | hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy; | ||
| 581 | } | ||
| 582 | else if (CRYPTO_get_locking_callback() != NULL) | ||
| 583 | { | ||
| 584 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DYNAMIC_LOCKING_MISSING); | ||
| 585 | ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()"); | ||
| 586 | #if 1 /* This is a HACK which will disappear in 0.9.8 */ | ||
| 587 | hwcrhk_globals.maxmutexes = 1; /* Only have one lock */ | ||
| 588 | hwcrhk_globals.mutex_init = hwcrhk_static_mutex_init; | ||
| 589 | hwcrhk_globals.mutex_acquire = hwcrhk_static_mutex_lock; | ||
| 590 | hwcrhk_globals.mutex_release = hwcrhk_static_mutex_unlock; | ||
| 591 | hwcrhk_globals.mutex_destroy = hwcrhk_static_mutex_destroy; | ||
| 592 | #else | ||
| 593 | goto err; | ||
| 594 | #endif | ||
| 595 | } | ||
| 570 | } | 596 | } |
| 571 | 597 | ||
| 572 | /* Try and get a context - if not, we may have a DSO but no | 598 | /* Try and get a context - if not, we may have a DSO but no |
| @@ -1020,7 +1046,7 @@ static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa) | |||
| 1020 | 1046 | ||
| 1021 | /* Perform the operation */ | 1047 | /* Perform the operation */ |
| 1022 | ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q, | 1048 | ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q, |
| 1023 | m_dmp1, m_dmq1, m_iqmp, &m_r, NULL); | 1049 | m_dmp1, m_dmq1, m_iqmp, &m_r, &rmsg); |
| 1024 | 1050 | ||
| 1025 | /* Convert the response */ | 1051 | /* Convert the response */ |
| 1026 | r->top = m_r.size / sizeof(BN_ULONG); | 1052 | r->top = m_r.size / sizeof(BN_ULONG); |
| @@ -1171,6 +1197,26 @@ static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex *mt) | |||
| 1171 | CRYPTO_destroy_dynlockid(mt->lockid); | 1197 | CRYPTO_destroy_dynlockid(mt->lockid); |
| 1172 | } | 1198 | } |
| 1173 | 1199 | ||
| 1200 | /* Mutex upcalls to use if the application does not support dynamic locks */ | ||
| 1201 | |||
| 1202 | static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m, | ||
| 1203 | HWCryptoHook_CallerContext *c) | ||
| 1204 | { | ||
| 1205 | return 0; | ||
| 1206 | } | ||
| 1207 | static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m) | ||
| 1208 | { | ||
| 1209 | CRYPTO_w_lock(CRYPTO_LOCK_HWCRHK); | ||
| 1210 | return 0; | ||
| 1211 | } | ||
| 1212 | static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m) | ||
| 1213 | { | ||
| 1214 | CRYPTO_w_unlock(CRYPTO_LOCK_HWCRHK); | ||
| 1215 | } | ||
| 1216 | static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m) | ||
| 1217 | { | ||
| 1218 | } | ||
| 1219 | |||
| 1174 | static int hwcrhk_get_pass(const char *prompt_info, | 1220 | static int hwcrhk_get_pass(const char *prompt_info, |
| 1175 | int *len_io, char *buf, | 1221 | int *len_io, char *buf, |
| 1176 | HWCryptoHook_PassphraseContext *ppctx, | 1222 | HWCryptoHook_PassphraseContext *ppctx, |
| @@ -1318,7 +1364,7 @@ static void hwcrhk_log_message(void *logstr, const char *message) | |||
| 1318 | lstream=*(BIO **)logstr; | 1364 | lstream=*(BIO **)logstr; |
| 1319 | if (lstream) | 1365 | if (lstream) |
| 1320 | { | 1366 | { |
| 1321 | BIO_write(lstream, message, strlen(message)); | 1367 | BIO_printf(lstream, "%s\n", message); |
| 1322 | } | 1368 | } |
| 1323 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); | 1369 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); |
| 1324 | } | 1370 | } |
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.c b/src/lib/libcrypto/engine/hw_ncipher_err.c index 24024cfc6f..5bc94581b7 100644 --- a/src/lib/libcrypto/engine/hw_ncipher_err.c +++ b/src/lib/libcrypto/engine/hw_ncipher_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* hw_ncipher_err.c */ | 1 | /* hw_ncipher_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -86,6 +86,7 @@ static ERR_STRING_DATA HWCRHK_str_reasons[]= | |||
| 86 | {HWCRHK_R_CHIL_ERROR ,"chil error"}, | 86 | {HWCRHK_R_CHIL_ERROR ,"chil error"}, |
| 87 | {HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | 87 | {HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, |
| 88 | {HWCRHK_R_DSO_FAILURE ,"dso failure"}, | 88 | {HWCRHK_R_DSO_FAILURE ,"dso failure"}, |
| 89 | {HWCRHK_R_DYNAMIC_LOCKING_MISSING ,"dynamic locking missing"}, | ||
| 89 | {HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | 90 | {HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"}, |
| 90 | {HWCRHK_R_NOT_INITIALISED ,"not initialised"}, | 91 | {HWCRHK_R_NOT_INITIALISED ,"not initialised"}, |
| 91 | {HWCRHK_R_NOT_LOADED ,"not loaded"}, | 92 | {HWCRHK_R_NOT_LOADED ,"not loaded"}, |
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.h b/src/lib/libcrypto/engine/hw_ncipher_err.h index 4d65b1d470..d232d02319 100644 --- a/src/lib/libcrypto/engine/hw_ncipher_err.h +++ b/src/lib/libcrypto/engine/hw_ncipher_err.h | |||
| @@ -84,6 +84,7 @@ static void ERR_HWCRHK_error(int function, int reason, char *file, int line); | |||
| 84 | #define HWCRHK_R_CHIL_ERROR 102 | 84 | #define HWCRHK_R_CHIL_ERROR 102 |
| 85 | #define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 | 85 | #define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 |
| 86 | #define HWCRHK_R_DSO_FAILURE 104 | 86 | #define HWCRHK_R_DSO_FAILURE 104 |
| 87 | #define HWCRHK_R_DYNAMIC_LOCKING_MISSING 114 | ||
| 87 | #define HWCRHK_R_MISSING_KEY_COMPONENTS 105 | 88 | #define HWCRHK_R_MISSING_KEY_COMPONENTS 105 |
| 88 | #define HWCRHK_R_NOT_INITIALISED 106 | 89 | #define HWCRHK_R_NOT_INITIALISED 106 |
| 89 | #define HWCRHK_R_NOT_LOADED 107 | 90 | #define HWCRHK_R_NOT_LOADED 107 |
diff --git a/src/lib/libcrypto/engine/hw_nuron.c b/src/lib/libcrypto/engine/hw_nuron.c index 130b6d8b40..fb9188bfe5 100644 --- a/src/lib/libcrypto/engine/hw_nuron.c +++ b/src/lib/libcrypto/engine/hw_nuron.c | |||
| @@ -374,6 +374,7 @@ static int bind_helper(ENGINE *e) | |||
| 374 | return 1; | 374 | return 1; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 377 | static ENGINE *engine_nuron(void) | 378 | static ENGINE *engine_nuron(void) |
| 378 | { | 379 | { |
| 379 | ENGINE *ret = ENGINE_new(); | 380 | ENGINE *ret = ENGINE_new(); |
| @@ -396,6 +397,7 @@ void ENGINE_load_nuron(void) | |||
| 396 | ENGINE_free(toadd); | 397 | ENGINE_free(toadd); |
| 397 | ERR_clear_error(); | 398 | ERR_clear_error(); |
| 398 | } | 399 | } |
| 400 | #endif | ||
| 399 | 401 | ||
| 400 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | 402 | /* This stuff is needed if this ENGINE is being compiled into a self-contained |
| 401 | * shared-library. */ | 403 | * shared-library. */ |
diff --git a/src/lib/libcrypto/engine/hw_ubsec.c b/src/lib/libcrypto/engine/hw_ubsec.c index ed8401ec16..6286dd851c 100644 --- a/src/lib/libcrypto/engine/hw_ubsec.c +++ b/src/lib/libcrypto/engine/hw_ubsec.c | |||
| @@ -242,6 +242,7 @@ static int bind_helper(ENGINE *e) | |||
| 242 | return 1; | 242 | return 1; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 245 | static ENGINE *engine_ubsec(void) | 246 | static ENGINE *engine_ubsec(void) |
| 246 | { | 247 | { |
| 247 | ENGINE *ret = ENGINE_new(); | 248 | ENGINE *ret = ENGINE_new(); |
| @@ -264,6 +265,7 @@ void ENGINE_load_ubsec(void) | |||
| 264 | ENGINE_free(toadd); | 265 | ENGINE_free(toadd); |
| 265 | ERR_clear_error(); | 266 | ERR_clear_error(); |
| 266 | } | 267 | } |
| 268 | #endif | ||
| 267 | 269 | ||
| 268 | /* This is a process-global DSO handle used for loading and unloading | 270 | /* This is a process-global DSO handle used for loading and unloading |
| 269 | * the UBSEC library. NB: This is only set (or unset) during an | 271 | * the UBSEC library. NB: This is only set (or unset) during an |
diff --git a/src/lib/libcrypto/engine/tb_cipher.c b/src/lib/libcrypto/engine/tb_cipher.c index c5a50fc910..50b3cec1fa 100644 --- a/src/lib/libcrypto/engine/tb_cipher.c +++ b/src/lib/libcrypto/engine/tb_cipher.c | |||
| @@ -81,7 +81,7 @@ int ENGINE_register_ciphers(ENGINE *e) | |||
| 81 | int num_nids = e->ciphers(e, NULL, &nids, 0); | 81 | int num_nids = e->ciphers(e, NULL, &nids, 0); |
| 82 | if(num_nids > 0) | 82 | if(num_nids > 0) |
| 83 | return engine_table_register(&cipher_table, | 83 | return engine_table_register(&cipher_table, |
| 84 | &engine_unregister_all_ciphers, e, nids, | 84 | engine_unregister_all_ciphers, e, nids, |
| 85 | num_nids, 0); | 85 | num_nids, 0); |
| 86 | } | 86 | } |
| 87 | return 1; | 87 | return 1; |
| @@ -103,7 +103,7 @@ int ENGINE_set_default_ciphers(ENGINE *e) | |||
| 103 | int num_nids = e->ciphers(e, NULL, &nids, 0); | 103 | int num_nids = e->ciphers(e, NULL, &nids, 0); |
| 104 | if(num_nids > 0) | 104 | if(num_nids > 0) |
| 105 | return engine_table_register(&cipher_table, | 105 | return engine_table_register(&cipher_table, |
| 106 | &engine_unregister_all_ciphers, e, nids, | 106 | engine_unregister_all_ciphers, e, nids, |
| 107 | num_nids, 1); | 107 | num_nids, 1); |
| 108 | } | 108 | } |
| 109 | return 1; | 109 | return 1; |
diff --git a/src/lib/libcrypto/engine/tb_dh.c b/src/lib/libcrypto/engine/tb_dh.c index c9347235ea..e290e1702b 100644 --- a/src/lib/libcrypto/engine/tb_dh.c +++ b/src/lib/libcrypto/engine/tb_dh.c | |||
| @@ -78,7 +78,7 @@ int ENGINE_register_DH(ENGINE *e) | |||
| 78 | { | 78 | { |
| 79 | if(e->dh_meth) | 79 | if(e->dh_meth) |
| 80 | return engine_table_register(&dh_table, | 80 | return engine_table_register(&dh_table, |
| 81 | &engine_unregister_all_DH, e, &dummy_nid, 1, 0); | 81 | engine_unregister_all_DH, e, &dummy_nid, 1, 0); |
| 82 | return 1; | 82 | return 1; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -94,7 +94,7 @@ int ENGINE_set_default_DH(ENGINE *e) | |||
| 94 | { | 94 | { |
| 95 | if(e->dh_meth) | 95 | if(e->dh_meth) |
| 96 | return engine_table_register(&dh_table, | 96 | return engine_table_register(&dh_table, |
| 97 | &engine_unregister_all_DH, e, &dummy_nid, 1, 1); | 97 | engine_unregister_all_DH, e, &dummy_nid, 1, 1); |
| 98 | return 1; | 98 | return 1; |
| 99 | } | 99 | } |
| 100 | 100 | ||
diff --git a/src/lib/libcrypto/engine/tb_digest.c b/src/lib/libcrypto/engine/tb_digest.c index 2c4dd6f796..e82d2a17c9 100644 --- a/src/lib/libcrypto/engine/tb_digest.c +++ b/src/lib/libcrypto/engine/tb_digest.c | |||
| @@ -81,7 +81,7 @@ int ENGINE_register_digests(ENGINE *e) | |||
| 81 | int num_nids = e->digests(e, NULL, &nids, 0); | 81 | int num_nids = e->digests(e, NULL, &nids, 0); |
| 82 | if(num_nids > 0) | 82 | if(num_nids > 0) |
| 83 | return engine_table_register(&digest_table, | 83 | return engine_table_register(&digest_table, |
| 84 | &engine_unregister_all_digests, e, nids, | 84 | engine_unregister_all_digests, e, nids, |
| 85 | num_nids, 0); | 85 | num_nids, 0); |
| 86 | } | 86 | } |
| 87 | return 1; | 87 | return 1; |
| @@ -103,7 +103,7 @@ int ENGINE_set_default_digests(ENGINE *e) | |||
| 103 | int num_nids = e->digests(e, NULL, &nids, 0); | 103 | int num_nids = e->digests(e, NULL, &nids, 0); |
| 104 | if(num_nids > 0) | 104 | if(num_nids > 0) |
| 105 | return engine_table_register(&digest_table, | 105 | return engine_table_register(&digest_table, |
| 106 | &engine_unregister_all_digests, e, nids, | 106 | engine_unregister_all_digests, e, nids, |
| 107 | num_nids, 1); | 107 | num_nids, 1); |
| 108 | } | 108 | } |
| 109 | return 1; | 109 | return 1; |
diff --git a/src/lib/libcrypto/engine/tb_dsa.c b/src/lib/libcrypto/engine/tb_dsa.c index e9209476b8..80170591f2 100644 --- a/src/lib/libcrypto/engine/tb_dsa.c +++ b/src/lib/libcrypto/engine/tb_dsa.c | |||
| @@ -78,7 +78,7 @@ int ENGINE_register_DSA(ENGINE *e) | |||
| 78 | { | 78 | { |
| 79 | if(e->dsa_meth) | 79 | if(e->dsa_meth) |
| 80 | return engine_table_register(&dsa_table, | 80 | return engine_table_register(&dsa_table, |
| 81 | &engine_unregister_all_DSA, e, &dummy_nid, 1, 0); | 81 | engine_unregister_all_DSA, e, &dummy_nid, 1, 0); |
| 82 | return 1; | 82 | return 1; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -94,7 +94,7 @@ int ENGINE_set_default_DSA(ENGINE *e) | |||
| 94 | { | 94 | { |
| 95 | if(e->dsa_meth) | 95 | if(e->dsa_meth) |
| 96 | return engine_table_register(&dsa_table, | 96 | return engine_table_register(&dsa_table, |
| 97 | &engine_unregister_all_DSA, e, &dummy_nid, 1, 0); | 97 | engine_unregister_all_DSA, e, &dummy_nid, 1, 0); |
| 98 | return 1; | 98 | return 1; |
| 99 | } | 99 | } |
| 100 | 100 | ||
diff --git a/src/lib/libcrypto/engine/tb_rand.c b/src/lib/libcrypto/engine/tb_rand.c index 0b1d031f1e..69b67111bc 100644 --- a/src/lib/libcrypto/engine/tb_rand.c +++ b/src/lib/libcrypto/engine/tb_rand.c | |||
| @@ -78,7 +78,7 @@ int ENGINE_register_RAND(ENGINE *e) | |||
| 78 | { | 78 | { |
| 79 | if(e->rand_meth) | 79 | if(e->rand_meth) |
| 80 | return engine_table_register(&rand_table, | 80 | return engine_table_register(&rand_table, |
| 81 | &engine_unregister_all_RAND, e, &dummy_nid, 1, 0); | 81 | engine_unregister_all_RAND, e, &dummy_nid, 1, 0); |
| 82 | return 1; | 82 | return 1; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -94,7 +94,7 @@ int ENGINE_set_default_RAND(ENGINE *e) | |||
| 94 | { | 94 | { |
| 95 | if(e->rand_meth) | 95 | if(e->rand_meth) |
| 96 | return engine_table_register(&rand_table, | 96 | return engine_table_register(&rand_table, |
| 97 | &engine_unregister_all_RAND, e, &dummy_nid, 1, 1); | 97 | engine_unregister_all_RAND, e, &dummy_nid, 1, 1); |
| 98 | return 1; | 98 | return 1; |
| 99 | } | 99 | } |
| 100 | 100 | ||
diff --git a/src/lib/libcrypto/engine/tb_rsa.c b/src/lib/libcrypto/engine/tb_rsa.c index f84fea3968..fee4867f52 100644 --- a/src/lib/libcrypto/engine/tb_rsa.c +++ b/src/lib/libcrypto/engine/tb_rsa.c | |||
| @@ -78,7 +78,7 @@ int ENGINE_register_RSA(ENGINE *e) | |||
| 78 | { | 78 | { |
| 79 | if(e->rsa_meth) | 79 | if(e->rsa_meth) |
| 80 | return engine_table_register(&rsa_table, | 80 | return engine_table_register(&rsa_table, |
| 81 | &engine_unregister_all_RSA, e, &dummy_nid, 1, 0); | 81 | engine_unregister_all_RSA, e, &dummy_nid, 1, 0); |
| 82 | return 1; | 82 | return 1; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -94,7 +94,7 @@ int ENGINE_set_default_RSA(ENGINE *e) | |||
| 94 | { | 94 | { |
| 95 | if(e->rsa_meth) | 95 | if(e->rsa_meth) |
| 96 | return engine_table_register(&rsa_table, | 96 | return engine_table_register(&rsa_table, |
| 97 | &engine_unregister_all_RSA, e, &dummy_nid, 1, 1); | 97 | engine_unregister_all_RSA, e, &dummy_nid, 1, 1); |
| 98 | return 1; | 98 | return 1; |
| 99 | } | 99 | } |
| 100 | 100 | ||
