aboutsummaryrefslogtreecommitdiff
path: root/sys/crypto/rijndael/rijndael-alg-fst.c
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2005-08-16 18:59:00 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2005-08-16 18:59:00 +0000
commit36c51ae068a62ed9909c0d71ffdf639f6ddb8a49 (patch)
tree667a1055e89ba718cbf020e12793de0cd3a16ca7 /sys/crypto/rijndael/rijndael-alg-fst.c
parent207377b25e2fcdfee5764aff0e0b9ed40a3fddfe (diff)
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 <mike@sentex.net> PR: i386/84860 Reviewed by: phk, cperciva(x2)
Notes
Notes: svn path=/head/; revision=149143
Diffstat (limited to 'sys/crypto/rijndael/rijndael-alg-fst.c')
-rw-r--r--sys/crypto/rijndael/rijndael-alg-fst.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/crypto/rijndael/rijndael-alg-fst.c b/sys/crypto/rijndael/rijndael-alg-fst.c
index 4f2164f2c1a0..a0eb4fd850cd 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);