Re: [PATCH 1/3] certs: blacklist: define skid: entries and add is_key_blacklisted()

From: Bruno Meneguele

Date: Thu Dec 03 2026 - 10:22:57 EST


On Wed Dec 2, 2026 at 7:18 PM -03, Mimi Zohar wrote:
On Fri, 2026-11-27 at 14:49 -0300, Bruno Meneguele wrote:
On Fri Nov 6, 2026 at 2:31 PM -03, Mimi Zohar wrote:
> A "tbs:" blacklist entry is only compared against certificates being
> added to a keyring or presented in a signature chain, so it does not
> stop a key that is already loaded from being used as a trust anchor.
>
> Define a new "skid:<hex>" blacklist entry, holding a Subject Key
> Identifier, and add is_key_blacklisted(), which looks up the SKID of an
> asymmetric key in the system blacklist. Entries are added like "tbs:"
> and "bin:" entries and are subject to CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE.
>
> blacklist_vet_description() now uses a prefix table, since the prefixes
> no longer all have the same length. "tbs:" and "bin:" entries behave
> as before.
>
> For example, to add an entry for a certificate (the signed string must
> not include a trailing newline):
>
> skid=$(openssl x509 -in cert.pem -noout -ext subjectKeyIdentifier |
> sed -n '2s/[ :]//gp' | tr A-F a-f)
> printf 'skid:%s' "$skid" > skid.txt
> openssl smime -sign -binary -noattr -in skid.txt -signer signer.crt \
> -inkey signer.key -outform DER -out skid.p7s
> keyctl padd blacklist "skid:$skid" %:.blacklist < skid.p7s
>
> The SKID is also the hex string in the description of the key on a
> keyring, and its last four bytes are the key ID in the security.ima
> xattr, so an entry is easy to correlate with the key it revokes:
>
> # keyctl show %:.ima | grep 073d
> 927946571 --als--v 0 0 \_ asymmetric: test signing key: b7809c3372a07fe87248dcec7ff047a40fb3073d
> # keyctl show %:.blacklist | grep skid
> 1014808518 ----s--v 0 0 \_ blacklist: skid:b7809c3372a07fe87248dcec7ff047a40fb3073d
>
> Signed-off-by: Mimi Zohar <zohar@xxxxxxxxxxxxx>
> ---
> Changelog v1:
> - Addressed Sashiko issues: drop Kconfig change, linking issues when
> blacklist support configured, but without CONFIG_ASYMMETRIC_KEY_TYPE
> configured.
>
> certs/blacklist.c | 83 ++++++++++++++++++++++++-----------
> include/keys/system_keyring.h | 12 +++++
> 2 files changed, 70 insertions(+), 25 deletions(-)
>
> diff --git a/certs/blacklist.c b/certs/blacklist.c
> index fa561c12eabf..9158bd9f9fc9 100644
> --- a/certs/blacklist.c
> +++ b/certs/blacklist.c
> @@ -32,6 +32,7 @@
>
> static const char tbs_prefix[] = "tbs";
> static const char bin_prefix[] = "bin";
> +static const char skid_prefix[] = "skid";
>
> static struct key *blacklist_keyring;
>

Hi Mimi,

the script certs/check-blacklist-hashes.awk needs to be updated to allow "skid:"
hash type too, otherwise build fails with "unknown prefix":

$ echo '"skid:3afbecd5ee1d3d787c61270797e5c85065d030cc"' > certs/blacklist.txt
$ scripts/config --set-str SYSTEM_BLACKLIST_HASH_LIST certs/blacklist.txt
$ make certs/
DESCEND objtool
GEN certs/blacklist_hash_list
Unknown prefix (item 1): skid:3afbecd5ee1d3d787c61270797e5c85065d030cc
make[3]: *** [certs/Makefile:21: certs/blacklist_hash_list] Error 1
make[2]: *** [scripts/Makefile.build:572: certs] Error 2
make[1]: *** [/home/brdeoliv/git/linux/Makefile:2244: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2

It seems to be just a single line of code and the file documentation:

- if (!match(part1[1], "^(tbs|bin):(.*)$", part2)) {
+ if (!match(part1[1], "^(tbs|bin|skid):(.*)$", part2)) {

At the same time, I noticed you also dropped the Kconfig documentation change
for CONFIG_SYSTEM_BLACKLIST_HASH_LIST when you fixed Sashiko's report.

Based on Sashiko's comment, either drop the documentation change making the code
self consistent or, as you suggested, update the script to fully support "skid:"
rules like "tbs:" and "bin:".

Either way is acceptable, at least to me.


Ok, I see your point: SKID it not really a hash to be added through
BLACKLIST_HASH_LIST like full X.509 is also not supported here. So I'm fine
ack'ing it as-is.

However, to maintain the ability to add entries to blacklist at build time like
we have for binaries, TBS and X.509 (with CONFIG_SYSTEM_REVOCATION_KEYS) it
would be good to have a config option for adding SKID in the same format we have
for hash, not requiring the actual certificate in, e.g., the revocation keys PEM
file.


--
Bruno Meneguele
PGP Key: http://bmeneg.com/pubkey.txt

Attachment: signature.asc
Description: PGP signature