summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorTodd Short <tshort@akamai.com>2017-02-16 16:08:02 -0500
committerRichard Levitte <levitte@openssl.org>2017-05-02 10:43:09 +0200
commitd2335f30970ed3edc1c7c11700ab7f34396cf086 (patch)
tree432ee6600ae49aebba1cb4fd78d34ee1e3b6f2d6 /crypto/asn1
parent13f70ae2a9734b8eedea337aa947a75d27ed8320 (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: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3335) (cherry picked from commit ae32742e3db45a19aead2c42e30072882492be1d)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_gentm.c2
-rw-r--r--crypto/asn1/a_utctm.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c
index fa76dcac91..8511813785 100644
--- a/crypto/asn1/a_gentm.c
+++ b/crypto/asn1/a_gentm.c
@@ -202,7 +202,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 724a10be4e..0344482cc2 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -172,7 +172,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;