• Eric Biggers's avatar
    crypto: chelsio - fix writing tfm flags to wrong place · 9d9fb930
    Eric Biggers authored
    commit bd56cea0 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: 324429d7
    
     ("chcr: Support for Chelsio's Crypto Hardware")
    Cc: <stable@vger.kernel.org> # v4.9+
    Cc: Atul Gupta <atul.gupta@chelsio.com>
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    9d9fb930
chcr_algo.c 122 KB