summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_purp.c
diff options
context:
space:
mode:
authortb <>2023-11-13 10:33:00 +0000
committertb <>2023-11-13 10:33:00 +0000
commit934fbb57cd6b0549754b91dafe57b3f63d754fad (patch)
tree1c717e972f99cdd8af5ad4b2f0df134f540e1131 /src/lib/libcrypto/x509/x509_purp.c
parent54397579be0eaf2a12e40fad1823cd1ce3d1f6fc (diff)
downloadopenbsd-934fbb57cd6b0549754b91dafe57b3f63d754fad.tar.gz
openbsd-934fbb57cd6b0549754b91dafe57b3f63d754fad.tar.bz2
openbsd-934fbb57cd6b0549754b91dafe57b3f63d754fad.zip
Eliminate the timegm(3) dependency in libcrypto
timegm(3) is not available on some operating systems we support in portable. We currently use musl's implementation, for which gcc-13 decided to emit warnings (which seem incorrect in general and are irrelevant in this case anyway). Instead of patching this up and diverge from upstream, we can avoid reports about compiler warnings by simply not depending on this function. Rework the caching of notBefore and notAfter by replacing timegm(3) with asn1_time_tm_to_time_t(3). Also make this API properly error checkable since at the time x509v3_cache_extensions(3) is called, nothing is known about the cert, in particular not whether it isn't malformed one way or the other. suggested by and ok beck
Diffstat (limited to 'src/lib/libcrypto/x509/x509_purp.c')
-rw-r--r--src/lib/libcrypto/x509/x509_purp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_purp.c b/src/lib/libcrypto/x509/x509_purp.c
index 0c92dfb19c..999ba639c5 100644
--- a/src/lib/libcrypto/x509/x509_purp.c
+++ b/src/lib/libcrypto/x509/x509_purp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_purp.c,v 1.29 2023/08/18 08:42:41 tb Exp $ */ 1/* $OpenBSD: x509_purp.c,v 1.30 2023/11/13 10:33:00 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -711,7 +711,8 @@ x509v3_cache_extensions_internal(X509 *x)
711 if (!x509_extension_oids_are_unique(x)) 711 if (!x509_extension_oids_are_unique(x))
712 x->ex_flags |= EXFLAG_INVALID; 712 x->ex_flags |= EXFLAG_INVALID;
713 713
714 x509_verify_cert_info_populate(x); 714 if (!x509_verify_cert_info_populate(x))
715 x->ex_flags |= EXFLAG_INVALID;
715 716
716 x->ex_flags |= EXFLAG_SET; 717 x->ex_flags |= EXFLAG_SET;
717} 718}