-/* $OpenBSD: extern.h,v 1.112 2022/01/22 09:18:48 tb Exp $ */
+/* $OpenBSD: extern.h,v 1.113 2022/01/23 05:59:35 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
const char *, const char *);
int valid_ta(const char *, struct auth_tree *,
const struct cert *);
-int valid_cert(const char *, struct auth_tree *,
- const struct cert *);
-int valid_roa(const char *, struct auth_tree *, struct roa *);
+int valid_cert(const char *, struct auth *, const struct cert *);
+int valid_roa(const char *, struct auth *, struct roa *);
int valid_filehash(int, const char *, size_t);
int valid_uri(const char *, size_t, const char *);
int valid_origin(const char *, const char *);
-/* $OpenBSD: parser.c,v 1.50 2022/01/22 09:18:48 tb Exp $ */
+/* $OpenBSD: parser.c,v 1.51 2022/01/23 05:59:35 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
}
X509_free(x509);
+ roa->talid = a->cert->talid;
+
+ /*
+ * If the ROA isn't valid, we accept it anyway and depend upon
+ * the code around roa_read() to check the "valid" field itself.
+ */
+
+ if (valid_roa(file, a, roa))
+ roa->valid = 1;
+
/*
* Check CRL to figure out the soonest transitive expiry moment
*/
roa->expires = a->cert->expires;
}
- /*
- * If the ROA isn't valid, we accept it anyway and depend upon
- * the code around roa_read() to check the "valid" field itself.
- */
-
- if (valid_roa(file, &auths, roa))
- roa->valid = 1;
-
return roa;
}
cert->talid = a->cert->talid;
- /* Validate the cert to get the parent */
- if (!valid_cert(file, &auths, cert)) {
+ /* Validate the cert */
+ if (!valid_cert(file, a, cert)) {
cert_free(cert);
return NULL;
}
-/* $OpenBSD: validate.c,v 1.26 2022/01/22 09:18:48 tb Exp $ */
+/* $OpenBSD: validate.c,v 1.27 2022/01/23 05:59:35 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Returns 1 if valid, 0 otherwise.
*/
int
-valid_cert(const char *fn, struct auth_tree *auths, const struct cert *cert)
+valid_cert(const char *fn, struct auth *a, const struct cert *cert)
{
- struct auth *a;
size_t i;
uint32_t min, max;
char buf1[64], buf2[64];
- a = valid_ski_aki(fn, auths, cert->ski, cert->aki);
- if (a == NULL)
- return 0;
-
for (i = 0; i < cert->asz; i++) {
if (cert->as[i].type == CERT_AS_INHERIT) {
if (cert->purpose == CERT_PURPOSE_BGPSEC_ROUTER)
* Returns 1 if valid, 0 otherwise.
*/
int
-valid_roa(const char *fn, struct auth_tree *auths, struct roa *roa)
+valid_roa(const char *fn, struct auth *a, struct roa *roa)
{
- struct auth *a;
size_t i;
char buf[64];
- a = valid_ski_aki(fn, auths, roa->ski, roa->aki);
- if (a == NULL)
- return 0;
-
- roa->talid = a->cert->talid;
for (i = 0; i < roa->ipsz; i++) {
if (valid_ip(a, roa->ips[i].afi, roa->ips[i].min,