From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A23F121105 for ; Thu, 5 Oct 2023 14:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 7B1A62800BBF3; Thu, 5 Oct 2023 16:04:47 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 662DD4DD3BE; Thu, 5 Oct 2023 16:04:47 +0200 (CEST) Date: Thu, 5 Oct 2023 16:04:47 +0200 From: Lukas Wunner To: Jonathan Cameron Cc: Bjorn Helgaas , David Howells , David Woodhouse , Herbert Xu , "David S. Miller" , Alex Williamson , linux-pci@vger.kernel.org, linux-cxl@vger.kernel.org, linux-coco@lists.linux.dev, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, kvm@vger.kernel.org, linuxarm@huawei.com, David Box , Dan Williams , Dave Jiang , "Li, Ming" , Zhi Wang , Alistair Francis , Wilfred Mallawa , Alexey Kardashevskiy , Tom Lendacky , Sean Christopherson , Alexander Graf Subject: Re: [PATCH 09/12] PCI/CMA: Validate Subject Alternative Name in certificates Message-ID: <20231005140447.GA23472@wunner.de> References: <20231003160455.00001a4f@Huawei.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231003160455.00001a4f@Huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Tue, Oct 03, 2023 at 04:04:55PM +0100, Jonathan Cameron wrote: > On Thu, 28 Sep 2023 19:32:39 +0200 Lukas Wunner wrote: > > PCIe r6.1 sec 6.31.3 stipulates requirements for X.509 Leaf Certificates > > presented by devices, in particular the presence of a Subject Alternative > > Name extension with a name that encodes the Vendor ID, Device ID, Device > > Serial Number, etc. > > Lets you do any of > * What you have here > * Reference Integrity Manifest, e.g. see Trusted Computing Group > * A pointer to a location where such a Reference Integrity Manifest can be > obtained. > > So this text feels a little strong though I'm fine with only support the > Subject Alternative Name bit for now. Whoever has one of the other options > can add that support :) I intend to amend the commit message as follows. If anyone believes this is inaccurate, please let me know: Side note: Instead of a Subject Alternative Name, Leaf Certificates may include "a Reference Integrity Manifest, e.g., see Trusted Computing Group" or "a pointer to a location where such a Reference Integrity Manifest can be obtained" (PCIe r6.1 sec 6.31.3). A Reference Integrity Manifest contains "golden" measurements which can be compared to actual measurements retrieved from a device. It serves a different purpose than the Subject Alternative Name, hence it is unclear why the spec says only either of them is necessary. It is also unclear how a Reference Integrity Manifest shall be encoded into a certificate. Ignore the Reference Integrity Manifest requirement until this confusion is resolved by a spec update. > I haven't looked asn.1 recently enough to have any confidence on > a review of that bit... > So, for everything except the asn.1 > Reviewed-by: Jonathan Cameron In case it raises the confidence in that portion of the patch, I have tested it successfully not just with certificates containing a single CMA otherName, but also: - a single otherName with a different OID - multiple otherNames with a mix of CMA and other OIDs - multiple otherNames plus additional unrelated dNSNames - no Subject Alternative Name Getting the IMPLICIT annotations right was a bit nontrivial. It turned out that the existing crypto/asymmetric_keys/x509_akid.asn1 got that wrong as well, so I fixed it up as a byproduct of this series: https://git.kernel.org/herbert/cryptodev-2.6/c/a1e452026e6d The debug experience made me appreciate the kernel's ASN.1 compiler and parser though: Their code is surprisingly small, the generated output of the compiler is quite readable and the split architecture with a compiler+parser feels much safer than what openssl does. Thanks, Lukas