]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Added check for the return value of the RAND_bytes() function
authorKlavishnik <evg.shtanov@gmail.com>
Thu, 10 Aug 2023 10:56:24 +0000 (13:56 +0300)
committerTomas Mraz <tomas@openssl.org>
Tue, 10 Oct 2023 15:15:54 +0000 (17:15 +0200)
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 <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21706)

apps/speed.c

index 88d389523b3780a18b17a6afddd2d7c39f223b5f..44e3af7591453ec4b769335a0e2e1db18198cca7 100644 (file)
@@ -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);