diff options
Diffstat (limited to 'src/lib/libcrypto/o_init.c')
| -rw-r--r-- | src/lib/libcrypto/o_init.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/lib/libcrypto/o_init.c b/src/lib/libcrypto/o_init.c index 00ed65a6cf..db4cdc443b 100644 --- a/src/lib/libcrypto/o_init.c +++ b/src/lib/libcrypto/o_init.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -50,14 +50,14 @@ | |||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | * ==================================================================== | 51 | * ==================================================================== |
| 52 | * | 52 | * |
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | 53 | */ |
| 58 | 54 | ||
| 59 | #include <e_os.h> | 55 | #include <e_os.h> |
| 60 | #include <openssl/err.h> | 56 | #include <openssl/err.h> |
| 57 | #ifdef OPENSSL_FIPS | ||
| 58 | #include <openssl/fips.h> | ||
| 59 | #include <openssl/rand.h> | ||
| 60 | #endif | ||
| 61 | 61 | ||
| 62 | /* Perform any essential OpenSSL initialization operations. | 62 | /* Perform any essential OpenSSL initialization operations. |
| 63 | * Currently only sets FIPS callbacks | 63 | * Currently only sets FIPS callbacks |
| @@ -65,22 +65,18 @@ | |||
| 65 | 65 | ||
| 66 | void OPENSSL_init(void) | 66 | void OPENSSL_init(void) |
| 67 | { | 67 | { |
| 68 | #ifdef OPENSSL_FIPS | ||
| 69 | static int done = 0; | 68 | static int done = 0; |
| 70 | if (!done) | 69 | if (done) |
| 71 | { | 70 | return; |
| 72 | int_ERR_lib_init(); | 71 | done = 1; |
| 73 | #ifdef CRYPTO_MDEBUG | 72 | #ifdef OPENSSL_FIPS |
| 74 | CRYPTO_malloc_debug_init(); | 73 | FIPS_set_locking_callbacks(CRYPTO_lock, CRYPTO_add_lock); |
| 75 | #endif | 74 | FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata); |
| 76 | #ifdef OPENSSL_ENGINE | 75 | FIPS_set_malloc_callbacks(CRYPTO_malloc, CRYPTO_free); |
| 77 | int_EVP_MD_init_engine_callbacks(); | 76 | RAND_init_fips(); |
| 78 | int_EVP_CIPHER_init_engine_callbacks(); | ||
| 79 | int_RAND_init_engine_callbacks(); | ||
| 80 | #endif | 77 | #endif |
| 81 | done = 1; | 78 | #if 0 |
| 82 | } | 79 | fprintf(stderr, "Called OPENSSL_init\n"); |
| 83 | #endif | 80 | #endif |
| 84 | } | 81 | } |
| 85 | |||
| 86 | 82 | ||
