From: Pauli Date: Thu, 2 Nov 2023 01:26:50 +0000 (+1100) Subject: rand uniform: fix likely usage X-Git-Tag: openssl-3.3.0-alpha1~675 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b90662b4b0a6c7b6979a96581388ace7c217b470;p=thirdparty%2Fopenssl.git 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) --- diff --git a/crypto/rand/rand_uniform.c b/crypto/rand/rand_uniform.c index 26ce3ee5605..b9e26358591 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;