[openssl-commits] [openssl] OpenSSL_1_0_1-stable update

Rich Salz rsalz at openssl.org
Fri Oct 9 21:06:37 UTC 2015


The branch OpenSSL_1_0_1-stable has been updated
       via  bfc19297cddd5bc2192c02c7f8896d804b0456cb (commit)
      from  978b5d709a6d7fc75665a837df2ad57fe9653dcf (commit)


- Log -----------------------------------------------------------------
commit bfc19297cddd5bc2192c02c7f8896d804b0456cb
Author: Rich Salz <rsalz at akamai.com>
Date:   Fri Oct 9 14:14:34 2015 -0400

    Avoid SHA1 weakness
    
    In X509_cmp, if cert digest is equal, look at DER of the
    signed part.  This is what master and 1.0.2 already do.
    
    Reviewed-by: Dr. Stephen Henson <steve at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/x509/x509_cmp.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c
index 3c5b717..5792e7f 100644
--- a/crypto/x509/x509_cmp.c
+++ b/crypto/x509/x509_cmp.c
@@ -179,11 +179,24 @@ unsigned long X509_subject_name_hash_old(X509 *x)
  */
 int X509_cmp(const X509 *a, const X509 *b)
 {
+    int rv;
+
     /* ensure hash is valid */
     X509_check_purpose((X509 *)a, -1, 0);
     X509_check_purpose((X509 *)b, -1, 0);
 
-    return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
+    rv = memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
+    if (rv)
+        return rv;
+    /* Check for match against stored encoding too */
+    if (!a->cert_info->enc.modified && !b->cert_info->enc.modified) {
+        rv = (int)(a->cert_info->enc.len - b->cert_info->enc.len);
+        if (rv)
+            return rv;
+        return memcmp(a->cert_info->enc.enc, b->cert_info->enc.enc,
+                      a->cert_info->enc.len);
+    }
+    return rv;
 }
 #endif
 


More information about the openssl-commits mailing list