Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1814851rdb; Tue, 3 Oct 2023 01:32:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc0QtYl3pQkVh+y+YLqUMj8OH1Wj1WCdQpKsThirPxCF/hiD7a+JrYMU0ajMOGrjqe9ZFw X-Received: by 2002:a05:6358:7244:b0:143:55e2:ce82 with SMTP id i4-20020a056358724400b0014355e2ce82mr15617888rwa.3.1696321926239; Tue, 03 Oct 2023 01:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696321926; cv=none; d=google.com; s=arc-20160816; b=OPIoo2f70ILJWHhFBBgCIMm6sAqySbI1ZytzvvEuOVU4ENDKrAkHIHhg3BiHsiJLgh EprOIzilWWFL/7oc0cLAcvtwZlzc/tXVecsEDLssFquiOaFgoNPxzmSsLRaqM8rIAGs9 KoqJxk1Ft4bZMAmbm8B+LimZa1mrzMid/BO1lZEvI1ux04FQczUyN0zD/935mOYouhDM lmx/k+2O9JAsFkM9IQE6mX7pbY/Xb126CB9L6CR9upb3nNBkM99MrVS/nOkL4+6IuLEf eJkKVB3JUR89473cXQmE8ZiJaE1XDpR7vflDsUMFkaSwgbov7kCP9x3c8XpW2oyyZ6WW 75Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=d+2KAdRKitsku/8q3Bt7JLWGVjJbPZ08aKqiN0Xz5mo=; fh=g62NcDT+ivL79B1aZ0R8nTeuoXyNDXdlohxxgMsnpNA=; b=gg/kuF+gJfFRE3AojJpRCUIlLHkPV9Cnk8aSApR1EHU/6eOeV/JbkDs6czinuBZczC u8GSC7oI6FuN0QUI/cZSzCcUt/CUum53prWSVBxZ9oos445CYG6c7i0Nn/1wx8o4pCtL f3pq/cHwdl2FLfDkzLGEbCqGYlTleR4Qlh+Uz4MErSJo7L7LqU/cVz0LEYHd4H4nxXXB xmFgbpC7e2bTf73pNi05clwIfFCl7DOWv/NXuY6nPdis1EC2REpcA6naRjtg54c/XTxi ArDJ1iHvTPitiom50rmefUjqKalopaalfkwkzG4rBFJtH2CIpQjaK4eja68dfVzAqh8S Y1IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BQ0mz7hA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id fc15-20020a056a002e0f00b00690d42ec31bsi1033895pfb.369.2023.10.03.01.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:32:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BQ0mz7hA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4760C807EB14; Tue, 3 Oct 2023 01:32:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbjJCIcA (ORCPT + 99 others); Tue, 3 Oct 2023 04:32:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbjJCIb7 (ORCPT ); Tue, 3 Oct 2023 04:31:59 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73BD897; Tue, 3 Oct 2023 01:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696321916; x=1727857916; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=v3fgOooQ9HUZPXlIPgbbTivNdfJyGl6aZBvlfN9Whmc=; b=BQ0mz7hAZ/SS+BnyFlorSe3F8utizmSup4dkIg1BklxFUA5GMAJ5Bo8R tfQvgHsrdQEGtUNPPW8QjHWDfTXbls/W1N9e2/iyTXagKjEHfYetxZQOH GpJ3PulxsWUoHokKQfLuMwnfjMp/m6C9ZxrnBKWDMKxXuj8ThzIO1HjBs 9vZ7DWuyUTkwQkN3zVPkdLDAW7tBXh9qr2XExYKv59XIJDhmLUmx9fJk2 H+67hasFnwah6wCUkfnjiu3sXf+eFJQ5qRGcPiRrxLv83BlO34nLwQDtj niSysMBo2Uue/79tqFca3Th6SBkdSy1PvYzVKEANUMCLgxjhJKVJTGUeP A==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362192310" X-IronPort-AV: E=Sophos;i="6.03,196,1694761200"; d="scan'208";a="362192310" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 01:31:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="924565188" X-IronPort-AV: E=Sophos;i="6.03,196,1694761200"; d="scan'208";a="924565188" Received: from tciutacu-mobl.ger.corp.intel.com ([10.252.40.114]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 01:31:49 -0700 Date: Tue, 3 Oct 2023 11:31:46 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Lukas Wunner 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, Jonathan Cameron , 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 02/12] X.509: Parse Subject Alternative Name in certificates In-Reply-To: <704291cbc90ca3aaaaa56b191017c1400963cf12.1695921657.git.lukas@wunner.de> Message-ID: <1d44be7b-c078-4b3c-50c1-61e15325fe5@linux.intel.com> References: <704291cbc90ca3aaaaa56b191017c1400963cf12.1695921657.git.lukas@wunner.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-470040028-1696321915=:2030" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 03 Oct 2023 01:32:02 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-470040028-1696321915=:2030 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Thu, 28 Sep 2023, Lukas Wunner wrote: > 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 > --- > crypto/asymmetric_keys/x509_cert_parser.c | 15 +++++++++++++++ > include/keys/x509-parser.h | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c > index 0a7049b470c1..18dfd564740b 100644 > --- a/crypto/asymmetric_keys/x509_cert_parser.c > +++ b/crypto/asymmetric_keys/x509_cert_parser.c > @@ -579,6 +579,21 @@ int x509_process_extension(void *context, size_t hdrlen, > return 0; > } > > + if (ctx->last_oid == OID_subjectAltName) { > + /* > + * A certificate MUST NOT include more than one instance > + * of a particular extension (RFC 5280 sec 4.2). > + */ > + if (ctx->cert->raw_san) { > + pr_err("Duplicate Subject Alternative Name\n"); > + return -EINVAL; > + } > + > + 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 7c2ebc84791f..9c6e7cdf4870 100644 > --- a/include/keys/x509-parser.h > +++ b/include/keys/x509-parser.h > @@ -32,6 +32,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; > Reviewed-by: Ilpo J?rvinen -- i. --8323329-470040028-1696321915=:2030--