Commit f535e1c3 authored by Horia Geantă's avatar Horia Geantă Committed by Greg Kroah-Hartman

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

commit 3a488aae upstream.

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: default avatarGilad Ben-Yossef <>
Signed-off-by: default avatarHoria Geantă <>
Signed-off-by: default avatarHerbert Xu <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 9ed3135c
This diff is collapsed.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment