The idea is to catch as many programmer mistakes as possible.
Signed-off-by: George Spelvin <[email protected]>
---
crypto/testmgr.c | 5 +++++
1 file changed, 5 insertions(+)
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);
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html