Skip to content

Commit 75597e8

Browse files
Eric Biggersgregkh
authored andcommitted
crypto: drbg - Fix returning success on failure in CTR_DRBG
commit 39a31ad upstream. drbg_ctr_generate() sometimes returns success when it fails, leaving the output buffer uninitialized. Fix it. Fixes: cde001e ("crypto: rng - RNGs must return 0 in success case") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ae93c5b commit 75597e8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crypto/drbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ static int drbg_ctr_generate(struct drbg_state *drbg,
603603
if (addtl && !list_empty(addtl)) {
604604
ret = drbg_ctr_update(drbg, addtl, 2);
605605
if (ret)
606-
return 0;
606+
return ret;
607607
}
608608

609609
/* 10.2.1.5.2 step 4.1 */

0 commit comments

Comments
 (0)