diff options
Diffstat (limited to 'src/lib/libcrypto/rand/md_rand.c')
-rw-r--r-- | src/lib/libcrypto/rand/md_rand.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index c84968df88..9783d0c23e 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
@@ -126,7 +126,6 @@ | |||
126 | 126 | ||
127 | #include <openssl/crypto.h> | 127 | #include <openssl/crypto.h> |
128 | #include <openssl/err.h> | 128 | #include <openssl/err.h> |
129 | #include <openssl/fips.h> | ||
130 | 129 | ||
131 | #ifdef BN_DEBUG | 130 | #ifdef BN_DEBUG |
132 | # define PREDICT | 131 | # define PREDICT |
@@ -153,7 +152,7 @@ static unsigned long locking_thread = 0; /* valid iff crypto_lock_rand is set */ | |||
153 | int rand_predictable=0; | 152 | int rand_predictable=0; |
154 | #endif | 153 | #endif |
155 | 154 | ||
156 | const char *RAND_version="RAND" OPENSSL_VERSION_PTEXT; | 155 | const char RAND_version[]="RAND" OPENSSL_VERSION_PTEXT; |
157 | 156 | ||
158 | static void ssleay_rand_cleanup(void); | 157 | static void ssleay_rand_cleanup(void); |
159 | static void ssleay_rand_seed(const void *buf, int num); | 158 | static void ssleay_rand_seed(const void *buf, int num); |
@@ -301,7 +300,7 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
301 | * other thread's seeding remains without effect (except for | 300 | * other thread's seeding remains without effect (except for |
302 | * the incremented counter). By XORing it we keep at least as | 301 | * the incremented counter). By XORing it we keep at least as |
303 | * much entropy as fits into md. */ | 302 | * much entropy as fits into md. */ |
304 | for (k = 0; k < sizeof md; k++) | 303 | for (k = 0; k < (int)sizeof(md); k++) |
305 | { | 304 | { |
306 | md[k] ^= local_md[k]; | 305 | md[k] ^= local_md[k]; |
307 | } | 306 | } |
@@ -316,7 +315,7 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
316 | 315 | ||
317 | static void ssleay_rand_seed(const void *buf, int num) | 316 | static void ssleay_rand_seed(const void *buf, int num) |
318 | { | 317 | { |
319 | ssleay_rand_add(buf, num, num); | 318 | ssleay_rand_add(buf, num, (double)num); |
320 | } | 319 | } |
321 | 320 | ||
322 | static int ssleay_rand_bytes(unsigned char *buf, int num) | 321 | static int ssleay_rand_bytes(unsigned char *buf, int num) |
@@ -333,14 +332,6 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
333 | #endif | 332 | #endif |
334 | int do_stir_pool = 0; | 333 | int do_stir_pool = 0; |
335 | 334 | ||
336 | #ifdef OPENSSL_FIPS | ||
337 | if(FIPS_mode()) | ||
338 | { | ||
339 | FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD); | ||
340 | return 0; | ||
341 | } | ||
342 | #endif | ||
343 | |||
344 | #ifdef PREDICT | 335 | #ifdef PREDICT |
345 | if (rand_predictable) | 336 | if (rand_predictable) |
346 | { | 337 | { |
@@ -529,7 +520,7 @@ static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) | |||
529 | err = ERR_peek_error(); | 520 | err = ERR_peek_error(); |
530 | if (ERR_GET_LIB(err) == ERR_LIB_RAND && | 521 | if (ERR_GET_LIB(err) == ERR_LIB_RAND && |
531 | ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED) | 522 | ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED) |
532 | (void)ERR_get_error(); | 523 | ERR_clear_error(); |
533 | } | 524 | } |
534 | return (ret); | 525 | return (ret); |
535 | } | 526 | } |