This would otherwie clash with an upcoming replacement of struct parse.
ok job
-/* $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>
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;
}
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;
}
-/* $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>
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;
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;
* 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;
}
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;
}
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;
}
-/* $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>
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;
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;
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);
}
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);
rc = 1;
out:
- RouteOriginAttestation_free(roa);
+ RouteOriginAttestation_free(roa_asn1);
return rc;
}
-/* $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>
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;
}
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;
}