diff options
author | Todd Short <tshort@akamai.com> | 2017-02-16 16:08:02 -0500 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-05-02 10:38:54 +0200 |
commit | 20ee2bf138323c6688b6e8d71d695cf2bd53f857 (patch) | |
tree | 2b648a3a5c8d1c62ab9607166691db7f5397db14 /crypto/asn1 | |
parent | ee6b68ce4c67870f9323d2a380eb949f447c56ee (diff) |
Fix time offset calculation.
ASN1_GENERALIZEDTIME and ASN1_UTCTIME may be specified using offsets,
even though that's not supported within certificates.
To convert the offset time back to GMT, the offsets are supposed to be
subtracted, not added. e.g. 1759-0500 == 2359+0100 == 2259Z.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2654)
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_gentm.c | 2 | ||||
-rw-r--r-- | crypto/asn1/a_utctm.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index c02c8d9acc..ff1b695475 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -101,7 +101,7 @@ int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d) if (a[o] == 'Z') o++; else if ((a[o] == '+') || (a[o] == '-')) { - int offsign = a[o] == '-' ? -1 : 1, offset = 0; + int offsign = a[o] == '-' ? 1 : -1, offset = 0; o++; if (o + 4 > l) goto err; diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index 7916e300ef..9797aa8a1e 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -75,7 +75,7 @@ int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d) if (a[o] == 'Z') o++; else if ((a[o] == '+') || (a[o] == '-')) { - int offsign = a[o] == '-' ? -1 : 1, offset = 0; + int offsign = a[o] == '-' ? 1 : -1, offset = 0; o++; if (o + 4 > l) goto err; |