2011-12-13 09:54:12

by Jamie Iles

[permalink] [raw]
Subject: [PATCH] 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 <[email protected]>
Reported-by: Joe Perches <[email protected]>
Signed-off-by: Jamie Iles <[email protected]>
---
drivers/crypto/picoxcell_crypto.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index a2b553e..925cc33 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;

--
1.7.4.1


2011-12-20 07:25:04

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: picoxcell: fix boolean and / or confusion

On Tue, Dec 13, 2011 at 09:54:06AM +0000, Jamie Iles wrote:
> The AES engine only supports 128 and 256 bit keys so we should correctly
> test for that.
>
> Cc: Herbert Xu <[email protected]>
> Reported-by: Joe Perches <[email protected]>
> Signed-off-by: Jamie Iles <[email protected]>

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt