Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp656410pxk; Wed, 16 Sep 2020 13:31:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX+Pt3rRPJ0E/bMaMqVXXUwriaLmGm4i92Nx2qmSzKJixSgetnhcgQ6sgemdVDKTSLJ42D X-Received: by 2002:a05:6402:305a:: with SMTP id bu26mr30205216edb.262.1600288289290; Wed, 16 Sep 2020 13:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600288289; cv=none; d=google.com; s=arc-20160816; b=SjuebpYQaf4yUHkEDe0fnThLQx4sFgblNQ/Ph+ucd6DADTDIjw/vPeLDPtIckUM34z SVdHzepMdLcj8DfgbUzTwGT5bVU4qwLm6MtYgBvYRuKVb7Wvk166+ysxFlzfH/qDEXsm KeJLYcZHEraw1lOG9vo0hXNKHrw7BGzHL5XlARSpU9oLqczbYsUPypa/q/0LzJktq+tn L0Y8TCNODtdcOKfh/nrtQRCl3mr3xkwTYBkZd5u859Wqlmkg51awkI68c3zcBd9B8d/7 AybRUcbNDR0meEs6kzVfnIDQVezuy4LMo/PT8XRzbRWAqap0iUk6gDvTcb4L8I2simyc MRBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=f3dprNdO3HVsJkQR3NoG7tBvVNvr0nAxfOUGA+/SyIg=; b=Q+9qX799Os9UqEEih/4bFvVUuy5jRoeKPLMTEDmIW8x8wqU5K2+nAijWpyzql2FHlH UQ2WjMRU8/lX+fAV4tR+YzrShK+XwqrnDLEahpxwtGrSIqtd/QgT1k8oK9smGXvkDMXg SZ18DOGUt7kpiK9MI6B2n8unC37tQxsnSc52ak/vJAJ/W5/Z8IjcyvX/ark+h9S4VF29 ZjqXaKoy1VIDDq6lQg/AIzzZ9rwz3Cf+zpVBFZr1X7VDqs3o/Vt4oadrY+zMaquJU1ZT YDJEf8JB7GRHBo/41XxLgmTgYC1aLPWIm1v7VZNIP+nq98XkfgoGs5P4ISgdsLHYL6Qw XbLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si12859357edw.38.2020.09.16.13.31.02; Wed, 16 Sep 2020 13:31:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbgIPU2j (ORCPT + 99 others); Wed, 16 Sep 2020 16:28:39 -0400 Received: from mga06.intel.com ([134.134.136.31]:15713 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbgIPRYR (ORCPT ); Wed, 16 Sep 2020 13:24:17 -0400 IronPort-SDR: lDQtUxIFNjuogwTTrnwCLSMGnQ6wKRi6fPMKYDC/yfEJwO4g7e0b2yfYCm6jNCyI/MXB8L0LEh 72SDh5bX8mXQ== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="221058448" X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="221058448" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 09:12:13 -0700 IronPort-SDR: 2vjGeqnxUxN7atVeLloPGSsd1S4TArm4bw6REZOyt7KtQJYUyTucIlnIWqoeBQxkOksVlh6aBQ kGb9t07g4M8A== X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="451916049" Received: from scusackx-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.45.87]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 09:12:10 -0700 Date: Wed, 16 Sep 2020 19:12:08 +0300 From: Jarkko Sakkinen To: Eric Snowberg Cc: dhowells@redhat.com, dwmw2@infradead.org, jmorris@namei.org, serge@hallyn.com, nayna@linux.ibm.com, erichte@linux.ibm.com, mpe@ellerman.id.au, zohar@linux.ibm.com, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, rdunlap@infradead.org Subject: Re: [PATCH v3] certs: Add EFI_CERT_X509_GUID support for dbx entries Message-ID: <20200916161208.GE21026@linux.intel.com> References: <20200911182230.62266-1-eric.snowberg@oracle.com> <20200914181227.GF9369@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 09:42:27AM -0600, Eric Snowberg wrote: > > > On Sep 14, 2020, at 12:12 PM, Jarkko Sakkinen wrote: > > > > On Fri, Sep 11, 2020 at 02:22:30PM -0400, Eric Snowberg wrote: > >> The Secure Boot Forbidden Signature Database, dbx, contains a list of now > >> revoked signatures and keys previously approved to boot with UEFI Secure > >> Boot enabled. The dbx is capable of containing any number of > >> EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID > >> entries. > >> > >> Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are > >> skipped. > >> > >> Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID > >> is found, it is added as an asymmetrical key to the .blacklist keyring. > >> Anytime the .platform keyring is used, the keys in the .blacklist keyring > >> are referenced, if a matching key is found, the key will be rejected. > >> > >> Signed-off-by: Eric Snowberg > >> --- > >> v3: > >> Fixed an issue when CONFIG_PKCS7_MESSAGE_PARSER is not builtin and defined > >> as a module instead, pointed out by Randy Dunlap > >> > >> v2: > >> Fixed build issue reported by kernel test robot > >> Commit message update (suggested by Jarkko Sakkinen) > >> --- > >> certs/blacklist.c | 33 +++++++++++++++++++ > >> certs/blacklist.h | 12 +++++++ > >> certs/system_keyring.c | 6 ++++ > >> include/keys/system_keyring.h | 11 +++++++ > >> .../platform_certs/keyring_handler.c | 11 +++++++ > >> 5 files changed, 73 insertions(+) > >> > >> diff --git a/certs/blacklist.c b/certs/blacklist.c > >> index 6514f9ebc943..3d1514ba5d47 100644 > >> --- a/certs/blacklist.c > >> +++ b/certs/blacklist.c > >> @@ -100,6 +100,39 @@ int mark_hash_blacklisted(const char *hash) > >> return 0; > >> } > >> > >> +int mark_key_revocationlisted(const char *data, size_t size) > >> +{ > >> + key_ref_t key; > >> + > >> + key = key_create_or_update(make_key_ref(blacklist_keyring, true), > >> + "asymmetric", > >> + NULL, > >> + data, > >> + size, > >> + ((KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW), > >> + KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_BUILT_IN); > >> + > >> + if (IS_ERR(key)) { > >> + pr_err("Problem with revocation key (%ld)\n", PTR_ERR(key)); > >> + return PTR_ERR(key); > >> + } > >> + > >> + return 0; > >> +} > >> + > >> +int is_key_revocationlisted(struct pkcs7_message *pkcs7) > >> +{ > >> + int ret; > >> + > >> + ret = validate_trust(pkcs7, blacklist_keyring); > >> + > >> + if (ret == 0) > >> + return -EKEYREJECTED; > >> + > >> + return -ENOKEY; > >> +} > >> +EXPORT_SYMBOL_GPL(is_key_revocationlisted); > > > > Hmm... ignore my previous comment about this. Export symbol is called > > only by system keyring code. > > > > Would be best if the commit message would explicitly reason new exports. > > I don’t see a good reason to keep the export now, I’ll remove it from the > next version. Thanks. OK, great, thanks. Was somewhat puzzled with this for a while :-) /Jarkko