From 7450139b8b5023f342dcb044dc40504405ade64c Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Fri, 10 Jun 2005 20:49:10 +0000 Subject: [PATCH] Default sensibly when in FIPS mode. --- crypto/rand/rand_lib.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 88f1b56d91..a21bde79de 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -87,16 +87,6 @@ int RAND_set_rand_method(const RAND_METHOD *meth) const RAND_METHOD *RAND_get_rand_method(void) { -#ifdef OPENSSL_FIPS - if(FIPS_mode() - && default_RAND_meth != FIPS_rand_check()) - { - RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); - return 0; - } -#endif - - if (!default_RAND_meth) { #ifndef OPENSSL_NO_ENGINE @@ -114,8 +104,22 @@ const RAND_METHOD *RAND_get_rand_method(void) funct_ref = e; else #endif - default_RAND_meth = RAND_SSLeay(); +#ifdef OPENSSL_FIPS + if(FIPS_mode()) + default_RAND_meth=FIPS_rand_method(); + else +#endif + default_RAND_meth = RAND_SSLeay(); } + +#ifdef OPENSSL_FIPS + if(FIPS_mode() + && default_RAND_meth != FIPS_rand_check()) + { + RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); + return 0; + } +#endif return default_RAND_meth; } -- 2.25.1