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 smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 76746C5CFCF for ; Fri, 14 Aug 2026 17:07:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 45E2E40CF1; Fri, 14 Aug 2026 17:07:56 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id EZL38xR-Z3Cu; Fri, 14 Aug 2026 17:07:55 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6B11940CF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org ; s=default; t=1786727275; bh=fuavo2OrFl0qEfFc85tHieFMRpewOGC1VL8eM0znnr0=; h=Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=MgwexNRi7TjZWaCIs9UVsMKIlFp37R2vM8S/kEmOv5CspjwqX0xUuUM2RF42JJn7W 3UUeLXvG9BBtYSjoY0mlgejQFpWKPgMO6SOX/LUnqBdqHbu9Q9Y4x7vHuxcWHHonhq bheFAMVFwK3Wphw5naRb7woG/evU02tEOPDktqbYBUBJ2PKAhF1gamH0OQHFq+NZkG Mr87hjIkq+Jb1dsI2/EGrbChocX7OtMsWjVcZ/bCAzL/oprGcc1YWOQttcE6HanKcK XLQxy8xYJ3vgSwAiNbfJtvCKcdXv3aMDApP/I5Tpj69q9FeRlpCgm3f8qLlco/VHjL EzIjAG6dm0TMA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 6B11940CF2; Fri, 14 Aug 2026 17:07:55 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 4D1D5361 for ; Fri, 14 Aug 2026 17:07:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 337856080C for ; Fri, 14 Aug 2026 17:07:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Kb7oAe_Q9VCY for ; Fri, 14 Aug 2026 17:07:53 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=185.246.84.56; helo=smtpout-02.galae.net; envelope-from=jeremie.dautheribes@bootlin.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 1CCEA60671 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1CCEA60671 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 1CCEA60671 for ; Fri, 14 Aug 2026 17:07:52 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 242CF1A1647; Fri, 14 Aug 2026 17:07:51 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id ED8D86046D; Fri, 14 Aug 2026 17:07:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9BD9911C4EF21; Fri, 14 Aug 2026 19:07:43 +0200 (CEST) Date: Fri, 14 Aug 2026 19:07:10 +0200 Subject: [PATCH 1/5] tools: binman: add nxp_imx93cst etype for i.MX93 flash.bin signing MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260814-imx93-secureboot-v1-1-0c3c78020d03@bootlin.com> References: <20260814-imx93-secureboot-v1-0-0c3c78020d03@bootlin.com> In-Reply-To: <20260814-imx93-secureboot-v1-0-0c3c78020d03@bootlin.com> To: "NXP i.MX U-Boot Team" , u-boot@lists.u-boot-project.org Cc: Tom Rini , Simon Glass , Alper Nebi Yasak , Stefano Babic , Fabio Estevam , Rasmus Villemoes , Denis Mukhin , Ilias Apalodimas , Mathieu Dubois-Briand , Alice Guo , =?utf-8?q?Krzysztof_Drobi=C5=84ski?= , Quentin Schulz , Marek Vasut , =?utf-8?q?J=C3=A9r=C3=A9mie_Dautheribes_=28Schneider_Electric=29?= , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Thomas Petazzoni X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6231; i=jeremie.dautheribes@bootlin.com; h=from:subject:message-id; bh=scQ4a1ry17n72rHgrn1XtAhcpO/dkmLyL7bxnOFK62o=; b=owEBbQKS/ZANAwAKASsAXqAbWo8DAcsmYgBqf0tUzMRB7dvRI9FNqvsn/sRso4GkzexRVPbIf gfhAVgm/FOJAjMEAAEKAB0WIQT7FK2Qhtu4QpBIBAkrAF6gG1qPAwUCan9LVAAKCRArAF6gG1qP A79VD/9UK8gTlj0DlBI/QclX5qy4mlXQI8fIkAibSGx1sWGGAKIo2DqSlXvlPFDDHNpLOs8CdHV IjA4GlScOF7OPwT9pcRGM071x0GYWTh8Wgn0mVNdv0Rxoo1IiIGqq4TK5zpIIApZNXOwhLA2a/k AZ07y0q8HbvQe81EKnmSehj+x+iLVjDkZt9h56aDWP5YhwGtuHpgCMkfF02ewBpDQrHV13P0iD6 H+oGUE1hSy55kEMCiVPTJBIlHcmDNi52EzFUfB7khBClBMrqQx7Mbpdi9ScBNZ4wOw8GEkajwdu mqXuEOs5ExYYsCY6MlHlfj8bgHPmwf0R+nCLeOmqYet+Zf2IeDuRn48kN3mLlKq43qR4QaL6Z2D 05IbriaGdwEBC7mWuNB8Yafy6a0SBgYjJpGwHRPuHG2Iyc0JntJ2w0gKF8ryTs/gykL+H0a7kyo +v6o0NzVBaY159Ug+rcEzrFlZ0rg7TzbI6Jfeho5k5ASF6cc4nsa39JGwkAQXY09eDIB864DqoR Y8qmW7lShJDoqp1lXJsloIFsbxIRPIK5QnsYmyMHrdYwDhdv09ch5mXpqmrIcVLXle94ZhDmpln yTi7RC/Nyqvf/HWtosh9fJl2J0ZHUkqL13AFeNfVLFET+mSE/H0YnUd0a4tlkGYMI40kqWjixxj ZoZbCpUketx9VaQ== X-Developer-Key: i=jeremie.dautheribes@bootlin.com; a=openpgp; fpr=FB14AD9086DBB842904804092B005EA01B5A8F03 X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: =?utf-8?q?J=C3=A9r=C3=A9mie_Dautheribes_=28Schneider_Electric=29_via_U-Bo?= =?utf-8?q?ot?= Reply-To: =?utf-8?q?J=C3=A9r=C3=A9mie_Dautheribes_=28Schneider_Electric=29?= Errors-To: u-boot-bounces@lists.u-boot-project.org Sender: "U-Boot" Add a new binman etype which allows signing both the SPL and U-Boot proper sections of i.MX93 flash.bin using CST. The implementation is largely derived from the nxp_imx8mcst etype, as the signing procedures for both platforms are quite similar. Signed-off-by: Jérémie Dautheribes (Schneider Electric) --- .gitignore | 2 + tools/binman/etype/nxp_imx93cst.py | 143 +++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) diff --git a/.gitignore b/.gitignore index 0e09715cc60..5cb135fc58c 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,8 @@ fit-dtb.blob* /keep-syms-lto.* /*imx8mimage* /*imx8mcst* +/*imx9image* +/*imx93cst* /*rcar4-sa0* /drivers/video/u_boot_logo.bmp.S /test/fdt_overlay/test-fdt-overlay-stacked.dtbo.S diff --git a/tools/binman/etype/nxp_imx93cst.py b/tools/binman/etype/nxp_imx93cst.py new file mode 100644 index 00000000000..e1528b13102 --- /dev/null +++ b/tools/binman/etype/nxp_imx93cst.py @@ -0,0 +1,143 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2026 (C) Bootlin +# Author: Jérémie Dautheribes +# +# Derived from nxp_imx8mcst.py +# Copyright 2023-2024 Marek Vasut + + +# Entry-type module for generating the i.MX93 code signing tool +# input configuration file and invocation of cst on generated +# input configuration file and input data to be signed. +# + +import configparser +import os +import struct + +from binman.etype.mkimage import Entry_mkimage +from binman.etype.section import Entry_section +from dtoc import fdt_util +from u_boot_pylib import tools + +CONTAINER_HDR_TAG = 0x87 +SPL_CONTAINER_OFFSET = 1024 # 0x400 +CONTAINER_HDR_SIZE = 16 +AHAB_IMAGE_ENTRY_FLAGS_OFFSET = 24 +ELE_IMAGE_CORE_AND_TYPE = 0x66 + +KEY_NAME = "sha384_secp384r1_v3_usr_crt" + +CSF_CONFIG_TEMPLATE = f""" +[Header] + Target = AHAB + Version = 1.0 + +[Install SRK] + File = "SRK_1_2_3_4_table.bin" + Source = "SRK1_{KEY_NAME}.pem" + Source index = 0 + Source set = OEM + Revocations = 0x0 + +[Authenticate Data] + File = "data.bin" + Offsets = 0x400 0x490 + +""" + + +class Entry_nxp_imx93cst(Entry_mkimage): + """NXP i.MX93 CST .cfg file generator and cst invoker""" + + def __init__(self, section, etype, node): + super().__init__(section, etype, node) + + def ReadNode(self): + super().ReadNode() + self.srk_table = os.getenv( + "SRK_TABLE", + fdt_util.GetString(self._node, "nxp,srk-table", "SRK_1_2_3_4_table.bin"), + ) + self.srk_crt = os.getenv( + "SRK_KEY", + fdt_util.GetString(self._node, "nxp,srk-crt", f"SRK1_{KEY_NAME}.pem"), + ) + self.ReadEntries() + + def BuildSectionData(self, required): + data, input_fname, uniq = self.collect_contents_to_file( + self._entries.values(), "input" + ) + + if struct.unpack("