tools/certs: Add print-cert-tbs-hash.sh
authorMickaël Salaün <mic@linux.microsoft.com>
Mon, 12 Jul 2021 17:03:09 +0000 (19:03 +0200)
committerJarkko Sakkinen <jarkko@kernel.org>
Sun, 20 Feb 2022 23:22:07 +0000 (00:22 +0100)
commita03562af835e9f8932ab635f833b0c6a09fcbb9b
treef0b76e6f6dfe453d0bef24bb9cd5bd49818ce479
parent5454594988d8d49317a3ce33033bb10221f30e27
tools/certs: Add print-cert-tbs-hash.sh

Add a new helper print-cert-tbs-hash.sh to generate a TBSCertificate
hash from a given certificate.  This is useful to generate a blacklist
key description used to forbid loading a specific certificate in a
keyring, or to invalidate a certificate provided by a PKCS#7 file.

This kind of hash formatting is required to populate the file pointed
out by CONFIG_SYSTEM_BLACKLIST_HASH_LIST, but only the kernel code was
available to understand how to effectively create such hash.

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-2-mic@digikod.net
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
MAINTAINERS
tools/certs/print-cert-tbs-hash.sh [new file with mode: 0755]