Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2234740/?format=api
{ "id": 2234740, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234740/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260508031710.514574-5-alistair.francis@wdc.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.2/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260508031710.514574-5-alistair.francis@wdc.com>", "list_archive_url": null, "date": "2026-05-08T03:16:56", "name": "[04/18] X.509: Move certificate length retrieval into new helper", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "86973ca60c1bc22ef9e9d8d12bc9260c5779cec0", "submitter": { "id": 64571, "url": "http://patchwork.ozlabs.org/api/1.2/people/64571/?format=api", "name": "Alistair Francis", "email": "alistair23@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260508031710.514574-5-alistair.francis@wdc.com/mbox/", "series": [ { "id": 503312, "url": "http://patchwork.ozlabs.org/api/1.2/series/503312/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=503312", "date": "2026-05-08T03:16:52", "name": "lib: Rust implementation of SPDM", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/503312/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2234740/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2234740/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-54159-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=rP/T5/ml;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-54159-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"rP/T5/ml\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.182", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBZ9D2zVMz1yCg\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 13:19:28 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 59721306FFE1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 8 May 2026 03:17:59 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D035E2E974D;\n\tFri, 8 May 2026 03:17:56 +0000 (UTC)", "from mail-pl1-f182.google.com (mail-pl1-f182.google.com\n [209.85.214.182])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id E493E2DCF52\n\tfor <linux-pci@vger.kernel.org>; Fri, 8 May 2026 03:17:54 +0000 (UTC)", "by mail-pl1-f182.google.com with SMTP id\n d9443c01a7336-2b9705613ddso9911395ad.1\n for <linux-pci@vger.kernel.org>; Thu, 07 May 2026 20:17:54 -0700 (PDT)", "from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2baf1eafa62sm3220685ad.74.2026.05.07.20.17.46\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 07 May 2026 20:17:53 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778210276; cv=none;\n b=enHtSaG50Gr19JalQ/WttSchVWdppxa73cK+3B1UAhJw2JsRyKlSt8ZNALa7OF9vLwx4/a345U42/Vb5EysMA2kDq5mxrwRIuw9kTPX8Riy5N3ix3792R/VxN4EhD1fOiCgOs/v1u6nhV+XJsUjxEnm3U6gZNZLEp9QWgfCGcug=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778210276; c=relaxed/simple;\n\tbh=ywX2QQkJINgcF5rI6352/2UoVw6y6LLcc5xcEUpnPLE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=G2MtNrnDwoKc2v5GLB8NDAxPUrR1rYrP4bunM4DThOD0/O0FdZbWs9OS8YCvt+FSvXwh5F5+w8ifN8QDgNGRp9pUCYaa2FbjD7CDJIQFDJSFggkLycSF/SMhTD6xcWu02RQjgHouTpQCOzlxPOChVzzwK6b4HL3eBatFRphe/JM=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=rP/T5/ml; arc=none smtp.client-ip=209.85.214.182", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1778210274; x=1778815074;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=0pamfLAjX62QtHOtvvGRA+RHxyD1vV0e3dMD4KWIMlE=;\n b=rP/T5/mlsDra0O6cXplImVIOLvzvSFBrU/Tg956etLmgh58OVygXbxhIMeZEd7m7hl\n 8QAm8Gxb52TYfDryfGb+TOiAAwzLMgkLzBLL7X31CT8FMBDMmYQWKoiUM1Ra7YfI+NKd\n nESs345e5jrX/pARwvR42hKCto4cni2xVT1ouIzN4ghNnfph7z/WY0C0Jm8D+qC46uM/\n Ny9nwVQ398h5J9ohs50/4p/0vBcQeI5M4+RGuvktn7FrjGlWJuMO5nuKG5iQL68LyX5/\n VQMZjovMl/MVGwBFfYmigw7gXVP2e0ore1aX2wks27WrCHbwYbb25wqbzrz3YlsUclmS\n H9kA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1778210274; x=1778815074;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=0pamfLAjX62QtHOtvvGRA+RHxyD1vV0e3dMD4KWIMlE=;\n b=b0WjZ+gAdnQG3KynZ+Ixvi3nC1hocx5OayLefcaYyE44g01rvA5iWMVU92syAVGgkS\n aXLB5TFxmcXw7tuYYELIpcTo2QkY0UdXHqKOnKrPCuZn9fKR6mTxB08H2DvYYlJR18Yi\n eHkT6QxgH9FApyUGhnT8u+aHv1MmBzo7VbpP8ZnOwmNC9sy0+3Jklbrg4Lufds/+EYiY\n uMP6ljndWKrCpDyusZdThqYAoY/70WHyYY8SzLzRE3yVYDSSzMNTl7FK1nP2e9xpyI5H\n smtCmV6EC1tbanFATI9hxM/gg4utmBRMZ+GUdAAF44syLtFMxNAQK1pNRKWcRRm3xEsW\n tRUw==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ83J2F8hSpsfLBriJRJ62O+9svAUjNIfYkraZsPnRdNvJTIrr719LRHsiwG0DL258iKPr8Ym4MqibU=@vger.kernel.org", "X-Gm-Message-State": "AOJu0YwoPRDAkPDzu/Lh9wNbfazgVwKXTR0qdjnj2UgnXDGhxIw6e0K9\n\tDOQU40ypkFUgAZIWQJ1wjQjsj3KlQ2Co+KdSQkYubpzWxUWEPkt8XZ0/", "X-Gm-Gg": "Acq92OHZJlyFuXZVNLuEdhFHiHXtRaXrACg7Acicf7GOfbN7AoVPekyOlvij1RunNWa\n\tDo+1sc/PwimenUIFWhC97cIxOeNlSG+Xs5GaMSV/1pKaREswM8tHXcnV+y3XbKlzCecf44SORHQ\n\tbWEjetAv+oVCTwjmjrPfFib56b+3LvMDq3PeBGPKvTL2CQF1P1pUgkiYVQEfpomRTbBhn5kQfWt\n\tGRSDjMJX3e3H9ESyyelodSNucde8lk6fCDhFRjgpuccLa6M6ERCklyNwOpBediBO0tEfZ8/06h8\n\tu1+uiw7YzLMgfwsTeg2lk7Z3DBY1SKSuEWCNQxGVsOhw46S37iSkWfJMD3dYYCAoP1L1LZTZolj\n\tWbsgcD8hlgRpMu60RNo2lZ+7I3vjmKiB2snx5dEgpx+2rx5cW1FPKiQ7rJ/4kyKhGXVbGhcWAOz\n\tvlDc9L+LwXVQ8Tfn+sxBCJgmBFjrupvokKkWPCvodO", "X-Received": "by 2002:a17:903:90e:b0:2b0:b016:773f with SMTP id\n d9443c01a7336-2ba7908443cmr108576085ad.11.1778210274288;\n Thu, 07 May 2026 20:17:54 -0700 (PDT)", "From": "alistair23@gmail.com", "X-Google-Original-From": "alistair.francis@wdc.com", "To": "alistair@alistair23.me,\n\tlinux-kernel@vger.kernel.org,\n\tlukas@wunner.de,\n\tJonathan.Cameron@huawei.com,\n\tbhelgaas@google.com,\n\trust-for-linux@vger.kernel.org,\n\takpm@linux-foundation.org,\n\tlinux-cxl@vger.kernel.org,\n\tdjbw@kernel.org,\n\tlinux-pci@vger.kernel.org", "Cc": "alex.gaynor@gmail.com,\n\twilfred.mallawa@wdc.com,\n\tgary@garyguo.net,\n\tbjorn3_gh@protonmail.com,\n\tbenno.lossin@proton.me,\n\taliceryhl@google.com,\n\tboqun.feng@gmail.com,\n\ta.hindborg@kernel.org,\n\ttmgross@umich.edu,\n\tojeda@kernel.org,\n\talistair23@gmail.com,\n\tDan Williams <dan.j.williams@intel.com>,\n\tAlistair Francis <alistair.francis@wdc.com>", "Subject": "[PATCH 04/18] X.509: Move certificate length retrieval into new\n helper", "Date": "Fri, 8 May 2026 13:16:56 +1000", "Message-ID": "<20260508031710.514574-5-alistair.francis@wdc.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260508031710.514574-1-alistair.francis@wdc.com>", "References": "<20260508031710.514574-1-alistair.francis@wdc.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "From: Lukas Wunner <lukas@wunner.de>\n\nThe upcoming in-kernel SPDM library (Security Protocol and Data Model,\nhttps://www.dmtf.org/dsp/DSP0274) needs to retrieve the length from\nASN.1 DER-encoded X.509 certificates.\n\nSuch code already exists in x509_load_certificate_list(), so move it\ninto a new helper for reuse by SPDM.\n\nExport the helper so that SPDM can be tristate. (Some upcoming users of\nthe SPDM libray may be modular, such as SCSI and ATA.)\n\nNo functional change intended.\n\nSigned-off-by: Lukas Wunner <lukas@wunner.de>\nReviewed-by: Dan Williams <dan.j.williams@intel.com>\nReviewed-by: Alistair Francis <alistair.francis@wdc.com>\nReviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>\n---\n crypto/asymmetric_keys/x509_loader.c | 38 +++++++++++++++++++---------\n include/keys/asymmetric-type.h | 2 ++\n 2 files changed, 28 insertions(+), 12 deletions(-)", "diff": "diff --git a/crypto/asymmetric_keys/x509_loader.c b/crypto/asymmetric_keys/x509_loader.c\nindex a41741326998..25ff027fad1d 100644\n--- a/crypto/asymmetric_keys/x509_loader.c\n+++ b/crypto/asymmetric_keys/x509_loader.c\n@@ -4,28 +4,42 @@\n #include <linux/key.h>\n #include <keys/asymmetric-type.h>\n \n+ssize_t x509_get_certificate_length(const u8 *p, unsigned long buflen)\n+{\n+\tssize_t plen;\n+\n+\t/* Each cert begins with an ASN.1 SEQUENCE tag and must be more\n+\t * than 256 bytes in size.\n+\t */\n+\tif (buflen < 4)\n+\t\treturn -EINVAL;\n+\n+\tif (p[0] != 0x30 &&\n+\t p[1] != 0x82)\n+\t\treturn -EINVAL;\n+\n+\tplen = (p[2] << 8) | p[3];\n+\tplen += 4;\n+\tif (plen > buflen)\n+\t\treturn -EINVAL;\n+\n+\treturn plen;\n+}\n+EXPORT_SYMBOL_GPL(x509_get_certificate_length);\n+\n int x509_load_certificate_list(const u8 cert_list[],\n \t\t\t const unsigned long list_size,\n \t\t\t const struct key *keyring)\n {\n \tkey_ref_t key;\n \tconst u8 *p, *end;\n-\tsize_t plen;\n+\tssize_t plen;\n \n \tp = cert_list;\n \tend = p + list_size;\n \twhile (p < end) {\n-\t\t/* Each cert begins with an ASN.1 SEQUENCE tag and must be more\n-\t\t * than 256 bytes in size.\n-\t\t */\n-\t\tif (end - p < 4)\n-\t\t\tgoto dodgy_cert;\n-\t\tif (p[0] != 0x30 &&\n-\t\t p[1] != 0x82)\n-\t\t\tgoto dodgy_cert;\n-\t\tplen = (p[2] << 8) | p[3];\n-\t\tplen += 4;\n-\t\tif (plen > end - p)\n+\t\tplen = x509_get_certificate_length(p, end - p);\n+\t\tif (plen < 0)\n \t\t\tgoto dodgy_cert;\n \n \t\tkey = key_create_or_update(make_key_ref(keyring, 1),\ndiff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h\nindex 1b91c8f98688..301efa952e26 100644\n--- a/include/keys/asymmetric-type.h\n+++ b/include/keys/asymmetric-type.h\n@@ -84,6 +84,8 @@ extern struct key *find_asymmetric_key(struct key *keyring,\n \t\t\t\t const struct asymmetric_key_id *id_2,\n \t\t\t\t bool partial);\n \n+ssize_t x509_get_certificate_length(const u8 *p, unsigned long buflen);\n+\n int x509_load_certificate_list(const u8 cert_list[], const unsigned long list_size,\n \t\t\t const struct key *keyring);\n \n", "prefixes": [ "04/18" ] }