X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=fips%2Frand%2Ffips_rand.c;h=cb9184e1f7a2bf9575262c6fbd8844ef99241275;hp=f8de94291dc73bacc5186d0aa9db13b24d5c1b55;hb=ad4784953d6d79484204a8bb8243be73a6e9aa98;hpb=6b7be581e52761b2a0dc5dcf35214ff813b9f9f0 diff --git a/fips/rand/fips_rand.c b/fips/rand/fips_rand.c index f8de94291d..cb9184e1f7 100644 --- a/fips/rand/fips_rand.c +++ b/fips/rand/fips_rand.c @@ -136,7 +136,11 @@ static void fips_rand_prng_reset(FIPS_PRNG_CTX *ctx) static int fips_set_prng_key(FIPS_PRNG_CTX *ctx, const unsigned char *key, unsigned int keylen) { - FIPS_selftest_check(); + if (FIPS_selftest_failed()) + { + FIPSerr(FIPS_F_FIPS_SET_PRNG_KEY, FIPS_R_SELFTEST_FAILED); + return 0; + } if (keylen != 16 && keylen != 24 && keylen != 32) { /* error: invalid key size */