RE: [PATCH v2] crypto: caam/qi2 - fix chacha20 data size error

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

 



> -----Original Message-----
> From: Horia Geantă <horia.geanta@xxxxxxx>
> Sent: Friday, February 28, 2020 08:51
> To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Cc: David S. Miller <davem@xxxxxxxxxxxxx>; Aymen Sghaier
> <aymen.sghaier@xxxxxxx>; Valentin Ciocoi Radulescu
> <valentin.ciocoi@xxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx; dl-linux-imx
> <linux-imx@xxxxxxx>
> Subject: [PATCH v2] crypto: caam/qi2 - fix chacha20 data size error
> 
> 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@xxxxxxxxxxxxxxx> # v5.3+
> Fixes: 334d37c9e263 ("crypto: caam - update IV using HW support")
> Signed-off-by: Horia Geantă <horia.geanta@xxxxxxx>

Tested-by: Valentin Ciocoi Radulescu <valentin.ciocoi@xxxxxxx>

Tested on LX2160ARDB board with cryptodev-2.6 tree:
root@TinyLinux:~# cat /proc/crypto | grep chacha20-caam -A 5
driver       : chacha20-caam-qi2
module       : kernel
priority     : 2000
refcnt       : 1
selftest     : passed
internal     : no





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

  Powered by Linux