]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: rsa-pkcs1pad - Avoid copying output when possible
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 29 Jun 2016 11:32:28 +0000 (19:32 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 1 Jul 2016 15:45:20 +0000 (23:45 +0800)
commita256b42833b36d953b5d62fad46ea2146b04fe50
tree416d9d206fbcbf0e4a12f8b0ce5e3c1746fa713a
parentbf4b099207469507b11245f7ea24f6e113115dd9
crypto: rsa-pkcs1pad - Avoid copying output when possible

In the vast majority of cases (2^-32 on 32-bit and 2^-64 on 64-bit)
cases, the result from encryption/signing will require no padding.

This patch makes these two operations write their output directly
to the final destination.  Only in the exceedingly rare cases where
fixup is needed to we copy it out and back to add the leading zeroes.

This patch also makes use of the crypto_akcipher_set_crypt API
instead of writing the akcipher request directly.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/rsa-pkcs1pad.c