-/* $OpenBSD: cert.c,v 1.77 2022/05/11 09:40:00 tb Exp $ */
+/* $OpenBSD: cert.c,v 1.78 2022/05/11 16:13:05 tb Exp $ */
/*
* Copyright (c) 2021 Job Snijders <job@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
goto out;
}
+ /* Cache X509v3 extensions, see X509_check_ca(3). */
+ if (X509_check_purpose(x, -1, -1) <= 0) {
+ cryptowarnx("%s: could not cache X509v3 extensions", p.fn);
+ goto out;
+ }
+
/* Look for X509v3 extensions. */
if ((extsz = X509_get_ext_count(x)) < 0)
-/* $OpenBSD: cms.c,v 1.16 2022/03/28 13:04:01 claudio Exp $ */
+/* $OpenBSD: cms.c,v 1.17 2022/05/11 16:13:05 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
}
*xp = X509_dup(sk_X509_value(certs, 0));
+ /* Cache X509v3 extensions, see X509_check_ca(3). */
+ if (X509_check_purpose(*xp, -1, -1) <= 0) {
+ cryptowarnx("%s: could not cache X509v3 extensions", fn);
+ goto out;
+ }
+
if (CMS_SignerInfo_get0_signer_id(si, &kid, NULL, NULL) != 1 ||
kid == NULL) {
warnx("%s: RFC 6488: could not extract SKI from SID", fn);