• Herbert Xu's avatar
    crypto: rsa-pkcs1pad - Avoid copying output when possible · d858b071
    Herbert Xu authored
    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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    d858b071
rsa-pkcs1pad.c 17.6 KB