Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3279689pxb; Tue, 19 Jan 2021 19:48:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJylILL/oTPOXxp7Tis3qA3Ow78uwi7eb9/MOsT98JSqWnzZZGod2Ju32nTvkdyB5XUHp4Yw X-Received: by 2002:a17:906:9381:: with SMTP id l1mr5116918ejx.433.1611114539030; Tue, 19 Jan 2021 19:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611114539; cv=none; d=google.com; s=arc-20160816; b=Uk9XTuAUUXhWUcgWJnqRuWO3glDZnvEFoedHZpIrIYdKt5lyPecQt9BmOkyGi8n38o RT9iUWYJcj+3OdhZ19TVWutFaOPNMighsWd9bA1pHlesB8Juh1jnnCaZ9K2uUWesU+D0 Sb8yFhhPyWvk4UY/JdZKVbVzWQqle5ODZp2HbMnVFzSB+hqReq8jV8fdqYoMAtP09YEg pXVgak5p/o2BcZ6xgPK5OL68rVw7aM8OL1Ump6yFUG/3Wo31wQUXDtlE0GQfwtlZMxE1 3i/bwuXC3GWtUNk3W+YGQJpQhm6c+nPQs31bAo48AxRbkRioTGrfO9cgtMNRGuGVmYZw ZAGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8yjA1PcHVa8dFDAr9npJAa+M+0lkh3par3Z7Znfo0hg=; b=aWnYRRxzS6CEzKqgM9TS6cUjA1BQtWZYzc9DmDJZFs6isdfXjiCPXW3L8sbfnpkQxE PJsjLZYAs10zrdY5Cov3u2NGq9+kev0HO0a4XPzDYFGXDY0OZPxA5QxDCJz4tLMPLJNb n4tVSVIehPkJjEkVU53iM8xqE7Qu4MH75JxB9pkA13HTVQdmwerYRig+YF6Z52h+rw/n H8yc96ltIiHaTsdPsi7KXIGldGSjWO8/CoW9a83NAr+a19w5dHQUxtod2GYF/OfzaPm4 7T6QQAsY3f9/UxgMXaJ4JtBvNR3Cou3IukCkIc8NwqsI5WQ1bYRxPrGQOqnNkA7Dq6fd 5rLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DbaWzIoJ; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c23si259746ejk.52.2021.01.19.19.48.36; Tue, 19 Jan 2021 19:48:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DbaWzIoJ; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729314AbhATDrV (ORCPT + 99 others); Tue, 19 Jan 2021 22:47:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:43752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730603AbhATDoj (ORCPT ); Tue, 19 Jan 2021 22:44:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FD7222573; Wed, 20 Jan 2021 03:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611114238; bh=My3l9mdP5r74fya1/xnAAZLXmhSUL7ojLeSVLOTNDog=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DbaWzIoJzMhGisRPoUJyWfFtTpRHz3vN/9bm/lTku5twZIjB9Tm0kXHc/F+wN7Pvm whx4u6pCfuZkWKtYE+hmDf6AMiqYY5urEf9BgJItbyq7fwDm6DRCrZN0cOxEL2wHoe Pq8KSbQyrbDcIz+EP6UHY4R6Yp+z+KIFJ3n9YH624NHgQ/cH+jPk0FTwCgdVZgS+K4 DrMT0njz10faxAl1TJbxUMpOdsWPQMAGKp/XxpxGRigcidC0222FYZPkESndHKywln QzPVp4UtuhQNrzGWmtnH2PIJaQTxInxuN4GHbve1/Mpbb1VpWaYFGUlzw7IIoiMOml EUser7o/Fa7Ug== Date: Wed, 20 Jan 2021 05:43:52 +0200 From: Jarkko Sakkinen To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: David Howells , David Woodhouse , "David S . Miller" , Herbert Xu , James Morris , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Mimi Zohar , "Serge E . Hallyn" , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Ben Boeckel Subject: Re: [PATCH v3 02/10] certs: Fix blacklisted hexadecimal hash string check Message-ID: References: <20210114151909.2344974-1-mic@digikod.net> <20210114151909.2344974-3-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210114151909.2344974-3-mic@digikod.net> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Jan 14, 2021 at 04:19:01PM +0100, Micka?l Sala?n wrote: > From: Micka?l Sala?n > > 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. > > Cc: David Woodhouse > Signed-off-by: Micka?l Sala?n > Signed-off-by: David Howells > Reviewed-by: Ben Boeckel > --- > > Changes since v2: > * Cherry-pick v1 patch from > https://lore.kernel.org/lkml/2659836.1607940186@warthog.procyon.org.uk/ > to rebase on v5.11-rc3. > * Rearrange Cc order. > --- > 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++; > } > -- > 2.30.0 > Shouldn't this rather convert the upper case to lower case? I don't like the ABI break that this causes. /Jarkko