get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.0/patches/2219377/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2219377,
    "url": "http://patchwork.ozlabs.org/api/1.0/patches/2219377/?format=api",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.0/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260402221453.1602899-5-zycai@linux.ibm.com>",
    "date": "2026-04-02T22:14:26",
    "name": "[v10,04/30] hw/s390x/ipl: Create certificate store",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e6052cbf3e562e39a23af390ac1158d0dd9c9808",
    "submitter": {
        "id": 90643,
        "url": "http://patchwork.ozlabs.org/api/1.0/people/90643/?format=api",
        "name": "Zhuoying Cai",
        "email": "zycai@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260402221453.1602899-5-zycai@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 498557,
            "url": "http://patchwork.ozlabs.org/api/1.0/series/498557/?format=api",
            "date": "2026-04-02T22:14:35",
            "name": "Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices",
            "version": 10,
            "mbox": "http://patchwork.ozlabs.org/series/498557/mbox/"
        }
    ],
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219377/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=fS9Mxlgr;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmx6F0KKJz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 09:16:53 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w8QJw-0000jz-PO; Thu, 02 Apr 2026 18:15:24 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zycai@linux.ibm.com>)\n id 1w8QJv-0000ic-5N; Thu, 02 Apr 2026 18:15:23 -0400",
            "from mx0a-001b2d01.pphosted.com ([148.163.156.1])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zycai@linux.ibm.com>)\n id 1w8QJs-0004m3-Pr; Thu, 02 Apr 2026 18:15:22 -0400",
            "from pps.filterd (m0360083.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 632GrtwQ395498; Thu, 2 Apr 2026 22:15:15 GMT",
            "from ppma13.dal12v.mail.ibm.com\n (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4d66g26vcm-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 02 Apr 2026 22:15:15 +0000 (GMT)",
            "from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1])\n by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 632Li4GW031007;\n Thu, 2 Apr 2026 22:15:14 GMT",
            "from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70])\n by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4d6uhk3rk1-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 02 Apr 2026 22:15:14 +0000",
            "from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com\n [10.241.53.104])\n by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 632MEmiS20054562\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Thu, 2 Apr 2026 22:14:48 GMT",
            "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 669AC58056;\n Thu,  2 Apr 2026 22:15:12 +0000 (GMT)",
            "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 09DE658052;\n Thu,  2 Apr 2026 22:15:11 +0000 (GMT)",
            "from fedora-workstation.ibmuc.com (unknown [9.61.183.185])\n by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP;\n Thu,  2 Apr 2026 22:15:10 +0000 (GMT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:in-reply-to:message-id\n :mime-version:references:subject:to; s=pp1; bh=Fhv58ISPTiK07cD6K\n 6OR72kN2mYOGtdegx3Out2IwW8=; b=fS9Mxlgr5W01oPG5eR+sijbqWT/GXKxW4\n p+3uTQQyaRubRKHnBp6BmqzV2c4FIK+sJFKtzo0ivVyp2AIKRRiG78d3TgY/vli9\n 0LgkWBmDmM7A7KoV5DxXu5HgCRSNRcCS2TTfo9AbbqzeQ8a95BbMeEyyCyVPsKVI\n MH9ccmpwd0wbk/YTuWyjNHpWUN3mgpvT0qoV3WyAyv55LwrugnK/VLW/A60nCLMy\n mhmJMZDdBZamx/N+iy0KnV0NzUWXMKxp4N9i8awYuu5lN+5hN4YxU9Cn78Y47vjj\n jh4ZWWobaV87K89/8geFCNhrthFv2D7mLqUH6eZjRgkdXkw94juIQ==",
        "From": "Zhuoying Cai <zycai@linux.ibm.com>",
        "To": "qemu-s390x@nongnu.org, qemu-devel@nongnu.org",
        "Cc": "jrossi@linux.ibm.com, cohuck@redhat.com, berrange@redhat.com,\n richard.henderson@linaro.org, pierrick.bouvier@linaro.org,\n david@kernel.org, walling@linux.ibm.com, jjherne@linux.ibm.com,\n pasic@linux.ibm.com, borntraeger@linux.ibm.com, farman@linux.ibm.com,\n mjrosato@linux.ibm.com, iii@linux.ibm.com, eblake@redhat.com,\n armbru@redhat.com, zycai@linux.ibm.com, alifm@linux.ibm.com,\n brueckner@linux.ibm.com, jdaley@linux.ibm.com",
        "Subject": "[PATCH v10 04/30] hw/s390x/ipl: Create certificate store",
        "Date": "Thu,  2 Apr 2026 18:14:26 -0400",
        "Message-ID": "<20260402221453.1602899-5-zycai@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260402221453.1602899-1-zycai@linux.ibm.com>",
        "References": "<20260402221453.1602899-1-zycai@linux.ibm.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Authority-Analysis": "v=2.4 cv=Fdo6BZ+6 c=1 sm=1 tr=0 ts=69ceea73 cx=c_pps\n a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=6ph8WD7lSjxTzuMCr3kA:9",
        "X-Proofpoint-ORIG-GUID": "d6h9_KBV5wEpmpUaqIbxxPWH3OvJ_tiz",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDAyMDE5NSBTYWx0ZWRfX3jprIxmRobKy\n 8u0kPR6wN7K1T+fm+PfdAEa/7c5TL9s/jD7/yneE0FSbCkJQXDrDsISyEsV7JAZNMZ4pJ9k/2au\n AvI7NjtLmOHtFySSXwCvj2S46B4p2qbu82AfYYGOWEOvDqsw4n8wYuqtW3BnD2sE0RRE6ezDPq2\n /EKm4kWuP9v5gIIMddlwuoDZOL8RYhxWT0k7WyAJskZHJodQ3r+NqWD0S3l9JClwlYtrmkrYvpr\n RsuZ0UqkcFK/W/tLFpENhKz+5/MPITgpTKyW4i/bg50NghBWl4ajx8B4tDWAVvL0ZL6ysXx8aIX\n /nHQ+uEXo/+cTWQ/Z+sIjkvsY8wmeYf2sYoUyEx857GR4qgnkMLCDxYtPXwpog4WPKv9K/n62dx\n eoxCGaLhQNy2QajKjbvWZqc7FIgrd6RazGiuaNdNERmF6x9USYZcfMDQ6ugBxNta0gEomZ+HzLe\n 9eHYKlxCdT5itVSP5fg==",
        "X-Proofpoint-GUID": "d6h9_KBV5wEpmpUaqIbxxPWH3OvJ_tiz",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-02_04,2026-04-02_05,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n impostorscore=0 clxscore=1015 bulkscore=0 suspectscore=0 priorityscore=1501\n adultscore=0 malwarescore=0 phishscore=0 spamscore=0 lowpriorityscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2604020195",
        "Received-SPF": "pass client-ip=148.163.156.1; envelope-from=zycai@linux.ibm.com;\n helo=mx0a-001b2d01.pphosted.com",
        "X-Spam_score_int": "-26",
        "X-Spam_score": "-2.7",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Create a certificate store for boot certificates used for secure IPL.\n\nLoad certificates from the `boot-certs` parameter of s390-ccw-virtio\nmachine type option into the cert store.\n\nCurrently, only X.509 certificates in PEM format are supported, as the\nQEMU command line accepts certificates in PEM format only.\n\nSigned-off-by: Zhuoying Cai <zycai@linux.ibm.com>\nReviewed-by: Farhan Ali<alifm@linux.ibm.com>\n---\n docs/specs/index.rst            |   1 +\n docs/specs/s390x-secure-ipl.rst |  16 +++\n hw/s390x/cert-store.c           | 221 ++++++++++++++++++++++++++++++++\n hw/s390x/cert-store.h           |  39 ++++++\n hw/s390x/ipl.c                  |  10 ++\n hw/s390x/ipl.h                  |   3 +\n hw/s390x/meson.build            |   1 +\n include/hw/s390x/ipl/qipl.h     |   2 +\n 8 files changed, 293 insertions(+)\n create mode 100644 docs/specs/s390x-secure-ipl.rst\n create mode 100644 hw/s390x/cert-store.c\n create mode 100644 hw/s390x/cert-store.h",
    "diff": "diff --git a/docs/specs/index.rst b/docs/specs/index.rst\nindex b7909a108a..76d439782c 100644\n--- a/docs/specs/index.rst\n+++ b/docs/specs/index.rst\n@@ -40,3 +40,4 @@ guest hardware that is specific to QEMU.\n    riscv-aia\n    aspeed-intc\n    iommu-testdev\n+   s390x-secure-ipl\ndiff --git a/docs/specs/s390x-secure-ipl.rst b/docs/specs/s390x-secure-ipl.rst\nnew file mode 100644\nindex 0000000000..7ddac98a37\n--- /dev/null\n+++ b/docs/specs/s390x-secure-ipl.rst\n@@ -0,0 +1,16 @@\n+.. SPDX-License-Identifier: GPL-2.0-or-later\n+\n+s390 Certificate Store and Functions\n+====================================\n+\n+s390 Certificate Store\n+----------------------\n+\n+A certificate store is implemented for s390-ccw guests to retain within\n+memory all certificates provided by the user via the command-line, which\n+are expected to be stored somewhere on the host's file system. The store\n+will keep track of the number of certificates, their respective size,\n+and a summation of the sizes.\n+\n+Note: A maximum of 64 certificates are allowed to be stored in the certificate\n+store.\ndiff --git a/hw/s390x/cert-store.c b/hw/s390x/cert-store.c\nnew file mode 100644\nindex 0000000000..a4f15627e9\n--- /dev/null\n+++ b/hw/s390x/cert-store.c\n@@ -0,0 +1,221 @@\n+/*\n+ * S390 certificate store implementation\n+ *\n+ * Copyright 2025 IBM Corp.\n+ * Author(s): Zhuoying Cai <zycai@linux.ibm.com>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"cert-store.h\"\n+#include \"qapi/error.h\"\n+#include \"qemu/error-report.h\"\n+#include \"qemu/option.h\"\n+#include \"qemu/config-file.h\"\n+#include \"hw/s390x/ebcdic.h\"\n+#include \"hw/s390x/s390-virtio-ccw.h\"\n+#include \"qemu/cutils.h\"\n+#include \"crypto/x509-utils.h\"\n+#include \"qapi/qapi-types-machine-s390x.h\"\n+\n+static BootCertificatesList *s390_get_boot_certs(void)\n+{\n+    return S390_CCW_MACHINE(qdev_get_machine())->boot_certs;\n+}\n+\n+static S390IPLCertificate *init_cert(char *path, Error **errp)\n+{\n+    int rc;\n+    char *buf;\n+    size_t size;\n+    size_t der_len;\n+    char name[CERT_NAME_MAX_LEN];\n+    g_autofree gchar *filename = NULL;\n+    S390IPLCertificate *cert = NULL;\n+    g_autofree uint8_t *cert_der = NULL;\n+    Error *local_err = NULL;\n+\n+    filename = g_path_get_basename(path);\n+\n+    if (!g_file_get_contents(path, &buf, &size, NULL)) {\n+        error_setg(errp, \"Failed to load certificate: %s\", path);\n+        return NULL;\n+    }\n+\n+    rc = qcrypto_x509_convert_cert_der((uint8_t *)buf, size,\n+                                       &cert_der, &der_len, &local_err);\n+    if (rc != 0) {\n+        error_propagate_prepend(errp, local_err,\n+                                \"Failed to initialize certificate: %s: \", path);\n+        g_free(buf);\n+        return NULL;\n+    }\n+\n+    cert = g_new0(S390IPLCertificate, 1);\n+    cert->size = size;\n+    /*\n+     * Store DER length only - reused for size calculation.\n+     * cert_der is discarded because DER certificate data will be used once\n+     * and can be regenerated from cert->raw.\n+     */\n+    cert->der_size = der_len;\n+    /* store raw pointer - ownership transfers to cert */\n+    cert->raw = (uint8_t *)buf;\n+\n+    /*\n+     * Left justified certificate name with padding on the right with blanks.\n+     * Convert certificate name to EBCDIC.\n+     */\n+    strpadcpy(name, CERT_NAME_MAX_LEN, filename, ' ');\n+    ebcdic_put(cert->name, name, CERT_NAME_MAX_LEN);\n+\n+    return cert;\n+}\n+\n+static void update_cert_store(S390IPLCertificateStore *cert_store,\n+                              S390IPLCertificate *cert)\n+{\n+    size_t data_buf_size;\n+    size_t keyid_buf_size;\n+    size_t hash_buf_size;\n+    size_t cert_buf_size;\n+\n+    /* length field is word aligned for later DIAG use */\n+    keyid_buf_size = ROUND_UP(CERT_KEY_ID_LEN, 4);\n+    hash_buf_size = ROUND_UP(CERT_HASH_LEN, 4);\n+    cert_buf_size = ROUND_UP(cert->der_size, 4);\n+    data_buf_size = keyid_buf_size + hash_buf_size + cert_buf_size;\n+\n+    if (cert_store->largest_cert_size < data_buf_size) {\n+        cert_store->largest_cert_size = data_buf_size;\n+    }\n+\n+    g_assert(cert_store->count < MAX_CERTIFICATES);\n+\n+    cert_store->certs[cert_store->count] = *cert;\n+    cert_store->total_bytes += data_buf_size;\n+    cert_store->count++;\n+}\n+\n+static GPtrArray *get_cert_paths(Error **errp)\n+{\n+    struct stat st;\n+    BootCertificatesList *path_list = NULL;\n+    BootCertificatesList *list = NULL;\n+    gchar *cert_path;\n+    GDir *dir = NULL;\n+    const gchar *filename;\n+    bool is_empty;\n+    g_autoptr(GError) err = NULL;\n+    g_autoptr(GPtrArray) cert_path_builder = g_ptr_array_new_full(0, g_free);\n+\n+    path_list = s390_get_boot_certs();\n+\n+    for (list = path_list; list; list = list->next) {\n+        cert_path = list->value->path;\n+\n+        if (g_strcmp0(cert_path, \"\") == 0) {\n+            error_setg(errp, \"Empty path in certificate path list is not allowed\");\n+            goto fail;\n+        }\n+\n+        if (stat(cert_path, &st) != 0) {\n+            error_setg(errp, \"Failed to stat path '%s': %s\",\n+                       cert_path, g_strerror(errno));\n+            goto fail;\n+        }\n+\n+        if (S_ISREG(st.st_mode)) {\n+            if (!g_str_has_suffix(cert_path, \".pem\")) {\n+                error_setg(errp, \"Certificate file '%s' must have a .pem extension\",\n+                           cert_path);\n+                goto fail;\n+            }\n+\n+            g_ptr_array_add(cert_path_builder, g_strdup(cert_path));\n+        } else if (S_ISDIR(st.st_mode)) {\n+            dir = g_dir_open(cert_path, 0, &err);\n+            if (dir == NULL) {\n+                error_setg(errp, \"Failed to open directory '%s': %s\",\n+                           cert_path, err->message);\n+\n+                goto fail;\n+            }\n+\n+            is_empty = true;\n+            while ((filename = g_dir_read_name(dir))) {\n+                is_empty = false;\n+\n+                if (g_str_has_suffix(filename, \".pem\")) {\n+                    g_ptr_array_add(cert_path_builder,\n+                                    g_build_filename(cert_path, filename, NULL));\n+                } else {\n+                    warn_report(\"skipping '%s': not a .pem file\", filename);\n+                }\n+            }\n+\n+            if (is_empty) {\n+                warn_report(\"'%s' directory is empty\", cert_path);\n+            }\n+\n+            g_dir_close(dir);\n+        } else {\n+            error_setg(errp, \"Path '%s' is neither a file nor a directory\", cert_path);\n+            goto fail;\n+        }\n+    }\n+\n+    qapi_free_BootCertificatesList(path_list);\n+    return g_steal_pointer(&cert_path_builder);\n+\n+fail:\n+    qapi_free_BootCertificatesList(path_list);\n+    return NULL;\n+}\n+\n+void s390_ipl_create_cert_store(S390IPLCertificateStore *cert_store)\n+{\n+    GPtrArray *cert_path_builder;\n+    Error *err = NULL;\n+\n+    /* If cert store is already populated, then no work to do */\n+    if (cert_store->count) {\n+        return;\n+    }\n+\n+    cert_path_builder = get_cert_paths(&err);\n+    if (cert_path_builder == NULL) {\n+        error_report_err(err);\n+        exit(1);\n+    }\n+\n+    if (cert_path_builder->len == 0) {\n+        g_ptr_array_free(cert_path_builder, TRUE);\n+        return;\n+    }\n+\n+    if (cert_path_builder->len > MAX_CERTIFICATES) {\n+        error_report(\"Cert store exceeds maximum of %d certificates\", MAX_CERTIFICATES);\n+        g_ptr_array_free(cert_path_builder, TRUE);\n+        exit(1);\n+    }\n+\n+    cert_store->largest_cert_size = 0;\n+    cert_store->total_bytes = 0;\n+\n+    for (int i = 0; i < cert_path_builder->len; i++) {\n+        g_autofree S390IPLCertificate *cert =\n+                    init_cert((char *) cert_path_builder->pdata[i],\n+                              &err);\n+        if (!cert) {\n+            error_report_err(err);\n+            g_ptr_array_free(cert_path_builder, TRUE);\n+            exit(1);\n+        }\n+\n+        update_cert_store(cert_store, cert);\n+    }\n+\n+    g_ptr_array_free(cert_path_builder, TRUE);\n+}\ndiff --git a/hw/s390x/cert-store.h b/hw/s390x/cert-store.h\nnew file mode 100644\nindex 0000000000..7fc9503cb9\n--- /dev/null\n+++ b/hw/s390x/cert-store.h\n@@ -0,0 +1,39 @@\n+/*\n+ * S390 certificate store\n+ *\n+ * Copyright 2025 IBM Corp.\n+ * Author(s): Zhuoying Cai <zycai@linux.ibm.com>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#ifndef HW_S390_CERT_STORE_H\n+#define HW_S390_CERT_STORE_H\n+\n+#include \"hw/s390x/ipl/qipl.h\"\n+#include \"crypto/x509-utils.h\"\n+\n+#define CERT_NAME_MAX_LEN  64\n+\n+#define CERT_KEY_ID_LEN    QCRYPTO_HASH_DIGEST_LEN_SHA256\n+#define CERT_HASH_LEN      QCRYPTO_HASH_DIGEST_LEN_SHA256\n+\n+struct S390IPLCertificate {\n+    uint8_t name[CERT_NAME_MAX_LEN];\n+    size_t  size;\n+    size_t  der_size;\n+    uint8_t *raw;\n+};\n+typedef struct S390IPLCertificate S390IPLCertificate;\n+\n+struct S390IPLCertificateStore {\n+    uint16_t count;\n+    size_t   largest_cert_size;\n+    size_t   total_bytes;\n+    S390IPLCertificate certs[MAX_CERTIFICATES];\n+};\n+typedef struct S390IPLCertificateStore S390IPLCertificateStore;\n+\n+void s390_ipl_create_cert_store(S390IPLCertificateStore *cert_store);\n+\n+#endif\ndiff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c\nindex 1babcd2b7d..fbef46aee5 100644\n--- a/hw/s390x/ipl.c\n+++ b/hw/s390x/ipl.c\n@@ -38,6 +38,7 @@\n #include \"qemu/option.h\"\n #include \"qemu/ctype.h\"\n #include \"standard-headers/linux/virtio_ids.h\"\n+#include \"cert-store.h\"\n \n #define KERN_IMAGE_START                0x010000UL\n #define LINUX_MAGIC_ADDR                0x010008UL\n@@ -453,6 +454,13 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp)\n     }\n }\n \n+S390IPLCertificateStore *s390_ipl_get_certificate_store(void)\n+{\n+    S390IPLState *ipl = get_ipl_device();\n+\n+    return &ipl->cert_store;\n+}\n+\n static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb)\n {\n     CcwDevice *ccw_dev = NULL;\n@@ -771,6 +779,8 @@ void s390_ipl_prepare_cpu(S390CPU *cpu)\n     cpu->env.psw.addr = ipl->start_addr;\n     cpu->env.psw.mask = IPL_PSW_MASK;\n \n+    s390_ipl_create_cert_store(&ipl->cert_store);\n+\n     if (!ipl->kernel || ipl->iplb_valid) {\n         cpu->env.psw.addr = ipl->bios_start_addr;\n         if (!ipl->iplb_valid) {\ndiff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h\nindex 403cd08450..57f6a072a0 100644\n--- a/hw/s390x/ipl.h\n+++ b/hw/s390x/ipl.h\n@@ -13,6 +13,7 @@\n #ifndef HW_S390_IPL_H\n #define HW_S390_IPL_H\n \n+#include \"cert-store.h\"\n #include \"cpu.h\"\n #include \"exec/target_page.h\"\n #include \"system/address-spaces.h\"\n@@ -35,6 +36,7 @@ int s390_ipl_pv_unpack(struct S390PVResponse *pv_resp);\n void s390_ipl_prepare_cpu(S390CPU *cpu);\n IplParameterBlock *s390_ipl_get_iplb(void);\n IplParameterBlock *s390_ipl_get_iplb_pv(void);\n+S390IPLCertificateStore *s390_ipl_get_certificate_store(void);\n \n enum s390_reset {\n     /* default is a reset not triggered by a CPU e.g. issued by QMP */\n@@ -63,6 +65,7 @@ struct S390IPLState {\n     IplParameterBlock iplb;\n     IplParameterBlock iplb_pv;\n     QemuIplParameters qipl;\n+    S390IPLCertificateStore cert_store;\n     uint64_t start_addr;\n     uint64_t compat_start_addr;\n     uint64_t bios_start_addr;\ndiff --git a/hw/s390x/meson.build b/hw/s390x/meson.build\nindex 57cc2a6be3..6b39ad012f 100644\n--- a/hw/s390x/meson.build\n+++ b/hw/s390x/meson.build\n@@ -17,6 +17,7 @@ s390x_ss.add(files(\n   'sclpcpu.c',\n   'sclpquiesce.c',\n   'tod.c',\n+  'cert-store.c',\n ))\n s390x_ss.add(when: 'CONFIG_KVM', if_true: files(\n   'tod-kvm.c',\ndiff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h\nindex 8d3c83a80b..ed1a91182a 100644\n--- a/include/hw/s390x/ipl/qipl.h\n+++ b/include/hw/s390x/ipl/qipl.h\n@@ -31,6 +31,8 @@ typedef enum S390IplType S390IplType;\n \n #define QEMU_DEFAULT_IPL S390_IPL_TYPE_CCW\n \n+#define MAX_CERTIFICATES  64\n+\n /*\n  * The QEMU IPL Parameters will be stored at absolute address\n  * 204 (0xcc) which means it is 32-bit word aligned but not\n",
    "prefixes": [
        "v10",
        "04/30"
    ]
}