From: Jamie Iles Date: Tue, 13 Dec 2011 09:54:06 +0000 (+0000) Subject: crypto: picoxcell - fix boolean and / or confusion X-Git-Tag: v3.12-rc1~3768^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9c57a9c6afb41951aa08317d0cd65a66aed38df;p=kernel%2Fkernel-generic.git crypto: picoxcell - fix boolean and / or confusion The AES engine only supports 128 and 256 bit keys so we should correctly test for that. Cc: Herbert Xu Reported-by: Joe Perches Signed-off-by: Jamie Iles Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c index 9b1571c..58480d0 100644 --- a/drivers/crypto/picoxcell_crypto.c +++ b/drivers/crypto/picoxcell_crypto.c @@ -873,7 +873,7 @@ static int spacc_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, * request for any other size (192 bits) then we need to do a software * fallback. */ - if ((len != AES_KEYSIZE_128 || len != AES_KEYSIZE_256) && + if (len != AES_KEYSIZE_128 && len != AES_KEYSIZE_256 && ctx->sw_cipher) { /* * Set the fallback transform to use the same request flags as @@ -886,7 +886,7 @@ static int spacc_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, err = crypto_ablkcipher_setkey(ctx->sw_cipher, key, len); if (err) goto sw_setkey_failed; - } else if ((len != AES_KEYSIZE_128 || len != AES_KEYSIZE_256) && + } else if (len != AES_KEYSIZE_128 && len != AES_KEYSIZE_256 && !ctx->sw_cipher) err = -EINVAL;