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

crypto: caam - fix IV DMA mapping and updating

commit 115957bb 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 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 allocating extra space in the
ablkcipher_edesc for 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 another temporary buffer.

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

Cc: <> # 4.13+
Fixes: 854b06f7 ("crypto: caam - 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 635ac89e
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