Set rand method in FIPS_mode_set() not in rand library.

This commit is contained in:
Dr. Stephen Henson
2011-06-13 21:18:00 +00:00
parent 0ede2af7a0
commit b0b3d09063
2 changed files with 10 additions and 13 deletions

View File

@@ -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;