From: Claudio Jeker Subject: Re: rpki-client: require a single asid in aspa EE cert To: Theo Buehler Cc: tech@openbsd.org Date: Tue, 10 Nov 2026 06:43:24 +0100 On Tue, Nov 10, 2026 at 02:39:35AM +0100, Theo Buehler wrote: > Expose the cert_has_one_as() helper and use it from aspa_cert_info() > to implement a requirement that was added to the spec without matching > change to our implmentation: > > https://github.com/QratorLabs/ASPA/commit/a8d9cba0922f19298a764fa500daf8fe7c8f715f > > Reported by Shreyas S. OK claudio@ > Index: aspa.c > =================================================================== > RCS file: /cvs/src/usr.sbin/rpki-client/aspa.c,v > diff -u -p -r1.48 aspa.c > --- aspa.c 9 Oct 2026 08:36:50 -0000 1.48 > +++ aspa.c 10 Nov 2026 01:19:29 -0000 > @@ -161,6 +161,11 @@ aspa_cert_info(const char *fn, void *obj > return 0; > } > > + if (!cert_has_one_as(cert)) { > + warnx("%s: expected one AS id element in EE cert", fn); > + return 0; > + } > + > if (x509_any_inherits(cert->x509)) { > warnx("%s: inherit elements not allowed in EE cert", fn); > return 0; > Index: cert.c > =================================================================== > RCS file: /cvs/src/usr.sbin/rpki-client/cert.c,v > diff -u -p -r1.253 cert.c > --- cert.c 3 Nov 2026 14:58:42 -0000 1.253 > +++ cert.c 10 Nov 2026 01:16:34 -0000 > @@ -1135,7 +1135,7 @@ cert_as_inherit(const struct cert *cert) > return cert->ases[0].type == CERT_AS_INHERIT; > } > > -static int > +int > cert_has_one_as(const struct cert *cert) > { > if (cert->num_ases != 1) > Index: extern.h > =================================================================== > RCS file: /cvs/src/usr.sbin/rpki-client/extern.h,v > diff -u -p -r1.321 extern.h > --- extern.h 3 Nov 2026 14:58:42 -0000 1.321 > +++ extern.h 10 Nov 2026 01:16:22 -0000 > @@ -779,6 +779,7 @@ struct cert *cert_parse_filemode(const c > struct cert *ta_validate(const char *, struct cert *, const unsigned char *, > size_t); > struct cert *cert_read(struct ibuf *); > +int cert_has_one_as(const struct cert *); > void cert_insert_brks(struct brk_tree *, struct cert *); > > void nca_history_load(void); > -- :wq Claudio