[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <160751618139.1238376.15173994145507633358.stgit@warthog.procyon.org.uk>
Date: Wed, 09 Dec 2020 12:16:21 +0000
From: David Howells <dhowells@...hat.com>
To: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Cc: Mickaël Salaün <mic@...ux.microsoft.com>,
David Woodhouse <dwmw2@...radead.org>, dhowells@...hat.com,
keyrings@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 15/18] certs: Fix blacklisted hexadecimal hash string check
From: Mickaël Salaün <mic@...ux.microsoft.com>
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@...ux.microsoft.com>
Signed-off-by: David Howells <dhowells@...hat.com>
Cc: David Woodhouse <dwmw2@...radead.org>
---
certs/blacklist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/certs/blacklist.c b/certs/blacklist.c
index 2719fb2fbc1c..a888b934a1cd 100644
--- a/certs/blacklist.c
+++ b/certs/blacklist.c
@@ -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++;
}
Powered by blists - more mailing lists