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 6C6F7C79FB9 for ; Thu, 10 Sep 2026 14:06:15 +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=MJXs8QEQplpsD7TykCLygoPyjsSjXkWAK/IQrvHJzTM=; b=O8kYyFCme7aw8mjrfvJT4iYbjf f0h4UUp19kfI5cL+Ezm71WqCOgx+TjQn3GRbZorA9GWGafpwDNTwHdgMlhuvbe7Pjvymyab76gHHR +r2u4SwWRjYIw8w9W0qrRQltSLxN7zFJKA5YUDCG/r1R9GB27wtm3O83czhmB4uYpuMiG9eGIPs5b PD6mV495CLRO3V/9Nabrc1VT5FHPy3MDc3IJr5t04l+ZdJb5wCZnjv36hIS0fo410PdVFkUX529jx AKOJ2/m6mf3hnVxWCZyOs21gZuZRuL8qlf4zK//ZZbruDpVogNtHaNnpz08c9H3NNQpHd6C9DQGgE SoFlgEbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x4fPe-0000000EYjM-2Cq9; Thu, 10 Sep 2026 14:06:02 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x4fPd-0000000EYim-41AI for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2026 14:06:01 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 721764152A; Thu, 10 Sep 2026 14:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5100A1F000FF; Thu, 10 Sep 2026 14:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789049161; bh=MJXs8QEQplpsD7TykCLygoPyjsSjXkWAK/IQrvHJzTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aEhHkPMI95R2HMm7OcFqIIp2t363j7h16Mbj3iZUXL1gUTYX4eK36EBuNlWmB9rr4 C0ACD2I851UWas5dLSimqai2XK2vDX2mn+lnfWeTk+BNdT2AAwhEvflzqLISHLY+2Z OInh+vVW6Ouh2lNlKcxn8+qkjiVf3/CPl4lBF25HZCXCq5H++sCi+GD+T1O0IZZ0TN qncCi9d8rpaToAvbm88rVOTyP8F+xSDUQu5t+PW1B3TLczcJq+LFZLQsky7HuLOdgL lLHPA8S2I5Bj7XijlAp2cnZRR2npvrXlYDHOeKqzsg6Iv97b8XpEMwoeYR4DFS5N0a Ddwh6iMGNxwFg== 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: [PATCH v5 06/15] X.509: Parse Subject Alternative Name in certificates Date: Thu, 10 Sep 2026 19:34:59 +0530 Message-ID: <20260910140509.868402-7-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260910140509.868402-1-aneesh.kumar@kernel.org> References: <20260910140509.868402-1-aneesh.kumar@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 bfd10f0195e0..c3ec2846695a 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