From: Pauli Date: Wed, 4 Jun 2025 23:50:59 +0000 (+1000) Subject: rand: produce correct return from EVP_RAND_nonce X-Git-Tag: openssl-3.4.2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c97a0bb0bfbe8521674625810f2d3acd3c00d74d;p=thirdparty%2Fopenssl.git rand: produce correct return from EVP_RAND_nonce Reviewed-by: Tom Cosgrove Reviewed-by: Saša Nedvědický Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27766) (cherry picked from commit a2b9120d15073ab596452fc361d01bb26ee13773) --- diff --git a/crypto/evp/evp_rand.c b/crypto/evp/evp_rand.c index 50334042a9c..ac0c01f2ae1 100644 --- a/crypto/evp/evp_rand.c +++ b/crypto/evp/evp_rand.c @@ -646,10 +646,8 @@ static int evp_rand_nonce_locked(EVP_RAND_CTX *ctx, unsigned char *out, { unsigned int str = evp_rand_strength_locked(ctx); - if (ctx->meth->nonce == NULL) - return 0; - if (ctx->meth->nonce(ctx->algctx, out, str, outlen, outlen)) - return 1; + if (ctx->meth->nonce != NULL) + return ctx->meth->nonce(ctx->algctx, out, str, outlen, outlen) > 0; return evp_rand_generate_locked(ctx, out, outlen, str, 0, NULL, 0); }