Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-1]: src/crypto/dist/openssl/crypto/rsa Pull up following revisi...



details:   https://anonhg.NetBSD.org/src/rev/d138e6421c48
branches:  netbsd-2-1
changeset: 564214:d138e6421c48
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Sep 08 17:06:18 2006 +0000

description:
Pull up following revision(s) (requested by adrianp in ticket #10690):
        crypto/dist/openssl/crypto/rsa/rsa_sign.c: revision 1.2
Apply patch-CVE-2006-4339.txt
Daniel Bleichenbacher recently described an attack on PKCS #1 v1.5
signatures. If an RSA key with exponent 3 is used it may be possible
to forge a PKCS #1 v1.5 signature signed by that key. Implementations
may incorrectly verify the certificate if they are not checking for
excess data in the RSA exponentiation result of the signature.
Since there are CAs using exponent 3 in wide use, and PKCS #1 v1.5 is
used in X.509 certificates, all software that uses OpenSSL to verify
X.509 certificates is potentially vulnerable, as well as any other use
of PKCS #1 v1.5. This includes software that uses OpenSSL for SSL or
TLS.

diffstat:

 crypto/dist/openssl/crypto/rsa/rsa_sign.c |  17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 7b9e7b00d199 -r d138e6421c48 crypto/dist/openssl/crypto/rsa/rsa_sign.c
--- a/crypto/dist/openssl/crypto/rsa/rsa_sign.c Wed Sep 06 07:00:49 2006 +0000
+++ b/crypto/dist/openssl/crypto/rsa/rsa_sign.c Fri Sep 08 17:06:18 2006 +0000
@@ -185,6 +185,23 @@
                sig=d2i_X509_SIG(NULL,&p,(long)i);
 
                if (sig == NULL) goto err;
+
+               /* Excess data can be used to create forgeries */
+               if(p != s+i)
+                       {
+                       RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+                       goto err;
+                       }
+
+               /* Parameters to the signature algorithm can also be used to
+                  create forgeries */
+               if(sig->algor->parameter
+                  && ASN1_TYPE_get(sig->algor->parameter) != V_ASN1_NULL)
+                       {
+                       RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
+                       goto err;
+                       }
+
                sigtype=OBJ_obj2nid(sig->algor->algorithm);
 
 



Home | Main Index | Thread Index | Old Index