From: Eric Biggers <[email protected]>
->setkey() is supposed to retun -EINVAL for invalid key lengths, not -1.
Fixes: a21eb94fc4d3 ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
Cc: Jesper Nilsson <[email protected]>
Cc: Lars Persson <[email protected]>
Signed-off-by: Eric Biggers <[email protected]>
---
drivers/crypto/axis/artpec6_crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
index 4b20606983a4..22ebe40f09f5 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -1251,7 +1251,7 @@ static int artpec6_crypto_aead_set_key(struct crypto_aead *tfm, const u8 *key,
if (len != 16 && len != 24 && len != 32) {
crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
- return -1;
+ return -EINVAL;
}
ctx->key_length = len;
--
2.24.1
[+Cc the people with Cc tags in the patch, who I accidentally didn't Cc...
Original message was
https://lkml.kernel.org/linux-crypto/[email protected]/]
On Mon, Dec 30, 2019 at 09:19:32PM -0600, Eric Biggers wrote:
> From: Eric Biggers <[email protected]>
>
> ->setkey() is supposed to retun -EINVAL for invalid key lengths, not -1.
>
> Fixes: a21eb94fc4d3 ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
> Cc: Jesper Nilsson <[email protected]>
> Cc: Lars Persson <[email protected]>
> Signed-off-by: Eric Biggers <[email protected]>
> ---
> drivers/crypto/axis/artpec6_crypto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
> index 4b20606983a4..22ebe40f09f5 100644
> --- a/drivers/crypto/axis/artpec6_crypto.c
> +++ b/drivers/crypto/axis/artpec6_crypto.c
> @@ -1251,7 +1251,7 @@ static int artpec6_crypto_aead_set_key(struct crypto_aead *tfm, const u8 *key,
>
> if (len != 16 && len != 24 && len != 32) {
> crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
> - return -1;
> + return -EINVAL;
> }
>
> ctx->key_length = len;
> --
> 2.24.1
>
On 12/31/19 5:43 AM, Eric Biggers wrote:
> [+Cc the people with Cc tags in the patch, who I accidentally didn't Cc...
> ?Original message was
> https://lkml.kernel.org/linux-crypto/[email protected]/]
>
> On Mon, Dec 30, 2019 at 09:19:32PM -0600, Eric Biggers wrote:
>> From: Eric Biggers <[email protected]>
>>
>> ->setkey() is supposed to retun -EINVAL for invalid key lengths, not -1.
>>
>> Fixes: a21eb94fc4d3 ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
>> Cc: Jesper Nilsson <[email protected]>
>> Cc: Lars Persson <[email protected]>
>> Signed-off-by: Eric Biggers <[email protected]>
>> ---
>>? drivers/crypto/axis/artpec6_crypto.c | 2 +-
>>? 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
>> index 4b20606983a4..22ebe40f09f5 100644
>> --- a/drivers/crypto/axis/artpec6_crypto.c
>> +++ b/drivers/crypto/axis/artpec6_crypto.c
>> @@ -1251,7 +1251,7 @@ static int artpec6_crypto_aead_set_key(struct crypto_aead *tfm, const u8 *key,
>>
>>??????? if (len != 16 && len != 24 && len != 32) {
>>??????????????? crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
>> -???????????? return -1;
>> +???????????? return -EINVAL;
>>??????? }
>>
>>??????? ctx->key_length = len;
>> --
>> 2.24.1
>>
Acked-by: Lars Persson <[email protected]>
Thanks,
Lars