]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
rand: pre-fetch JITTER seed when jitter used
authorJakub Zelenka <jakub.zelenka@openssl.foundation>
Mon, 13 Jul 2026 18:50:32 +0000 (20:50 +0200)
committerTomas Mraz <tomas@openssl.foundation>
Wed, 15 Jul 2026 16:18:24 +0000 (18:18 +0200)
This fixes failing rand mfail test when jitter used

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:18:29 2026
(Merged from https://github.com/openssl/openssl/pull/31938)

test/rand_test.c

index e5c889a9e9da1415945fad484d9b680b2d723485..be3313fc6efcd8caf6481b8aa99c29fe773eab58 100644 (file)
 #include "crypto/rand.h"
 #include "testutil.h"
 
+/* For builds where OPENSSL_DEFAULT_SEED_SRC is explicitly set. */
+/* clang-format off */
+#ifndef OPENSSL_DEFAULT_SEED_SRC
+#define OPENSSL_DEFAULT_SEED_SRC SEED-SRC
+#endif
+/* clang-format on */
+
 static char *configfile;
 
 static int test_rand(void)
@@ -312,7 +319,11 @@ static int test_rand_bytes_mfail(int idx)
         goto end;
     /* The default seed source may be unavailable in some configurations */
     ERR_set_mark();
-    seed = EVP_RAND_fetch(ctx, "SEED-SRC", NULL);
+#if !defined(OPENSSL_NO_FIPS_JITTER)
+    seed = EVP_RAND_fetch(ctx, "JITTER", NULL);
+#else
+    seed = EVP_RAND_fetch(ctx, OPENSSL_MSTR(OPENSSL_DEFAULT_SEED_SRC), NULL);
+#endif
     ERR_pop_to_mark();
 
     MFAIL_start();