crypto: mxs-dcp - Fix SHA null hashes and output length
authorRadu Solea <radu.solea@nxp.com>
Tue, 2 Oct 2018 19:01:50 +0000 (19:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:20:30 +0000 (08:20 +0100)
commit70ecd0459d0397229b907f3c193687245b2d7743
treef3f525b69cb3c81b403eee1212e0622e70693bf7
parentfef30612e23c3836b38be79bd283db1c2f7dbff8
crypto: mxs-dcp - Fix SHA null hashes and output length

[ Upstream commit c709eebaf5c5faa8a0f140355f9cfe67e8f7afb1 ]

DCP writes at least 32 bytes in the output buffer instead of hash length
as documented. Add intermediate buffer to prevent write out of bounds.

When requested to produce null hashes DCP fails to produce valid output.
Add software workaround to bypass hardware and return valid output.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/mxs-dcp.c