crypto: picoxcell - fix boolean and / or confusion
authorJamie Iles <jamie@jamieiles.com>
Tue, 13 Dec 2011 09:54:06 +0000 (09:54 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 20 Dec 2011 07:20:05 +0000 (15:20 +0800)
The AES engine only supports 128 and 256 bit keys so we should correctly
test for that.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/picoxcell_crypto.c

index 9b1571c2a5a4dd066216eb1047dd5f75c53c68d1..58480d009324d603c9e78ba081793f4938c087c7 100644 (file)
@@ -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;