diff options
author | tb <> | 2023-11-13 11:46:24 +0000 |
---|---|---|
committer | tb <> | 2023-11-13 11:46:24 +0000 |
commit | d306b9356b221330750c510985702219a7cdcdf6 (patch) | |
tree | 3d5d2fe3f2894ce4ff27a15e42d0720abf5f616a | |
parent | 3a6c6bb62f6a38d2bc68b62b05a058d563919aff (diff) | |
download | openbsd-d306b9356b221330750c510985702219a7cdcdf6.tar.gz openbsd-d306b9356b221330750c510985702219a7cdcdf6.tar.bz2 openbsd-d306b9356b221330750c510985702219a7cdcdf6.zip |
Replace ASN1_time_parse() with ASN1_TIME_to_tm()
Like in libtls, we use ASN1_GENERALIZEDTIME_check() to ensure we actually
have a GeneralizedTime.
ok beck
-rw-r--r-- | src/usr.sbin/ocspcheck/ocspcheck.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/usr.sbin/ocspcheck/ocspcheck.c b/src/usr.sbin/ocspcheck/ocspcheck.c index 516642b53f..234f3d22f6 100644 --- a/src/usr.sbin/ocspcheck/ocspcheck.c +++ b/src/usr.sbin/ocspcheck/ocspcheck.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ocspcheck.c,v 1.31 2022/12/28 21:30:17 jmc Exp $ */ | 1 | /* $OpenBSD: ocspcheck.c,v 1.32 2023/11/13 11:46:24 tb Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2017,2020 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2017,2020 Bob Beck <beck@openbsd.org> |
@@ -189,8 +189,9 @@ parse_ocsp_time(ASN1_GENERALIZEDTIME *gt) | |||
189 | if (gt == NULL) | 189 | if (gt == NULL) |
190 | return -1; | 190 | return -1; |
191 | /* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */ | 191 | /* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */ |
192 | if (ASN1_time_parse(gt->data, gt->length, &tm, | 192 | if (!ASN1_GENERALIZEDTIME_check(gt)) |
193 | V_ASN1_GENERALIZEDTIME) == -1) | 193 | return -1; |
194 | if (!ASN1_TIME_to_tm(gt, &tm)) | ||
194 | return -1; | 195 | return -1; |
195 | if ((rv = timegm(&tm)) == -1) | 196 | if ((rv = timegm(&tm)) == -1) |
196 | return -1; | 197 | return -1; |