summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rand/rand_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rand/rand_lib.c')
-rw-r--r--src/lib/libcrypto/rand/rand_lib.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c
index a21bde79de..88f1b56d91 100644
--- a/src/lib/libcrypto/rand/rand_lib.c
+++ b/src/lib/libcrypto/rand/rand_lib.c
@@ -87,6 +87,16 @@ int RAND_set_rand_method(const RAND_METHOD *meth)
87 87
88const RAND_METHOD *RAND_get_rand_method(void) 88const RAND_METHOD *RAND_get_rand_method(void)
89 { 89 {
90#ifdef OPENSSL_FIPS
91 if(FIPS_mode()
92 && default_RAND_meth != FIPS_rand_check())
93 {
94 RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD);
95 return 0;
96 }
97#endif
98
99
90 if (!default_RAND_meth) 100 if (!default_RAND_meth)
91 { 101 {
92#ifndef OPENSSL_NO_ENGINE 102#ifndef OPENSSL_NO_ENGINE
@@ -104,22 +114,8 @@ const RAND_METHOD *RAND_get_rand_method(void)
104 funct_ref = e; 114 funct_ref = e;
105 else 115 else
106#endif 116#endif
107#ifdef OPENSSL_FIPS 117 default_RAND_meth = RAND_SSLeay();
108 if(FIPS_mode())
109 default_RAND_meth=FIPS_rand_method();
110 else
111#endif
112 default_RAND_meth = RAND_SSLeay();
113 } 118 }
114
115#ifdef OPENSSL_FIPS
116 if(FIPS_mode()
117 && default_RAND_meth != FIPS_rand_check())
118 {
119 RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD);
120 return 0;
121 }
122#endif
123 return default_RAND_meth; 119 return default_RAND_meth;
124 } 120 }
125 121