]> 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)
commitae74156339882d046f00cca01b86be70dd23ceb8
tree416d9d206fbcbf0e4a12f8b0ce5e3c1746fa713a
parent29800723a0b857ee321c0ba778dbaee09af25a23
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