The branch OpenSSL_1_0_2-stable has been updated
       via  67567b221bd06aca1719c926fadc5ce1a0452e9a (commit)
      from  82d8cec06ae8af5dbe68c8e4be38ad32ce9fa594 (commit)


- Log -----------------------------------------------------------------
commit 67567b221bd06aca1719c926fadc5ce1a0452e9a
Author: Emilia Kasper <[email protected]>
Date:   Mon Dec 18 18:41:05 2017 +0100

    X509_cmp_time: only return 1, 0, -1.
    
    The behaviour of X509_cmp_time used to be undocumented.
    
    The new behaviour, documented in master, is to return only 0, 1, or -1.
    Make the code in the other branches to adhere to this behaviour too,
    to reduce confusion. There is nothing to be gained from returning
    other values.
    
    Fixes GH#4954
    
    Reviewed-by: Rich Salz <[email protected]>
    Reviewed-by: Tim Hudson <[email protected]>
    Reviewed-by: Richard Levitte <[email protected]>
    (Merged from https://github.com/openssl/openssl/pull/4955)
    
    (cherry picked from commit 48345917747a34feea3da2936994a265c7f2ca11)

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

Summary of changes:
 crypto/x509/x509_vfy.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
index b147201..ff23833 100644
--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -2046,10 +2046,11 @@ int X509_cmp_time(const ASN1_TIME *ctm, time_t 
*cmp_time)
             return 1;
     }
     i = strcmp(buff1, buff2);
-    if (i == 0)                 /* wait a second then return younger :-) */
-        return -1;
-    else
-        return i;
+    /*
+     * X509_cmp_time comparison is <=.
+     * The return value 0 is reserved for errors.
+     */
+    return i > 0 ? 1 : -1;
 }
 
 ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to