-/* $OpenBSD: gbr.c,v 1.26 2023/03/12 11:46:35 tb Exp $ */
+/* $OpenBSD: gbr.c,v 1.27 2023/06/20 12:39:50 job Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
*
gbr_parse(X509 **x509, const char *fn, const unsigned char *der, size_t len)
{
struct parse p;
+ struct cert *cert = NULL;
size_t cmsz;
unsigned char *cms;
time_t signtime = 0;
goto out;
}
+ if ((cert = cert_parse_ee_cert(fn, *x509)) == NULL)
+ goto out;
+
return p.res;
out:
gbr_free(p.res);
X509_free(*x509);
*x509 = NULL;
+ cert_free(cert);
return NULL;
}
-/* $OpenBSD: mft.c,v 1.94 2023/06/07 10:46:34 job Exp $ */
+/* $OpenBSD: mft.c,v 1.95 2023/06/20 12:39:50 job Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
mft_parse(X509 **x509, const char *fn, const unsigned char *der, size_t len)
{
struct parse p;
+ struct cert *cert = NULL;
int rc = 0;
size_t cmsz;
unsigned char *cms;
if (mft_parse_econtent(cms, cmsz, &p) == 0)
goto out;
+ if ((cert = cert_parse_ee_cert(fn, *x509)) == NULL)
+ goto out;
+
if (p.res->signtime > p.res->nextupdate) {
warnx("%s: dating issue: CMS signing-time after MFT nextUpdate",
fn);
*x509 = NULL;
}
free(crldp);
+ cert_free(cert);
free(cms);
return p.res;
}
-/* $OpenBSD: tak.c,v 1.9 2023/06/07 10:46:34 job Exp $ */
+/* $OpenBSD: tak.c,v 1.10 2023/06/20 12:39:50 job Exp $ */
/*
* Copyright (c) 2022 Job Snijders <job@fastly.com>
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
tak_parse(X509 **x509, const char *fn, const unsigned char *der, size_t len)
{
struct parse p;
+ struct cert *cert = NULL;
unsigned char *cms;
size_t cmsz;
time_t signtime = 0;
if (!tak_parse_econtent(cms, cmsz, &p))
goto out;
+ if ((cert = cert_parse_ee_cert(fn, *x509)) == NULL)
+ goto out;
+
if (strcmp(p.res->aki, p.res->current->ski) != 0) {
warnx("%s: current TAKey's SKI does not match EE AKI", fn);
goto out;
X509_free(*x509);
*x509 = NULL;
}
+ cert_free(cert);
free(cms);
return p.res;
}