lkml.org 
[lkml]   [2020]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.5 303/542] crypto: artpec6 - return correct error code for failed setkey()
    Date
    From: Eric Biggers <ebiggers@google.com>

    [ Upstream commit b828f905904cd76424230c69741a4cabb0174168 ]

    ->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@axis.com>
    Cc: Lars Persson <lars.persson@axis.com>
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Acked-by: Lars Persson <lars.persson@axis.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 4b20606983a43..22ebe40f09f53 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.20.1
    \
     
     \ /
      Last update: 2020-02-14 16:55    [W:3.060 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site