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.5.1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b26169aa2a3651da83a6987106cf5f25bf5b7123;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); }