Skip to content

Commit

Permalink
Added check for the return value of the RAND_bytes() function
Browse files Browse the repository at this point in the history
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 #21706)

(cherry picked from commit 8d120ae)
  • Loading branch information
Klavishnik authored and t8m committed Oct 10, 2023
1 parent 962c7e0 commit 3ecb534
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -3747,7 +3747,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);
Expand Down

0 comments on commit 3ecb534

Please sign in to comment.