Skip to content

Commit

Permalink
Fix incorrect check on RAND_bytes_ex() in generate_q_fips186_4()
Browse files Browse the repository at this point in the history
RAND_bytes_ex() can also return 0 on failure. Other callers do check
this correctly. Change the check from <0 to <=0.

Fixes: openssl#20100

CLA: trivial

Reviewed-by: Matthias St. Pierre <[email protected]>
Reviewed-by: Dmitry Belyavskiy <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#20106)
  • Loading branch information
nielsdos authored and t8m committed Jan 23, 2023
1 parent 1d85794 commit a2b01ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/ffc/ffc_params_generate.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static int generate_q_fips186_4(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd,

/* A.1.1.2 Step (5) : generate seed with size seed_len */
if (generate_seed
&& RAND_bytes_ex(libctx, seed, seedlen, 0) < 0)
&& RAND_bytes_ex(libctx, seed, seedlen, 0) <= 0)
goto err;
/*
* A.1.1.2 Step (6) AND
Expand Down

0 comments on commit a2b01ae

Please sign in to comment.