From: Klavishnik Date: Thu, 10 Aug 2023 10:56:24 +0000 (+0300) Subject: Added check for the return value of the RAND_bytes() function X-Git-Tag: openssl-3.2.0-beta1~104 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d120aef951d7bb7deac0b8b559f8003f5ea6384;p=thirdparty%2Fopenssl.git Added check for the return value of the RAND_bytes() function Call app_bail_out if RAND_bytes() fails. Also changed the output parameter of RAND_bytes() to inp as writing to encrypted output buffer does not make sense. Reviewed-by: Matt Caswell Reviewed-by: Tom Cosgrove Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/21706) --- diff --git a/apps/speed.c b/apps/speed.c index 88d389523b3..44e3af75914 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -4747,7 +4747,8 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single, } else { int pad; - RAND_bytes(out, 16); + if (RAND_bytes(inp, 16) <= 0) + app_bail_out("error setting random bytes\n"); len += 16; aad[11] = (unsigned char)(len >> 8); aad[12] = (unsigned char)(len);