From 5ab9a20e2929fe5810c63252b932bd534abb593c Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 20 Apr 2012 17:19:51 +0200 Subject: crypto: Optimize RSA private key handling by using extra redundant information as part of the key that will speed things up for OpenSSL. Affects rsa_sign, rsa_private_encrypt and rsa_private_decrypt. --- lib/crypto/doc/src/crypto.xml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lib/crypto/doc') diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 8cb893cd1c..19db6c9dd4 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -870,10 +870,15 @@ Mpint() = >]]> Sign the data using rsa with the given key. Data = Mpint - Key = [E, N, D] + Key = [E, N, D] | [E, N, D, P1, P2, E1, E2, C] E, N, D = Mpint Where E is the public exponent, N is public modulus and D is the private exponent. + P1, P2, E1, E2, C = Mpint + The longer key format contains redundant information that will make + the calculation faster. P1,P2 are first and second prime factors. + E1,E2 are first and second exponents. C is the CRT coefficient. + Terminology is taken from RFC 3447. DigestType = md5 | sha The default DigestType is sha. Mpint = binary() @@ -943,10 +948,15 @@ Mpint() = >]]> Decrypts ChipherText using the private Key. ChipherText = binary() - PrivateKey = [E, N, D] + PrivateKey = [E, N, D] | [E, N, D, P1, P2, E1, E2, C] E, N, D = Mpint Where E is the public exponent, N is public modulus and D is the private exponent. + P1, P2, E1, E2, C = Mpint + The longer key format contains redundant information that will make + the calculation faster. P1,P2 are first and second prime factors. + E1,E2 are first and second exponents. C is the CRT coefficient. + Terminology is taken from RFC 3447. Padding = rsa_pkcs1_padding | rsa_pkcs1_oaep_padding | rsa_no_padding PlainText = binary() @@ -965,10 +975,15 @@ Mpint() = >]]> Encrypts Msg using the private Key. PlainText = binary() - PrivateKey = [E, N, D] - E, N, D = Mpint + PrivateKey = [E, N, D] | [E, N, D, P1, P2, E1, E2, C] + E, N, D = Mpint Where E is the public exponent, N is public modulus and D is the private exponent. + P1, P2, E1, E2, C = Mpint + The longer key format contains redundant information that will make + the calculation faster. P1,P2 are first and second prime factors. + E1,E2 are first and second exponents. C is the CRT coefficient. + Terminology is taken from RFC 3447. Padding = rsa_pkcs1_padding | rsa_no_padding ChipherText = binary() -- cgit v1.2.3