diff options
author | tb <> | 2023-11-13 11:50:36 +0000 |
---|---|---|
committer | tb <> | 2023-11-13 11:50:36 +0000 |
commit | 2f9d36664b1e1e726bc2189bd637f33c3831b13c (patch) | |
tree | 89ad7959afd0d8aa7a39a24e885a09a47d8d14e3 /src/usr.bin/openssl/x509.c | |
parent | d306b9356b221330750c510985702219a7cdcdf6 (diff) | |
download | openbsd-2f9d36664b1e1e726bc2189bd637f33c3831b13c.tar.gz openbsd-2f9d36664b1e1e726bc2189bd637f33c3831b13c.tar.bz2 openbsd-2f9d36664b1e1e726bc2189bd637f33c3831b13c.zip |
Check notBefore/notAfter validity with ASN1_TIME_to_tm(3)
ok beck
Diffstat (limited to 'src/usr.bin/openssl/x509.c')
-rw-r--r-- | src/usr.bin/openssl/x509.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/usr.bin/openssl/x509.c b/src/usr.bin/openssl/x509.c index 7c8f34f64c..8e8a9f2dc3 100644 --- a/src/usr.bin/openssl/x509.c +++ b/src/usr.bin/openssl/x509.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509.c,v 1.33 2023/04/14 06:47:07 tb Exp $ */ | 1 | /* $OpenBSD: x509.c,v 1.34 2023/11/13 11:50:36 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1156,8 +1156,7 @@ x509_main(int argc, char **argv) | |||
1156 | ASN1_TIME *nB = X509_get_notBefore(x); | 1156 | ASN1_TIME *nB = X509_get_notBefore(x); |
1157 | 1157 | ||
1158 | BIO_puts(STDout, "notBefore="); | 1158 | BIO_puts(STDout, "notBefore="); |
1159 | if (ASN1_time_parse(nB->data, nB->length, NULL, | 1159 | if (!ASN1_TIME_to_tm(nB, NULL)) |
1160 | 0) == -1) | ||
1161 | BIO_puts(STDout, | 1160 | BIO_puts(STDout, |
1162 | "INVALID RFC5280 TIME"); | 1161 | "INVALID RFC5280 TIME"); |
1163 | else | 1162 | else |
@@ -1167,8 +1166,7 @@ x509_main(int argc, char **argv) | |||
1167 | ASN1_TIME *nA = X509_get_notAfter(x); | 1166 | ASN1_TIME *nA = X509_get_notAfter(x); |
1168 | 1167 | ||
1169 | BIO_puts(STDout, "notAfter="); | 1168 | BIO_puts(STDout, "notAfter="); |
1170 | if (ASN1_time_parse(nA->data, nA->length, NULL, | 1169 | if (!ASN1_TIME_to_tm(nA, NULL)) |
1171 | 0) == -1) | ||
1172 | BIO_puts(STDout, | 1170 | BIO_puts(STDout, |
1173 | "INVALID RFC5280 TIME"); | 1171 | "INVALID RFC5280 TIME"); |
1174 | else | 1172 | else |