#include "cryptlib.h"
#ifdef OPENSSL_FIPS
#include <openssl/fips.h>
+#include <openssl/fips_rand.h>
+#include <openssl/rand.h>
#endif
int FIPS_mode(void)
int FIPS_mode_set(int r)
{
+ OPENSSL_init();
#ifdef OPENSSL_FIPS
- return FIPS_module_mode_set(r);
+#ifndef FIPS_AUTH_USER_PASS
+#define FIPS_AUTH_USER_PASS "Default FIPS Crypto User Password"
+#endif
+ if (!FIPS_module_mode_set(r, FIPS_AUTH_USER_PASS))
+ 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;