Fix regression in ASN1_UTCTIME_cmp_time_t
authorCarl Jackson <carl@avtok.com>
Sat, 31 Jan 2015 10:22:47 +0000 (02:22 -0800)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 15 Mar 2015 19:47:08 +0000 (19:47 +0000)
Previously, ASN1_UTCTIME_cmp_time_t would return 1 if s > t, -1 if
s < t, and 0 if s == t.

This behavior was broken in a refactor [0], resulting in the opposite
time comparison behavior.

[0]: 904348a4922333106b613754136305db229475ea

PR#3706

Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit da27006df06853a33b132133699a7aa9d4277920)

crypto/asn1/a_utctm.c

index 0578c8887486fa2d745eb1f221affbfb5a1a8aa3..724a10be4ed6abb3c43f05d10fcdfcc87d5046d5 100644 (file)
@@ -297,7 +297,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
     if (!OPENSSL_gmtime(&t, &ttm))
         return -2;
 
-    if (!OPENSSL_gmtime_diff(&day, &sec, &stm, &ttm))
+    if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm))
         return -2;
 
     if (day > 0)