Re: [PATCH 2/8] crypto: artpec6 - return correct error code for failed setkey()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/20191231031938.241705-3-ebiggers@xxxxxxxxxx/]

On Mon, Dec 30, 2019 at 09:19:32PM -0600, Eric Biggers wrote:
From: Eric Biggers <ebiggers@xxxxxxxxxx>

->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 <jesper.nilsson@xxxxxxxx>
Cc: Lars Persson <lars.persson@xxxxxxxx>
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
  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 <lars.persson@xxxxxxxx>

Thanks,
 Lars



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux