From 372c5a7d070d26ae5777e72e5403b62d9f0da99e Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 16 Aug 2005 18:59:00 +0000 Subject: Check key size for rijndael, as invalid key size can lead to kernel panic. It checked other algorithms against this bug and it seems they aren't affected. Reported by: Mike Tancsa PR: i386/84860 Reviewed by: phk, cperciva(x2) --- sys/opencrypto/xform.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/opencrypto') diff --git a/sys/opencrypto/xform.c b/sys/opencrypto/xform.c index 5dfb317..a24d6da 100644 --- a/sys/opencrypto/xform.c +++ b/sys/opencrypto/xform.c @@ -512,6 +512,8 @@ rijndael128_setkey(u_int8_t **sched, u_int8_t *key, int len) { int err; + if (len != 16 && len != 24 && len != 32) + return (EINVAL); MALLOC(*sched, u_int8_t *, sizeof(rijndael_ctx), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (*sched != NULL) { -- cgit v1.1