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/crypto/rijndael/rijndael-alg-fst.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/crypto') diff --git a/sys/crypto/rijndael/rijndael-alg-fst.c b/sys/crypto/rijndael/rijndael-alg-fst.c index 4f2164f..a0eb4fd 100644 --- a/sys/crypto/rijndael/rijndael-alg-fst.c +++ b/sys/crypto/rijndael/rijndael-alg-fst.c @@ -734,6 +734,8 @@ int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBit int i = 0; u32 temp; + KASSERT(keyBits == 128 || keyBits == 192 || keyBits == 256, + ("Invalid key size (%d).", keyBits)); rk[0] = GETU32(cipherKey ); rk[1] = GETU32(cipherKey + 4); rk[2] = GETU32(cipherKey + 8); -- cgit v1.1