X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fo_fips.c;h=f6d1b21855ce54e2905ff4004ee698f6f3ae1436;hb=0bb37c5e235a6bfdf916433107f6a2ba865595f4;hp=a57a02b07028edd38fcc6da878eadb07952dfd4f;hpb=f98d2e5cc13a42c39b2adb6771878ab8157e1fe4;p=oweals%2Fopenssl.git diff --git a/crypto/o_fips.c b/crypto/o_fips.c index a57a02b070..f6d1b21855 100644 --- a/crypto/o_fips.c +++ b/crypto/o_fips.c @@ -58,10 +58,13 @@ #include "cryptlib.h" #ifdef OPENSSL_FIPS #include +#include +#include #endif int FIPS_mode(void) { + OPENSSL_init(); #ifdef OPENSSL_FIPS return FIPS_module_mode(); #else @@ -71,8 +74,18 @@ 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;