Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6D72606A31A for ; Wed, 2 Dec 2026 16:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=kdDYAWe7; dkim=pass (1024-bit key, unprotected) header.d=cherry.de header.i=@cherry.de header.a=rsa-sha256 header.s=selector1 header.b=L4uvytQO Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5895A6081E; Wed, 2 Dec 2026 16:12:23 +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 qEGFxXKQqK2n; Wed, 2 Dec 2026 16:12:22 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 679E56078F Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796227942; b=YFIszAnlPSp5L3jtJUIALValdWbhNadYTFL3WwYulzdKdOcaw41qs5DPSdJZYoQL+GLf 6L3dlYN/Kd1QSP8y7eigtiNJkuqfQAV9QHb25+2b7EZHiu1xcdItsvovCmslfSlk9N4Ir FDcfgaPAK5AHpOPhhuBlyC3lWPQht3IQxTnMAX9Stf+u4whP0yKmOnl18kXBP7BO/Lulu MJswZqvnTj2ZlMAByOqcTkNqn3oxNeVOXZMYYbh99pOfjoMMj9hgEA//zeJP6RVtCgml0 /0BBW217Q4qPYnSgHYjAW1tC12zKbsnFWriZXpqkkmdUDb2+yXRBVbPxW8zms0wK2HA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796227942; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received: DKIM-Signature:Received:Received:Message-ID:Date:User-Agent:Subject: To:Cc:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0: X-MS-Exchange-AntiSpam-MessageData-1:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Errors-To; bh=lY6FZGzbPxVtlhEObMSZYL7O6LiSwRIyxm/BJGaX0NA=; b=hmLrQ3chut+IBb3fTEEhczs23O038YPY+ca4MrMgULuQMFqF8iw61+RlLNZYgaIvuA8q Yye/0GESZgXA9DyhEEyITts5ymHdB7yRIATyJcjMEEr9wQ5RQM9D3W8eY+kCK7zUtIpjl N9DeVWHOXeBGt5w9/xXU3qhAuvSZ3cNzaLLfluBpkPSnxuiV1HGjb1f1KMBkNXtPQ7q6u azeddfXWle1weiSV6wMdKenxlu+bmMpmLgYXJ+hpSQ6FpPSS5RboKjQAZlbqlyY2ztNpN 4zvjBj6bPE1KtQw3kE4xELhSneC/iTlT8l2lwwW55XbIjREUcQe/xe6lXFkQKmav7gw== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 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-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1796227942; bh=lY6FZGzbPxVtlhEObMSZYL7O6LiSwRIyxm/BJGaX0NA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kdDYAWe7ZWj4nRK9a9+eWLC/S95n3SRmyteLZddwKezjO61BbUFx12UIUXJgAbH6M uiiX1TFW3WFPgxofORTlF8s4+g5HJiA3gM1z5Dn8rj02Y/dXr5QtAaDlSXlsHqYj5l kUj+qf+cIL1gq4BdgVb+i9cgdyqbIUYJQ8CKrvts3zk700qNVpzla+PJVzyykSvJqI bVD7LhgBJ2XsxEc5Rk7DhREsaaViCZAB4qNM/lMImhxOtz8eAoz33D34jXbN+x5gWF nojPmI2+ukjtuqotQ6LX0iCKmZsdpCirtqCtdBjlPmaAIe7Ae7CQYky0quJ+q7zOyB bgBDuYr+ulyJQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 679E56078F; Wed, 2 Dec 2026 16:12:22 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 593292BD for ; Wed, 2 Dec 2026 16:12:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4A36840919 for ; Wed, 2 Dec 2026 16:12:21 +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 zJCZimzeLwFd for ; Wed, 2 Dec 2026 16:12:20 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org DBEAF408FF Authentication-Results: smtp4.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip="2a01:111:f403:c201::6" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:c201::6; helo=am0pr02cu008.outbound.protection.outlook.com; envelope-from=quentin.schulz@cherry.de; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=cherry.de Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=cherry.de header.i=@cherry.de header.a=rsa-sha256 header.s=selector1 header.b=L4uvytQO Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazlp170130006.outbound.protection.outlook.com [IPv6:2a01:111:f403:c201::6]) by smtp4.osuosl.org (Postfix) with ESMTPS id DBEAF408FF for ; Wed, 2 Dec 2026 16:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cherry.de; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lY6FZGzbPxVtlhEObMSZYL7O6LiSwRIyxm/BJGaX0NA=; b=L4uvytQO+ca9SECxDf332mIecsDCyW65i5anfOpDuSZMAWcMR48NmFej/nteXK7uu3KPLxkUoIayz1pYl0AbQ/LkDv/KVoGvs6xROvAXLmkfjWZ6iG5OiXLejPO4ocP4pY7DmSRCEVQwQiKrWaLnKbpUKPe6hps7w2tTK6RCKbw= Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cherry.de; Received: from PA3PR04MB11153.eurprd04.prod.outlook.com (2603:10a6:102:4ab::7) by AMBPR04MB528492.eurprd04.prod.outlook.com (2603:10a6:20b:818::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 16:12:14 +0000 Received: from PA3PR04MB11153.eurprd04.prod.outlook.com ([fe80::6b02:c0eb:95a4:3c3d]) by PA3PR04MB11153.eurprd04.prod.outlook.com ([fe80::6b02:c0eb:95a4:3c3d%5]) with mapi id 15.21.0688.009; Wed, 2 Dec 2026 16:12:13 +0000 Message-ID: Date: Wed, 2 Dec 2026 17:12:11 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/4] binman: pre-load: Allow signing with an OpenSSL engine To: David Lechner , Lorenz Kofler Cc: u-boot@lists.u-boot-project.org, Simon Glass , Alper Nebi Yasak , Tom Rini , Philippe Reynes , upstream+uboot@sigma-star.at References: <20260917065545.1989088-1-lorenz@sigma-star.at> <20261012101054.2104707-1-lorenz@sigma-star.at> <20261012101054.2104707-3-lorenz@sigma-star.at> <179622587133.3054856.10577356328358379699.b4-review@b4> Content-Language: en-US From: Quentin Schulz In-Reply-To: <179622587133.3054856.10577356328358379699.b4-review@b4> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: VI1P190CA0001.EURP190.PROD.OUTLOOK.COM (2603:10a6:802:2b::14) To PA3PR04MB11153.eurprd04.prod.outlook.com (2603:10a6:102:4ab::7) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA3PR04MB11153:EE_|AMBPR04MB528492:EE_ X-MS-Office365-Filtering-Correlation-Id: a40d65f2-9350-4ff8-b67b-08df508f0690 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|10070799003|376014|1800799024|366016|23010399003|11063799006|4143699003|6133799003|261009223027099003|22082099003|18002099003|3023799007|56012099006|10067099003|261102123227099003|261022115727099003|261021121427099003|261021123027099003|261022105027099003|261022075727099003|261028144727099003|261026140227099003|261026121527099003; X-Microsoft-Antispam-Message-Info: z/vD0Aj8Pp4SizQ616xSMIWjDr/V1BziqY5pNiGRnaHVAQTTl1CEKGSS4x+zVzKTDN3WknPYV1zfCHFBD18JEpMbvTz1KawC31v+8EXvHyno+pAkRLsdGYoIZCKVL+Vx8XXJ1XpsVdAtzUjehmdTgJYRcPyUrc+GXI4PHe6XjmQ2kTWXVLc3EZHLtDmmv429FI1lzotlev73cWihgC2mXsqNHNOlWTOf7Rc57y0BflwOXzxkRSJvuPStV7r5Er/P9G4eqbwYP+9MOP9NTLmvDKijUHR547AdFg21wz7OU7/8SZXlXqOgT1qHKMxuWUpZ5Cxl55fUlVV7uK/Pc07RaK3PvC/95p+I8ZZzvQBndVAHEwxhR3RPA+OZWnekXCcRx/EoEFWg4AKeX8RAMYiMxXo6hT/7ukQjyIbsY58CCqyW7YiGieHG0zMzrKYDREBSx9+ymmXW6W0UiU8eGncPf5xFGbXbtO3849nKb+6oraDLmHmPfxcBNRxbxZFSn9/PJW1zFpkgLbXtdWf7YcLyPpvHBqhcQbwn3HurXaqPOnF24b9dM4jxve2kQRfQAu2WcWLtKgmEzUQLW0fbMRwK56E6/7KgLw+muO8gukwZVYgAwLFx7WI7Zui8itlI36JkYZcRUYain7NiiB+/T1JNOzHk5Za/fUz8dLKoflUZR+I= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA3PR04MB11153.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(10070799003)(376014)(1800799024)(366016)(23010399003)(11063799006)(4143699003)(6133799003)(261009223027099003)(22082099003)(18002099003)(3023799007)(56012099006)(10067099003)(261102123227099003)(261022115727099003)(261021121427099003)(261021123027099003)(261022105027099003)(261022075727099003)(261028144727099003)(261026140227099003)(261026121527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RDBBaHpDU2VreGc5TWZVdjlhOUp1Z2dOMzB2cytM?= =?utf-8?B?Ly9hQ2dHVExJdkkyaUVxQ3lvdDd6VVN5OXdkWlYzczVkYk8xM1ZQY0w4d2NH?= =?utf-8?B?ZUgwcy9uVlNaaUl0d2VmTVA5di9GZzBsMlMvS0s0OWR6RzBLeTNVTnNmUVBq?= =?utf-8?B?NTk4NFNEM1hBNGk2emx1UzYwYlVSNTJLb21xQTI3dWVzVGoxRkdXYmU0R1lo?= =?utf-8?B?a3JGUkk5L1FzajROK3dnTWI1SndXTDl6ZDA3TVRyY2ZIajEvTEVzemNLc096?= =?utf-8?B?OUhqcWlkMWVTVjBjSFllZEk4ZDVZd1pDYWZGUExNcHM5Ti92Nm1JR1JpN3NN?= =?utf-8?B?ZElUV3didDQ5WURvb3JtTHhoaGU0eUZzejVEbjdncHF1bW1UQytZTWxJMVhN?= =?utf-8?B?N3Q5K3JRazFFRm9aK016VnlrWTJ3UElhbGUwd0lER2FTc0Q3b0dubmRxc2Vr?= =?utf-8?B?K3djdGNUN0RRaTVRUE5JR3ZFWTRtZy9sVktGR1B1NXRBTDN0OEtQUGdETWFp?= =?utf-8?B?VzBnUkVscGhaK2VFVmRmTVpYUGpuSVBoSW80MnFYSURibmVGay9hK1pPYm9o?= =?utf-8?B?NVQ4Qkw4UzE0MVEzdzAzN2g4RVhwWmhjd3FGUDFmb2lZZkNTbm53VFZCSzlL?= =?utf-8?Q?mA17W3YaidSazVa90udVPDmN8Ml0tLcweYD77UU5Eq8yA?= X-MS-Exchange-AntiSpam-MessageData-1: UfIzZJIwHR9hymHRye0MRzseTHD8I//4Cqo= X-OriginatorOrg: cherry.de X-MS-Exchange-CrossTenant-Network-Message-Id: a40d65f2-9350-4ff8-b67b-08df508f0690 X-MS-Exchange-CrossTenant-AuthSource: PA3PR04MB11153.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 16:12:13.2765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5e0e1b52-21b5-4e7b-83bb-514ec460677e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 95Q3OdN5MQjj3IIOWCK4+ARzmEhmR2NYdR4oN4rdYR2fM7ECUiUA87TQh1DmNy6U4M7ui/Z411HX5mpW5A/7XSGRWA+OZBGQrTyOWqW5ouQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMBPR04MB528492 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi David, Lorenz, Do we really want to add support for signing with engines? OpenSSL 4.x has already removed support for them. There are providers available, so I'm assuming if we want to add support for signing with HSM, hopefully a provider is available for it and we should support that now? I'm trying to prevent the same situation we have with mkimage FIT signing with HSM where we need to support engines for backward compatibility (OpenSSL 1.x and 3.x) but providers (not there yet but I have patches) for OpenSSL 3.x+ (and necessary on OpenSSL 4.x). As far as I remember, on OpenSSL with provider support, passing the appropriate URI scheme in the filepath should be enough for OpenSSL to use it. e.g. pkcs11: prefix is enough for OpenSSL to know it needs to use a pkcs11 provider. Which one and how to use it is better stored in openssl.conf outside of the build system. So maybe the answer is to support that in the key_name argument? Cheers, Quentin On 12/2/26 4:37 PM, David Lechner wrote: >> The pre-load entry type imports a private key from a file and signs with >> Cryptodome, so the key must be readable as a file. Keys held in an HSM >> or on a smart card cannot be used. >> >> Add an optional 'engine' property. When set, sign with openssl using >> that engine and interpret 'key-name' as the engine-specific key >> identifier, instead of reading a key from 'pre-load-key-path'. >> >> With an engine, binman never loads the key itself and so cannot check >> its size before signing. Check the length of the resulting RSA signature >> instead, which is the modulus size either way. >> >> Behavior is otherwise unchanged when 'engine' is absent. >> >> Signed-off-by: Lorenz Kofler >> --- >> Changes in v2: >> - Reject a missing engine key-name before attempting to sign. >> - Remove automatic PKCS#11 URI construction. Pass the engine key >> identifiers unchanged. >> - Explain that, when OpenSSL is missing, _sign_engine() returns >> exactly RSAS[sign_name] zero-filled bytes so binman can report >> the missing tool without failing the signature-size check. >> - Move the change to the testPreLoadInvalidKey() test to patch 1. >> >> tools/binman/btool/openssl.py | 28 +++++++++++ >> tools/binman/etype/pre_load.py | 88 +++++++++++++++++++++++++++++----- >> 2 files changed, 104 insertions(+), 12 deletions(-) >> >> diff --git a/tools/binman/btool/openssl.py b/tools/binman/btool/openssl.py >> index b26f087c447..20e4e16e537 100644 >> --- a/tools/binman/btool/openssl.py >> +++ b/tools/binman/btool/openssl.py >> @@ -36,6 +36,34 @@ class Bintoolopenssl(bintool.Bintool): >> name, 'openssl cryptography toolkit', >> version_regex=r'OpenSSL (.*) \(', version_args='version') >> >> + def sign(self, input_fname, output_fname, key, hash_name, padding_name, >> + engine=None): >> + """Sign a file >> + >> + The key is a filename, or, when an engine is used, anything the engine >> + accepts as a key identifier, e.g. a PKCS#11 URI. >> + >> + Args: >> + input_fname (str): Filename holding the data to sign >> + output_fname (str): Filename to write the signature to >> + key (str): Key filename, or key identifier for the engine >> + hash_name (str): Hash algorithm to use, e.g. 'sha256' >> + padding_name (str): Padding to use, 'pkcs-1.5' or 'pss' >> + engine (str): OpenSSL engine to use for signing, or None to sign >> + with a local key file > > I didn't see a case where we call this with engine=None since we go through a > different code path when the engine property is omitted. So I would just make > the argument required for now. Or if I missed something, please add a test to > show how it is meant to be used. > >> + >> + Returns: >> + str: Tool output >> + """ >> + args = ['dgst', f'-{hash_name}', '-sign', key, '-out', output_fname] >> + if engine: >> + args += ['-engine', engine, '-keyform', 'engine'] > > I expect folks will want to be able to pass a PIN via an environment variable > similar to how we already have MKIMAGE_SIGN_PIN. Can we add support for that > here? > > if 'BINMAN_SIGN_PIN' in os.environ: > args += ['-passin', 'env:BINMAN_SIGN_PIN'] > > Otherwise, people will have to manually provide the PIN through the OpenSSL > prompt or put the PIN somewhere less secure than an environment variable. >