Fix CRL time comparison.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 29 Jul 2016 16:54:52 +0000 (17:54 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 29 Jul 2016 17:47:57 +0000 (18:47 +0100)
Thanks to David Benjamin <davidben@google.com> for reporting this bug.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/x509/x509_vfy.c

index abe9caae13caa27b28720367990887f0e6a5a592..099a4d81bbcd0f4be364fc8f6e58ecee09556801 100644 (file)
@@ -979,7 +979,11 @@ static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
             if (ASN1_TIME_diff(&day, &sec, X509_CRL_get_lastUpdate(best_crl),
                                X509_CRL_get_lastUpdate(crl)) == 0)
                 continue;
-            if (day < 0 || sec <= 0)
+            /*
+             * ASN1_TIME_diff never returns inconsistent signs for |day|
+             * and |sec|.
+             */
+            if (day <= 0 && sec <= 0)
                 continue;
         }
         best_crl = crl;