]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input
authorIuliana Prodan <iuliana.prodan@nxp.com>
Tue, 28 May 2019 09:52:10 +0000 (12:52 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 6 Jun 2019 06:38:56 +0000 (14:38 +0800)
commit7e5ab491ee75687d479106bfc44e8afc9aba78cf
tree6ebe0b7648ffa47cc5d266754e9bddfdad848def
parent0ecf11617fdeff8f16239d3c3f7cec0f1331c39e
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>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caampkc.c
drivers/crypto/caam/caampkc.h