]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
crypto: chelsio - fix writing tfm flags to wrong place
authorEric Biggers <ebiggers@google.com>
Tue, 31 Dec 2019 03:19:31 +0000 (21:19 -0600)
committerPaolo Pisati <paolo.pisati@canonical.com>
Tue, 4 Feb 2020 09:18:17 +0000 (09:18 +0000)
commit82ece305f42ac775f0db4331a4de2de8c81c4355
tree8bacb91ab851ee0fab9e621f1d9f11b08814ccf1
parent3eb079ce009618a3897501bd086808aea2b6922c
crypto: chelsio - fix writing tfm flags to wrong place

BugLink: https://bugs.launchpad.net/bugs/1861784
commit bd56cea012fc2d6381e8cd3209510ce09f9de8c9 upstream.

The chelsio crypto driver is casting 'struct crypto_aead' directly to
'struct crypto_tfm', which is incorrect because the crypto_tfm isn't the
first field of 'struct crypto_aead'.  Consequently, the calls to
crypto_tfm_set_flags() are modifying some other field in the struct.

Also, the driver is setting CRYPTO_TFM_RES_BAD_KEY_LEN in
->setauthsize(), not just in ->setkey().  This is incorrect since this
flag is for bad key lengths, not for bad authentication tag lengths.

Fix these bugs by removing the broken crypto_tfm_set_flags() calls from
->setauthsize() and by fixing them in ->setkey().

Fixes: 324429d74127 ("chcr: Support for Chelsio's Crypto Hardware")
Cc: <stable@vger.kernel.org> # v4.9+
Cc: Atul Gupta <atul.gupta@chelsio.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/crypto/chelsio/chcr_algo.c