crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input
authorIuliana Prodan <iuliana.prodan@nxp.com>
Thu, 9 May 2019 12:20:50 +0000 (15:20 +0300)
committerIuliana Prodan <iuliana.prodan@nxp.com>
Fri, 10 May 2019 09:47:16 +0000 (12:47 +0300)
commit6a1afc2398cbbe9a7adf33ffd608dbd75fa82753
tree1fa0646edcb55d1b3c792cea29193da8c12971a7
parent3f77e050ca97588c486ecfbedbfe56cd49463e53
crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input

The problem is with the input data size sent to CAAM for encrypt/decrypt.
Pkcs1pad is failing due to pkcs1 padding done in SW starting with0x01
instead of 0x00 0x01.
CAAM expects an input of modulus size. For this we strip the leading
zeros in case the size is more than modulus or pad the input with zeros
until the modulus size is reached.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
drivers/crypto/caam/caampkc.c
drivers/crypto/caam/caampkc.h