From: David Howells <dhowells@redhat.com>
To: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= <mic@digikod.net>
Cc: dhowells@redhat.com, "David Woodhouse" <dwmw2@infradead.org>,
"Jarkko Sakkinen" <jarkko@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
"Eric Snowberg" <eric.snowberg@oracle.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"James Morris" <jmorris@namei.org>,
=?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= <mic@linux.microsoft.com>,
"Mimi Zohar" <zohar@linux.ibm.com>,
"Serge E . Hallyn" <serge@hallyn.com>,
"Tyler Hicks" <tyhicks@linux.microsoft.com>,
keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH v7 3/5] certs: Make blacklist_vet_description() more strict
Date: Wed, 20 Apr 2022 11:29:08 +0100 [thread overview]
Message-ID: <648218.1650450548@warthog.procyon.org.uk> (raw)
In-Reply-To: <20210312171232.2681989-4-mic@digikod.net>
Mickaël Salaün <mic@digikod.net> wrote:
> + /* The following algorithm only works if prefix lengths match. */
> + BUILD_BUG_ON(sizeof(tbs_prefix) != sizeof(bin_prefix));
> + prefix_len = sizeof(tbs_prefix) - 1;
> + for (i = 0; *desc; desc++, i++) {
> + if (*desc == ':') {
> + if (tbs_step == prefix_len)
> + goto found_colon;
> + if (bin_step == prefix_len)
> + goto found_colon;
> + return -EINVAL;
> + }
> + if (i >= prefix_len)
> + return -EINVAL;
> + if (*desc == tbs_prefix[i])
> + tbs_step++;
> + if (*desc == bin_prefix[i])
> + bin_step++;
> + }
I wonder if:
static const char tbs_prefix[] = "tbs:";
static const char bin_prefix[] = "bin:";
if (strncmp(desc, tbs_prefix, sizeof(tbs_prefix) - 1) == 0 ||
strncmp(desc, bin_prefix, sizeof(bin_prefix) - 1) == 0)
goto found_colon;
might be better.
David
next prev parent reply other threads:[~2022-04-20 10:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 17:12 [PATCH v7 0/5] Enable root to update the blacklist keyring Mickaël Salaün
2021-03-12 17:12 ` [PATCH v7 1/5] tools/certs: Add print-cert-tbs-hash.sh Mickaël Salaün
2021-03-15 16:57 ` Eric Snowberg
2021-03-12 17:12 ` [PATCH v7 2/5] certs: Check that builtin blacklist hashes are valid Mickaël Salaün
2021-03-13 18:53 ` Jarkko Sakkinen
2021-03-12 17:12 ` [PATCH v7 3/5] certs: Make blacklist_vet_description() more strict Mickaël Salaün
2021-03-12 17:12 ` [PATCH v7 4/5] certs: Factor out the blacklist hash creation Mickaël Salaün
2021-03-13 18:54 ` Jarkko Sakkinen
2021-03-12 17:12 ` [PATCH v7 5/5] certs: Allow root user to append signed hashes to the blacklist keyring Mickaël Salaün
2021-03-15 16:59 ` Eric Snowberg
2021-03-15 18:01 ` Mickaël Salaün
2021-03-17 14:48 ` Eric Snowberg
2021-03-17 15:45 ` Mickaël Salaün
2021-03-25 11:36 ` [PATCH v7 0/5] Enable root to update " Mickaël Salaün
2021-04-07 17:21 ` Mickaël Salaün
2021-05-04 10:31 ` Mickaël Salaün
2022-04-20 10:29 ` David Howells [this message]
2022-04-21 15:12 ` [PATCH v7 3/5] certs: Make blacklist_vet_description() more strict Jarkko Sakkinen
2022-04-21 15:27 ` Mickaël Salaün
2022-04-21 15:57 ` Jarkko Sakkinen
2022-04-21 17:29 ` Mickaël Salaün
2022-04-22 8:54 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=648218.1650450548@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=davem@davemloft.net \
--cc=dwmw2@infradead.org \
--cc=eric.snowberg@oracle.com \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=mic@linux.microsoft.com \
--cc=serge@hallyn.com \
--cc=tyhicks@linux.microsoft.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).