diff options
Diffstat (limited to 'src/lib/libcrypto/engine/eng_list.c')
-rw-r--r-- | src/lib/libcrypto/engine/eng_list.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c index 1cc3217f4c..bd511944ba 100644 --- a/src/lib/libcrypto/engine/eng_list.c +++ b/src/lib/libcrypto/engine/eng_list.c | |||
@@ -55,11 +55,13 @@ | |||
55 | * Hudson (tjh@cryptsoft.com). | 55 | * Hudson (tjh@cryptsoft.com). |
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | /* ==================================================================== | ||
59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
60 | * ECDH support in OpenSSL originally developed by | ||
61 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. | ||
62 | */ | ||
58 | 63 | ||
59 | #include <openssl/crypto.h> | ||
60 | #include "cryptlib.h" | ||
61 | #include "eng_int.h" | 64 | #include "eng_int.h" |
62 | #include <openssl/engine.h> | ||
63 | 65 | ||
64 | /* The linked-list of pointers to engine types. engine_list_head | 66 | /* The linked-list of pointers to engine types. engine_list_head |
65 | * incorporates an implicit structural reference but engine_list_tail | 67 | * incorporates an implicit structural reference but engine_list_tail |
@@ -324,7 +326,14 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src) | |||
324 | #ifndef OPENSSL_NO_DH | 326 | #ifndef OPENSSL_NO_DH |
325 | dest->dh_meth = src->dh_meth; | 327 | dest->dh_meth = src->dh_meth; |
326 | #endif | 328 | #endif |
329 | #ifndef OPENSSL_NO_ECDH | ||
330 | dest->ecdh_meth = src->ecdh_meth; | ||
331 | #endif | ||
332 | #ifndef OPENSSL_NO_ECDSA | ||
333 | dest->ecdsa_meth = src->ecdsa_meth; | ||
334 | #endif | ||
327 | dest->rand_meth = src->rand_meth; | 335 | dest->rand_meth = src->rand_meth; |
336 | dest->store_meth = src->store_meth; | ||
328 | dest->ciphers = src->ciphers; | 337 | dest->ciphers = src->ciphers; |
329 | dest->digests = src->digests; | 338 | dest->digests = src->digests; |
330 | dest->destroy = src->destroy; | 339 | dest->destroy = src->destroy; |
@@ -340,6 +349,7 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src) | |||
340 | ENGINE *ENGINE_by_id(const char *id) | 349 | ENGINE *ENGINE_by_id(const char *id) |
341 | { | 350 | { |
342 | ENGINE *iterator; | 351 | ENGINE *iterator; |
352 | char *load_dir = NULL; | ||
343 | if(id == NULL) | 353 | if(id == NULL) |
344 | { | 354 | { |
345 | ENGINEerr(ENGINE_F_ENGINE_BY_ID, | 355 | ENGINEerr(ENGINE_F_ENGINE_BY_ID, |
@@ -373,6 +383,7 @@ ENGINE *ENGINE_by_id(const char *id) | |||
373 | } | 383 | } |
374 | } | 384 | } |
375 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | 385 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
386 | #if 0 | ||
376 | if(iterator == NULL) | 387 | if(iterator == NULL) |
377 | { | 388 | { |
378 | ENGINEerr(ENGINE_F_ENGINE_BY_ID, | 389 | ENGINEerr(ENGINE_F_ENGINE_BY_ID, |
@@ -380,6 +391,32 @@ ENGINE *ENGINE_by_id(const char *id) | |||
380 | ERR_add_error_data(2, "id=", id); | 391 | ERR_add_error_data(2, "id=", id); |
381 | } | 392 | } |
382 | return iterator; | 393 | return iterator; |
394 | #else | ||
395 | /* EEK! Experimental code starts */ | ||
396 | if(iterator) return iterator; | ||
397 | /* Prevent infinite recusrion if we're looking for the dynamic engine. */ | ||
398 | if (strcmp(id, "dynamic")) | ||
399 | { | ||
400 | #ifdef OPENSSL_SYS_VMS | ||
401 | if((load_dir = getenv("OPENSSL_ENGINES")) == 0) load_dir = "SSLROOT:[ENGINES]"; | ||
402 | #else | ||
403 | if((load_dir = getenv("OPENSSL_ENGINES")) == 0) load_dir = ENGINESDIR; | ||
404 | #endif | ||
405 | iterator = ENGINE_by_id("dynamic"); | ||
406 | if(!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) || | ||
407 | !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || | ||
408 | !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", | ||
409 | load_dir, 0) || | ||
410 | !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0)) | ||
411 | goto notfound; | ||
412 | return iterator; | ||
413 | } | ||
414 | notfound: | ||
415 | ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE); | ||
416 | ERR_add_error_data(2, "id=", id); | ||
417 | return NULL; | ||
418 | /* EEK! Experimental code ends */ | ||
419 | #endif | ||
383 | } | 420 | } |
384 | 421 | ||
385 | int ENGINE_up_ref(ENGINE *e) | 422 | int ENGINE_up_ref(ENGINE *e) |