Skip to content
Commit bc8413b6 authored by Horia Geantă's avatar Horia Geantă Committed by Greg Kroah-Hartman
Browse files

crypto: caam/qi2 - fix chacha20 data size error

commit 3a5a9e1e upstream.

HW generates a Data Size error for chacha20 requests that are not
a multiple of 64B, since algorithm state (AS) does not have
the FINAL bit set.

Since updating req->iv (for chaining) is not required,
modify skcipher descriptors to set the FINAL bit for chacha20.

[Note that for skcipher decryption we know that ctx1_iv_off is 0,
which allows for an optimization by not checking algorithm type,
since append_dec_op1() sets FINAL bit for all algorithms except AES.]

Also drop the descriptor operations that save the IV.
However, in order to keep code logic simple, things like
S/G tables generation etc. are not touched.

Cc: <stable@vger.kernel.org> # v5.3+
Fixes: 334d37c9

 ("crypto: caam - update IV using HW support")
Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
Tested-by: default avatarValentin Ciocoi Radulescu <valentin.ciocoi@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07378b09
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment