1
0
Fork 0

certs: Fix blacklisted hexadecimal hash string check

When looking for a blacklisted hash, bin2hex() is used to transform a
binary hash to an ascii (lowercase) hexadecimal string.  This string is
then search for in the description of the keys from the blacklist
keyring.  When adding a key to the blacklist keyring,
blacklist_vet_description() checks the hash prefix and the hexadecimal
string, but not that this string is lowercase.  It is then valid to set
hashes with uppercase hexadecimal, which will be silently ignored by the
kernel.

Add an additional check to blacklist_vet_description() to check that
hexadecimal strings are in lowercase.

Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Ben Boeckel <mathstuf@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
master
Mickaël Salaün 2020-11-20 19:04:18 +01:00 committed by David Howells
parent 0b2d443bf5
commit 84ffbefd65
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ static int blacklist_vet_description(const char *desc)
found_colon:
desc++;
for (; *desc; desc++) {
if (!isxdigit(*desc))
if (!isxdigit(*desc) || isupper(*desc))
return -EINVAL;
n++;
}