diff options
author | tb <> | 2023-11-13 10:56:19 +0000 |
---|---|---|
committer | tb <> | 2023-11-13 10:56:19 +0000 |
commit | 3a6c6bb62f6a38d2bc68b62b05a058d563919aff (patch) | |
tree | 9f8fd5cd49bddc801a8966597d16e2ad40a3fda8 | |
parent | 7bbf74b4a508718799c37fccc2c2c8708e599b8d (diff) | |
download | openbsd-3a6c6bb62f6a38d2bc68b62b05a058d563919aff.tar.gz openbsd-3a6c6bb62f6a38d2bc68b62b05a058d563919aff.tar.bz2 openbsd-3a6c6bb62f6a38d2bc68b62b05a058d563919aff.zip |
Remove last caller of ASN1_time_parse(3) in libtls
This one is slightly annoying since ASN1_TIME_to_tm(3) doesn't provide a
direct check for a GeneralizedTime, so call ASN1_GENERALIZEDTIME_check()
as well. This means LibreSSL parses the time twice. Shrug.
ok beck
-rw-r--r-- | src/lib/libtls/tls_ocsp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libtls/tls_ocsp.c b/src/lib/libtls/tls_ocsp.c index acf6935a52..c7eb3e5986 100644 --- a/src/lib/libtls/tls_ocsp.c +++ b/src/lib/libtls/tls_ocsp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_ocsp.c,v 1.23 2023/05/14 07:26:25 op Exp $ */ | 1 | /* $OpenBSD: tls_ocsp.c,v 1.24 2023/11/13 10:56:19 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Marko Kreen <markokr@gmail.com> | 3 | * Copyright (c) 2015 Marko Kreen <markokr@gmail.com> |
4 | * Copyright (c) 2016 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2016 Bob Beck <beck@openbsd.org> |
@@ -64,8 +64,9 @@ tls_ocsp_asn1_parse_time(struct tls *ctx, ASN1_GENERALIZEDTIME *gt, time_t *gt_t | |||
64 | if (gt == NULL) | 64 | if (gt == NULL) |
65 | return -1; | 65 | return -1; |
66 | /* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */ | 66 | /* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */ |
67 | if (ASN1_time_parse(gt->data, gt->length, &tm, | 67 | if (!ASN1_GENERALIZEDTIME_check(gt)) |
68 | V_ASN1_GENERALIZEDTIME) == -1) | 68 | return -1; |
69 | if (!ASN1_TIME_to_tm(gt, &tm)) | ||
69 | return -1; | 70 | return -1; |
70 | if ((*gt_time = timegm(&tm)) == -1) | 71 | if ((*gt_time = timegm(&tm)) == -1) |
71 | return -1; | 72 | return -1; |