Message ID | d1fea6f576325fdcbb03a7dca6df79165f20516f.1417951990.git.linux@horizon.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Herbert Xu |
Headers | show |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 9faf265f..6bf43682 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1459,6 +1459,11 @@ static int test_cprng(struct crypto_rng *tfm, u8 result[32]; for (i = 0; i < tcount; i++) { + if (template[i].rlen > sizeof(result)) { + printk(KERN_CRIT "alg: cprng: Cannot test %s\n", algo); + err = -EOVERFLOW; + break; + } memset(result, 0, sizeof result); err = crypto_rng_reset(tfm, template[i].seed, template[i].slen);
The idea is to catch as many programmer mistakes as possible. Signed-off-by: George Spelvin <linux@horizon.com> --- crypto/testmgr.c | 5 +++++ 1 file changed, 5 insertions(+)