From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB576FF8865 for ; Mon, 27 Apr 2026 06:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=U/x6CLni2Lznf/8rBHNg/r6T6HvoxT4CEtAmm0nKOZM=; b=CcVgxFAeBzs6LN/WSBKOm/+dom tJcNunYKceYwIBcsQcUqC00HttFAImN5rDRGfqmO5mirJu9iOzDnjo+GHh3GdKOA+TuXuKq+WB4QQ Lkl1zcc8uU41Pcl7K3osEInI9d3V09Mab0Re5QBBZX5/txO61QEj/inFnCC5jC35pQYSdevhKQozL yFZaoSioyta6CVz7Is4fBFgHzEBcRgnQkF5tX0ueWAdMGvj8pvQ1nlCUjpm33GNczkf3nRNq/674k dmBZ0fAQQusInXLTpg5YmAqvAO9i4qjHXfxVtzX0mtiwtbfAezsa9TJimodXjD6yig77q3rgQIYhm 1hnWuxZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wHFpF-0000000GIIg-2Zh1; Mon, 27 Apr 2026 06:52:13 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wHFpC-0000000GIGR-3dWH for linux-arm-kernel@lists.infradead.org; Mon, 27 Apr 2026 06:52:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 31AF443597; Mon, 27 Apr 2026 06:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 462D8C2BCF4; Mon, 27 Apr 2026 06:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777272730; bh=rj2gZrREi98L5OW7DVFeQ4A3D6mJm8/gxjqIgpOv8+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFJUaGtkSDKRTJn0s95vHYtgPBOZQJp+FgE/V8/RpViupAsg2NyZBF4GqZd1U3upp bfjr2M1p2y7Me0vmTz+wIWxBaQf6EbaOLrESfg7MB3EL3kY7c4dXG2Irb2HGi6wj5u Od512jDVj0LAbOKIebViKfGL+seKnzHgzha6ObdQnsNMdwVkS8vPv4XBCXehV/wI3I KkhePzLOVbLq4Rv9gcShzwhF1rsnUDhBQXSZu8X6C29Dt2bP6PV5RgRFdTANPVXMpQ uvPopa6fTBjNGwJZqyv2eTfWWAkOUg0MQDbgK5+AZ3Zf/Epk2TjZVIWXs2tkjs/s3L 862inefcNPsjw== From: "Aneesh Kumar K.V (Arm)" To: linux-coco@lists.linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Aneesh Kumar K.V (Arm)" , Alexey Kardashevskiy , Catalin Marinas , Dan Williams , Jason Gunthorpe , Jonathan Cameron , Marc Zyngier , Samuel Ortiz , Steven Price , Suzuki K Poulose , Will Deacon , Xu Yilun , Lukas Wunner , Wilfred Mallawa , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Jonathan Cameron Subject: [RFC PATCH v4 06/14] X.509: Parse Subject Alternative Name in certificates Date: Mon, 27 Apr 2026 12:21:13 +0530 Message-ID: <20260427065121.916615-7-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427065121.916615-1-aneesh.kumar@kernel.org> References: <20260427065121.916615-1-aneesh.kumar@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260426_235210_957464_EA8535F0 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Lukas Wunner The upcoming support for PCI device authentication with CMA-SPDM (PCIe r6.1 sec 6.31) requires validating the Subject Alternative Name in X.509 certificates. Store a pointer to the Subject Alternative Name upon parsing for consumption by CMA-SPDM. Signed-off-by: Lukas Wunner Reviewed-by: Wilfred Mallawa Reviewed-by: Ilpo Järvinen Reviewed-by: Jonathan Cameron Acked-by: Dan Williams Signed-off-by: Aneesh Kumar K.V (Arm) --- crypto/asymmetric_keys/x509_cert_parser.c | 9 +++++++++ include/keys/x509-parser.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c index 37e4fb9da106..d81b7de4236c 100644 --- a/crypto/asymmetric_keys/x509_cert_parser.c +++ b/crypto/asymmetric_keys/x509_cert_parser.c @@ -596,6 +596,15 @@ int x509_process_extension(void *context, size_t hdrlen, return 0; } + if (ctx->last_oid == OID_subjectAltName) { + if (ctx->cert->raw_san) + return -EBADMSG; + + ctx->cert->raw_san = v; + ctx->cert->raw_san_size = vlen; + return 0; + } + if (ctx->last_oid == OID_keyUsage) { /* * Get hold of the keyUsage bit string diff --git a/include/keys/x509-parser.h b/include/keys/x509-parser.h index 8b68e720693a..4e6a05a8c7a6 100644 --- a/include/keys/x509-parser.h +++ b/include/keys/x509-parser.h @@ -38,6 +38,8 @@ struct x509_certificate { unsigned raw_subject_size; unsigned raw_skid_size; const void *raw_skid; /* Raw subjectKeyId in ASN.1 */ + const void *raw_san; /* Raw subjectAltName in ASN.1 */ + unsigned raw_san_size; unsigned index; bool seen; /* Infinite recursion prevention */ bool verified; -- 2.43.0