crypto/fsl: Fix HW accelerated hash commands
authorBreno Lima <breno.lima@nxp.com>
Wed, 17 Jan 2018 12:03:45 +0000 (10:03 -0200)
committerYork Sun <york.sun@nxp.com>
Tue, 23 Jan 2018 19:21:20 +0000 (11:21 -0800)
commitd7af2baa49c60c097d77986f49d7c2db06080c8e
tree327bddb0940eab3f21c1b0a22a15826594f16178
parent6d48d1c4b45fe8d308c45115946a5730b102f3ab
crypto/fsl: Fix HW accelerated hash commands

The hash command function were not flushing the dcache before passing data
to CAAM/DMA and not invalidating the dcache when getting data back.

Due the data cache incoherency, HW accelerated hash commands used to fail
with CAAM errors like "Invalid KEY Command".

Check if pbuf and pout buffers are properly aligned to the cache line size
and flush/invalidate the memory regions to address this issue.

This solution is based in a previous work from Clemens Gruber in
commit 598e9dccc75d ("crypto/fsl: fix BLOB encapsulation and
decapsulation")

Reported-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
common/hash.c
drivers/crypto/fsl/fsl_hash.c