certs: Make blacklist_vet_description() more strict
authorMickaël Salaün <mic@linux.microsoft.com>
Mon, 12 Jul 2021 17:03:11 +0000 (19:03 +0200)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 23 Feb 2022 15:49:06 +0000 (16:49 +0100)
commite1448ba111be90a5111cba233f6ebf1d10e45a30
tree4f9bbdf3303fb34e8d43119ee060719f10d402cf
parenta89d708caec32263df48de5e2402158e55053b68
certs: Make blacklist_vet_description() more strict

Before exposing this new key type to user space, make sure that only
meaningful blacklisted hashes are accepted.  This is also checked for
builtin blacklisted hashes, but a following commit make sure that the
user will notice (at built time) and will fix the configuration if it
already included errors.

Check that a blacklist key description starts with a valid prefix and
then a valid hexadecimal string.

Cc: David Howells <dhowells@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Eric Snowberg <eric.snowberg@oracle.com>
Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20210712170313.884724-4-mic@digikod.net
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
certs/blacklist.c