[Crypto] twofish-flag.patch

From: Thomas DuBuisson
Date: Fri Jul 09 2004 - 12:13:00 EST


Unless there is a good reason for the flag handling to be different in
twofish than in AES or Serpent I think this needs applied. It just sets
the proper flag if someone tries to run twofish_setkey with an improper
key size.

Thomas DuBuisson--- linux-2.6.7/crypto/twofish.c.orig 2004-06-15 22:20:26.000000000 -0700
+++ linux-2.6.7/crypto/twofish.c 2004-07-08 11:03:02.000000000 -0700
@@ -663,7 +663,10 @@ static int twofish_setkey(void *cx, cons

/* Check key length. */
if (key_len != 16 && key_len != 24 && key_len != 32)
+ {
+ *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL; /* unsupported key length */
+ }

/* Compute the first two words of the S vector. The magic numbers are
* the entries of the RS matrix, preprocessed through poly_to_exp. The