-/* $OpenBSD: extern.h,v 1.57 2021/03/28 16:22:17 job Exp $ */
+/* $OpenBSD: extern.h,v 1.58 2021/03/29 06:50:44 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
char *x509_get_aia(X509 *, const char *);
char *x509_get_aki(X509 *, int, const char *);
char *x509_get_ski(X509 *, const char *);
-int x509_get_extensions(X509 *, const char *, char **, char **,
- char **);
char *x509_get_crl(X509 *, const char *);
char *x509_crl_get_aki(X509_CRL *, const char *);
-/* $OpenBSD: gbr.c,v 1.8 2021/03/29 06:38:35 tb Exp $ */
+/* $OpenBSD: gbr.c,v 1.9 2021/03/29 06:50:44 tb Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
*
err(1, NULL);
free(cms);
- if (!x509_get_extensions(*x509, fn, &p.res->aia, &p.res->aki,
- &p.res->ski)) {
+ p.res->aia = x509_get_aia(*x509, fn);
+ p.res->aki = x509_get_aki(*x509, 0, fn);
+ p.res->ski = x509_get_ski(*x509, fn);
+ if (p.res->aia == NULL || p.res->aki == NULL || p.res->ski == NULL) {
+ warnx("%s: RFC 6487 section 4.8: "
+ "missing AIA, AKI or SKI X509 extension", fn);
gbr_free(p.res);
X509_free(*x509);
*x509 = NULL;
-/* $OpenBSD: mft.c,v 1.31 2021/03/28 16:22:17 job Exp $ */
+/* $OpenBSD: mft.c,v 1.32 2021/03/29 06:50:44 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
err(1, NULL);
if ((p.res->file = strdup(fn)) == NULL)
err(1, NULL);
- if (!x509_get_extensions(*x509, fn, &p.res->aia, &p.res->aki,
- &p.res->ski))
+
+ p.res->aia = x509_get_aia(*x509, fn);
+ p.res->aki = x509_get_aki(*x509, 0, fn);
+ p.res->ski = x509_get_ski(*x509, fn);
+ if (p.res->aia == NULL || p.res->aki == NULL || p.res->ski == NULL) {
+ warnx("%s: RFC 6487 section 4.8: "
+ "missing AIA, AKI or SKI X509 extension", fn);
goto out;
+ }
/*
* If we're stale, then remove all of the files that the MFT
-/* $OpenBSD: roa.c,v 1.16 2021/03/27 18:12:15 job Exp $ */
+/* $OpenBSD: roa.c,v 1.17 2021/03/29 06:50:44 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
if ((p.res = calloc(1, sizeof(struct roa))) == NULL)
err(1, NULL);
- if (!x509_get_extensions(*x509, fn, &p.res->aia, &p.res->aki,
- &p.res->ski))
+
+ p.res->aia = x509_get_aia(*x509, fn);
+ p.res->aki = x509_get_aki(*x509, 0, fn);
+ p.res->ski = x509_get_ski(*x509, fn);
+ if (p.res->aia == NULL || p.res->aki == NULL || p.res->ski == NULL) {
+ warnx("%s: RFC 6487 section 4.8: "
+ "missing AIA, AKI or SKI X509 extension", fn);
goto out;
+ }
+
if (!roa_parse_econtent(cms, cmsz, &p))
goto out;
-/* $OpenBSD: x509.c,v 1.18 2021/03/29 04:00:38 tb Exp $ */
+/* $OpenBSD: x509.c,v 1.19 2021/03/29 06:50:44 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
return aia;
}
-/*
- * Wraps around x509_get_aia, x509_get_aki, and x509_get_ski.
- * Returns zero on failure (out pointers are NULL) or non-zero on
- * success (out pointers must be freed).
- */
-int
-x509_get_extensions(X509 *x, const char *fn, char **aia, char **aki, char **ski)
-{
- *aia = *aki = *ski = NULL;
-
- *aia = x509_get_aia(x, fn);
- *aki = x509_get_aki(x, 0, fn);
- *ski = x509_get_ski(x, fn);
-
- if (*aia == NULL || *aki == NULL || *ski == NULL) {
- warnx("%s: RFC 6487 section 4.8: "
- "missing AIA, AKI or SKI X509 extension", fn);
- free(*aia);
- free(*aki);
- free(*ski);
- *aia = *aki = *ski = NULL;
- return 0;
- }
-
- return 1;
-}
-
/*
* Parse the very specific subset of information in the CRL distribution
* point extension.