summaryrefslogtreecommitdiffstats
path: root/crypto/o_fips.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-06-13 21:18:00 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-06-13 21:18:00 +0000
commitb0b3d09063275680d9ad78568660d6c4357d61d6 (patch)
tree224e626ad4dd0a3f3afc5909785ecbfc22ada418 /crypto/o_fips.c
parent0ede2af7a0d7f3c9a43f50c529ad9aae480150fb (diff)
Set rand method in FIPS_mode_set() not in rand library.
Diffstat (limited to 'crypto/o_fips.c')
-rw-r--r--crypto/o_fips.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/o_fips.c b/crypto/o_fips.c
index a57a02b070..9474a0d9af 100644
--- a/crypto/o_fips.c
+++ b/crypto/o_fips.c
@@ -58,6 +58,8 @@
#include "cryptlib.h"
#ifdef OPENSSL_FIPS
#include <openssl/fips.h>
+#include <openssl/fips_rand.h>
+#include <openssl/rand.h>
#endif
int FIPS_mode(void)
@@ -71,8 +73,15 @@ int FIPS_mode(void)
int FIPS_mode_set(int r)
{
+ OPENSSL_init();
#ifdef OPENSSL_FIPS
- return FIPS_module_mode_set(r);
+ if (!FIPS_module_mode_set(r))
+ return 0;
+ if (r)
+ RAND_set_rand_method(FIPS_rand_get_method());
+ else
+ RAND_set_rand_method(NULL);
+ return 1;
#else
if (r == 0)
return 1;