diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-02-16 15:13:50 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-02-16 15:13:50 +0000 |
commit | 03ea8c5e9e5b8500f0ce420ed698f945e8915972 (patch) | |
tree | 6d9c642885690ee8a33311f93ffe3365c9651f6d | |
parent | 6c053b8a3bb8d806d4b732df641984bfdd78453a (diff) |
Use _asn1 suffix for some aspa/mft/roa/rsc/tak
This would otherwie clash with an upcoming replacement of struct parse.
ok job
-rw-r--r-- | usr.sbin/rpki-client/aspa.c | 14 | ||||
-rw-r--r-- | usr.sbin/rpki-client/mft.c | 39 | ||||
-rw-r--r-- | usr.sbin/rpki-client/roa.c | 16 | ||||
-rw-r--r-- | usr.sbin/rpki-client/tak.c | 20 |
4 files changed, 45 insertions, 44 deletions
diff --git a/usr.sbin/rpki-client/aspa.c b/usr.sbin/rpki-client/aspa.c index a0719889046..294c45b5443 100644 --- a/usr.sbin/rpki-client/aspa.c +++ b/usr.sbin/rpki-client/aspa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aspa.c,v 1.26 2024/02/13 22:44:21 job Exp $ */ +/* $OpenBSD: aspa.c,v 1.27 2024/02/16 15:13:49 tb Exp $ */ /* * Copyright (c) 2022 Job Snijders <job@fastly.com> * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> @@ -132,11 +132,11 @@ static int aspa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) { const unsigned char *oder; - ASProviderAttestation *aspa; + ASProviderAttestation *aspa_asn1; int rc = 0; oder = d; - if ((aspa = d2i_ASProviderAttestation(NULL, &d, dsz)) == NULL) { + if ((aspa_asn1 = d2i_ASProviderAttestation(NULL, &d, dsz)) == NULL) { warnx("%s: ASPA: failed to parse ASProviderAttestation", p->fn); goto out; } @@ -146,20 +146,20 @@ aspa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) goto out; } - if (!valid_econtent_version(p->fn, aspa->version, 1)) + if (!valid_econtent_version(p->fn, aspa_asn1->version, 1)) goto out; - if (!as_id_parse(aspa->customerASID, &p->res->custasid)) { + if (!as_id_parse(aspa_asn1->customerASID, &p->res->custasid)) { warnx("%s: malformed CustomerASID", p->fn); goto out; } - if (!aspa_parse_providers(p, aspa->providers)) + if (!aspa_parse_providers(p, aspa_asn1->providers)) goto out; rc = 1; out: - ASProviderAttestation_free(aspa); + ASProviderAttestation_free(aspa_asn1); return rc; } diff --git a/usr.sbin/rpki-client/mft.c b/usr.sbin/rpki-client/mft.c index 724bbcf7dad..159cc519954 100644 --- a/usr.sbin/rpki-client/mft.c +++ b/usr.sbin/rpki-client/mft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mft.c,v 1.108 2024/02/15 07:01:33 tb Exp $ */ +/* $OpenBSD: mft.c,v 1.109 2024/02/16 15:13:49 tb Exp $ */ /* * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -311,12 +311,12 @@ static int mft_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) { const unsigned char *oder; - Manifest *mft; + Manifest *mft_asn1; FileAndHash *fh; int i, rc = 0; oder = d; - if ((mft = d2i_Manifest(NULL, &d, dsz)) == NULL) { + if ((mft_asn1 = d2i_Manifest(NULL, &d, dsz)) == NULL) { warnx("%s: RFC 6486 section 4: failed to parse Manifest", p->fn); goto out; @@ -327,10 +327,10 @@ mft_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) goto out; } - if (!valid_econtent_version(p->fn, mft->version, 0)) + if (!valid_econtent_version(p->fn, mft_asn1->version, 0)) goto out; - p->res->seqnum = x509_convert_seqnum(p->fn, mft->manifestNumber); + p->res->seqnum = x509_convert_seqnum(p->fn, mft_asn1->manifestNumber); if (p->res->seqnum == NULL) goto out; @@ -338,20 +338,20 @@ mft_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) * OpenSSL's DER decoder implementation will accept a GeneralizedTime * which doesn't conform to RFC 5280. So, double check. */ - if (ASN1_STRING_length(mft->thisUpdate) != GENTIME_LENGTH) { + if (ASN1_STRING_length(mft_asn1->thisUpdate) != GENTIME_LENGTH) { warnx("%s: embedded from time format invalid", p->fn); goto out; } - if (ASN1_STRING_length(mft->nextUpdate) != GENTIME_LENGTH) { + if (ASN1_STRING_length(mft_asn1->nextUpdate) != GENTIME_LENGTH) { warnx("%s: embedded until time format invalid", p->fn); goto out; } - if (!x509_get_time(mft->thisUpdate, &p->res->thisupdate)) { + if (!x509_get_time(mft_asn1->thisUpdate, &p->res->thisupdate)) { warn("%s: parsing manifest thisUpdate failed", p->fn); goto out; } - if (!x509_get_time(mft->nextUpdate, &p->res->nextupdate)) { + if (!x509_get_time(mft_asn1->nextUpdate, &p->res->nextupdate)) { warn("%s: parsing manifest nextUpdate failed", p->fn); goto out; } @@ -361,27 +361,28 @@ mft_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) goto out; } - if (OBJ_obj2nid(mft->fileHashAlg) != NID_sha256) { + if (OBJ_obj2nid(mft_asn1->fileHashAlg) != NID_sha256) { warnx("%s: RFC 6486 section 4.2.1: fileHashAlg: " "want SHA256 object, have %s (NID %d)", p->fn, - ASN1_tag2str(OBJ_obj2nid(mft->fileHashAlg)), - OBJ_obj2nid(mft->fileHashAlg)); + ASN1_tag2str(OBJ_obj2nid(mft_asn1->fileHashAlg)), + OBJ_obj2nid(mft_asn1->fileHashAlg)); goto out; } - if (sk_FileAndHash_num(mft->fileList) >= MAX_MANIFEST_ENTRIES) { + if (sk_FileAndHash_num(mft_asn1->fileList) >= MAX_MANIFEST_ENTRIES) { warnx("%s: %d exceeds manifest entry limit (%d)", p->fn, - sk_FileAndHash_num(mft->fileList), MAX_MANIFEST_ENTRIES); + sk_FileAndHash_num(mft_asn1->fileList), + MAX_MANIFEST_ENTRIES); goto out; } - p->res->files = calloc(sk_FileAndHash_num(mft->fileList), + p->res->files = calloc(sk_FileAndHash_num(mft_asn1->fileList), sizeof(struct mftfile)); if (p->res->files == NULL) err(1, NULL); - for (i = 0; i < sk_FileAndHash_num(mft->fileList); i++) { - fh = sk_FileAndHash_value(mft->fileList, i); + for (i = 0; i < sk_FileAndHash_num(mft_asn1->fileList); i++) { + fh = sk_FileAndHash_value(mft_asn1->fileList, i); if (!mft_parse_filehash(p, fh)) goto out; } @@ -391,12 +392,12 @@ mft_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) goto out; } - if (!mft_has_unique_names_and_hashes(p->fn, mft)) + if (!mft_has_unique_names_and_hashes(p->fn, mft_asn1)) goto out; rc = 1; out: - Manifest_free(mft); + Manifest_free(mft_asn1); return rc; } diff --git a/usr.sbin/rpki-client/roa.c b/usr.sbin/rpki-client/roa.c index ccff67a980c..633c200defc 100644 --- a/usr.sbin/rpki-client/roa.c +++ b/usr.sbin/rpki-client/roa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roa.c,v 1.75 2024/02/16 11:55:42 tb Exp $ */ +/* $OpenBSD: roa.c,v 1.76 2024/02/16 15:13:49 tb Exp $ */ /* * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -106,7 +106,7 @@ static int roa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) { const unsigned char *oder; - RouteOriginAttestation *roa; + RouteOriginAttestation *roa_asn1; const ROAIPAddressFamily *addrfam; const STACK_OF(ROAIPAddress) *addrs; int addrsz, ipv4_seen = 0, ipv6_seen = 0; @@ -119,7 +119,7 @@ roa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) int i, j, rc = 0; oder = d; - if ((roa = d2i_RouteOriginAttestation(NULL, &d, dsz)) == NULL) { + if ((roa_asn1 = d2i_RouteOriginAttestation(NULL, &d, dsz)) == NULL) { warnx("%s: RFC 6482 section 3: failed to parse " "RouteOriginAttestation", p->fn); goto out; @@ -130,16 +130,16 @@ roa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) goto out; } - if (!valid_econtent_version(p->fn, roa->version, 0)) + if (!valid_econtent_version(p->fn, roa_asn1->version, 0)) goto out; - if (!as_id_parse(roa->asid, &p->res->asid)) { + if (!as_id_parse(roa_asn1->asid, &p->res->asid)) { warnx("%s: RFC 6482 section 3.2: asID: " "malformed AS identifier", p->fn); goto out; } - ipaddrblocksz = sk_ROAIPAddressFamily_num(roa->ipAddrBlocks); + ipaddrblocksz = sk_ROAIPAddressFamily_num(roa_asn1->ipAddrBlocks); if (ipaddrblocksz != 1 && ipaddrblocksz != 2) { warnx("%s: draft-rfc6482bis: unexpected number of ipAddrBlocks " "(got %d, expected 1 or 2)", p->fn, ipaddrblocksz); @@ -147,7 +147,7 @@ roa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) } for (i = 0; i < ipaddrblocksz; i++) { - addrfam = sk_ROAIPAddressFamily_value(roa->ipAddrBlocks, i); + addrfam = sk_ROAIPAddressFamily_value(roa_asn1->ipAddrBlocks, i); addrs = addrfam->addresses; addrsz = sk_ROAIPAddress_num(addrs); @@ -233,7 +233,7 @@ roa_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) rc = 1; out: - RouteOriginAttestation_free(roa); + RouteOriginAttestation_free(roa_asn1); return rc; } diff --git a/usr.sbin/rpki-client/tak.c b/usr.sbin/rpki-client/tak.c index 4273b6de675..72a88614455 100644 --- a/usr.sbin/rpki-client/tak.c +++ b/usr.sbin/rpki-client/tak.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tak.c,v 1.17 2024/02/16 05:18:29 tb Exp $ */ +/* $OpenBSD: tak.c,v 1.18 2024/02/16 15:13:49 tb Exp $ */ /* * Copyright (c) 2022 Job Snijders <job@fastly.com> * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> @@ -164,14 +164,14 @@ static int tak_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) { const unsigned char *oder; - TAK *tak; + TAK *tak_asn1; const char *fn; int rc = 0; fn = p->fn; oder = d; - if ((tak = d2i_TAK(NULL, &d, dsz)) == NULL) { + if ((tak_asn1 = d2i_TAK(NULL, &d, dsz)) == NULL) { warnx("%s: failed to parse Trust Anchor Key", fn); goto out; } @@ -181,28 +181,28 @@ tak_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) goto out; } - if (!valid_econtent_version(fn, tak->version, 0)) + if (!valid_econtent_version(fn, tak_asn1->version, 0)) goto out; - p->res->current = parse_takey(fn, tak->current); + p->res->current = parse_takey(fn, tak_asn1->current); if (p->res->current == NULL) goto out; - if (tak->predecessor != NULL) { - p->res->predecessor = parse_takey(fn, tak->predecessor); + if (tak_asn1->predecessor != NULL) { + p->res->predecessor = parse_takey(fn, tak_asn1->predecessor); if (p->res->predecessor == NULL) goto out; } - if (tak->successor != NULL) { - p->res->successor = parse_takey(fn, tak->successor); + if (tak_asn1->successor != NULL) { + p->res->successor = parse_takey(fn, tak_asn1->successor); if (p->res->successor == NULL) goto out; } rc = 1; out: - TAK_free(tak); + TAK_free(tak_asn1); return rc; } |