From b90662b4b0a6c7b6979a96581388ace7c217b470 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 2 Nov 2023 12:26:50 +1100 Subject: [PATCH] rand uniform: fix likely usage @mspncp noted that the condition should have been likely not unlikely. Reviewed-by: Matthias St. Pierre Reviewed-by: Tom Cosgrove Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/22593) --- crypto/rand/rand_uniform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/rand/rand_uniform.c b/crypto/rand/rand_uniform.c index 26ce3ee560..b9e2635859 100644 --- a/crypto/rand/rand_uniform.c +++ b/crypto/rand/rand_uniform.c @@ -85,7 +85,7 @@ uint32_t ossl_rand_uniform_uint32(OSSL_LIB_CTX *ctx, uint32_t upper, int *err) if (f < f2) return i + 1; /* For not all 1 bits, there is no carry so return the result */ - if (unlikely(f != 0xffffffff)) + if (likely(f != 0xffffffff)) return i; /* setup for the next word of randomness */ f = prod & 0xffffffff; -- 2.34.1