Commit 3a488aae authored by Horia Geantă's avatar Horia Geantă Committed by Herbert Xu

crypto: caam/qi - fix IV DMA mapping and updating

There are two IV-related issues:
(1) crypto API does not guarantee to provide an IV buffer that is DMAable,
thus it's incorrect to DMA map it
(2) for in-place decryption, since ciphertext is overwritten with
plaintext, updated IV (req->info) will contain the last block of plaintext
(instead of the last block of ciphertext)

While these two issues could be fixed separately, it's straightforward
to fix both in the same time - by using the {ablkcipher,aead}_edesc
extended descriptor to store the IV that will be fed to the crypto engine;
this allows for fixing (2) by saving req->src[last_block] in req->info
directly, i.e. without allocating yet another temporary buffer.

A side effect of the fix is that it's no longer possible to have the IV
contiguous with req->src or req->dst.
Code checking for this case is removed.

Cc: <> # 4.14+
Fixes: a68a1938 ("crypto: caam/qi - properly set IV after {en,de}crypt")
Link: 's avatarGilad Ben-Yossef <>
Signed-off-by: 's avatarHoria Geantă <>
Signed-off-by: 's avatarHerbert Xu <>
parent 115957bb
This diff is collapsed.
Markdown is supported
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