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 26269C982D8 for ; Sun, 20 Sep 2026 17:11:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E39AA40D88; Sun, 20 Sep 2026 17:11:33 +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 Q2lRFC03cQeN; Sun, 20 Sep 2026 17:11:32 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org BC7ED40DD0 Authentication-Results: smtp4.osuosl.org; arc=fail smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=fail; t=1789924292; b=QFnm50MNXTqxbF8wwYD/dFFQ1D/UgZiAZri8Th3Dqmhk2buVqqPaXSeNZVKKgxqRmjoR aqOXzFjGcRHus9RlAUc3o931YINI4xahxYDOo1IrPR6soPv+LNCrzYZyeEzyUYZ9B9eOZ 1ytMhQ/JJr48w+yQnvJ0HZ++D+6f+BbAHqfhK5/4PzCjdTSgTPiZT0Fd2CMHBJDyeyGjL zMZuZguEZs8oYYgNmvv6ZuR9d9Smf7Mcb80FhMAwaL6rLZe1NEdOB0iPgeGJvkoqJNBBI ZmXTP86kPaoPxznbk7NwrMQ4q0Ju2hOzihSFGkzdtq/FSwuxbtS2+s3Tm6mNqe11KBw== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1789924292; 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:X-KAS-Sym:Received:Received:From:To:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:X-Spamd-Bar:Subject: X-BeenThere:X-Mailman-Version:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:Cc:Content-Type: Content-Transfer-Encoding:Errors-To:Sender; bh=HOaNpBA2TvDkLa/xAYN26a7XAMNIUziPUfu/qdRNHec=; b=ICpV2AvM+uZlLmC76vwhsJIWsP56IOl6vkfSip+vcZL/HMnHvodYgmXirZFm+EuWBfaY 2z8Lr1qdAHIS8d0BWoBBUrjEv4KIuJIvRS0XsSMWdcdd8xO1xNRy/9pZSBTy7ILu2Q/HX /ejntAuOtTm78GnLVlobDAIUkvMuKud1MjW/7PjkESOjhOclBoNW3xotW6V4GTBvEBt9q iXGf4ISPPVmuVTZ3f1hIg3AJ99wqw4zPspppwEH69W2kfBS8hNZxUpbaQYFJ3ttJyGT1P DamSl8yhI13GUHSFMrGiTwPBe+jS2akyOHI+C0/GNBLT5xmUOdhHPXvSBU9wheMtaYw== ARC-Authentication-Results: i=2; smtp4.osuosl.org; arc=fail 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=buildroot-bounces@buildroot.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=buildroot.org; s=default; t=1789924292; bh=HOaNpBA2TvDkLa/xAYN26a7XAMNIUziPUfu/qdRNHec=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=Qga031veCqjZW5qOH6tjaAFvQ46AlkzueZH55Ix6PXaXseIeMPVKw/7DxENzgRZfG xfdjdjsMV/VSBC3Lkszl+OP2GvXILzAJGxz9ZFxK30G2QeWGP1cvQT4KrW2dX0O0P4 RIQ7yRI8f9JpHqv3mjE4gdSSODG+pnfey6zmwx7HDnhAXFhVuVBuGbeCBa29F5VXGf 608ubFt6wRlwsd+wA4WZoqIaQNtZnS8OM+xyy1FM19O3HBUt7rabcxOT3YZPxyXDFa XJfKgzDSbLV2nv2Kdamsu1wbp7DB43Yja/vqD3fknxE0dELYXd8DbJn5hRo5DqfgJX 5CktxCvtH7Blg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id BC7ED40DD0; Sun, 20 Sep 2026 17:11:32 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 1539937A for ; Sun, 20 Sep 2026 17:11:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E402580D91 for ; Sun, 20 Sep 2026 17:11:30 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7ZFf-mRwEv-6 for ; Sun, 20 Sep 2026 17:11:30 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 8600C80D92 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=85.13.140.57 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1789924289; b=qR4kWA8EDhnFBMTkD6Lr60VXeWLCLv7L3lzTXTGW1+5eMV6JFVspqMxy5U8CoYsDxKqr vrwAxYDv0dqshSHgm3CrU5jx9sTF41/XcB/j0lelfgSplGdVRbFMYlvquAZ8ug9K4hXQ5 YiEI3G7IfDvKY8RQ2iB2zrNmvKkzmS+0SseUquESR+oYLvJNrDWxIb0Z2doIOpmwZatmz cMTfinE0Ajk5ewPD5jSD4mfQMGo2f19tSSNLlWNe27Z8KeVH1/zeyFH+8PRAygX6sR061 y1R5HyqjQ37rNVof+/8zvh0It/3SPkPgBkwlS3piH2RlrIpcAejQc0wGsWbygM1Lhlg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1789924289; h=Received-SPF:DKIM-Signature:X-KAS-Sym:Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Score:X-Spamd-Bar; bh=IJC03tXGgJw0D4V9eMbZfpkefgypuWN7oU55xSEMQhI=; b=GcvpeadeWxGq5shkO6+q8DZRWF9IiaZGa+R3KjmRL3ea0RpAG9le1eeV7d94jiCC/EkF FNkLxwrH2NylVY8n7nwr4W+iPh07pnPDGp5Wbis0TADskqIBURdRgAYgo3knEYQdSES1L zp4kQ+6Cqq9apJVqaCjxnEA4hKqYu4oogVrB6WXAVOIzKOP4oTIRJkM6Cx64HaqeImgzi VUpJSgE0YSX3KQF9pmutY/eBRTbRt4DwwZVU3KgpsAlZwD/p61M3NhRo4E94PaxyenYbW LhHQPRSzEWvqWr80JujI3+7LZnudlapt8lYdQDhaJfEk0duhAyyraLAFhy2ju2HQOHQ== ARC-Authentication-Results: i=1; smtp1.osuosl.org; dmarc=pass header.from=kuhls.net; dkim=pass header.d=kuhls.net header.i=@kuhls.net header.a=rsa-sha256 header.s=kas202605290044 header.b=Z7z6Tm7i; arc=none smtp.remote-ip=85.13.140.57 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=85.13.140.57; helo=dd20012.kasserver.com; envelope-from=bernd@kuhls.net; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=kuhls.net Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=kuhls.net header.i=@kuhls.net header.a=rsa-sha256 header.s=kas202605290044 header.b=Z7z6Tm7i Received: from dd20012.kasserver.com (dd20012.kasserver.com [85.13.140.57]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8600C80D92 for ; Sun, 20 Sep 2026 17:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kuhls.net; s=kas202605290044; t=1789924145; bh=IJC03tXGgJw0D4V9eMbZfpkefgypuWN7oU55xSEMQhI=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=Z7z6Tm7iB7OCxoWt8mbp4XIiXmg9OFFPfwl1C2fScpP8IlnmMBcxtq2w6/L6MtXgI SgCpFGUzh4SDnhG7EUzXJ43BhtMiclwLN955msuNOfoja+vlv3OCQ+XVT8ie2veXwO z1xv7mTylD/lgDknJimuyVCMd0tfaDQOk/Bgs6RaPhS3+76vq/lb5WVJ4GGQbBspV0 XX3tN6VDN3sr21Nh2MxbAZg7pTM14iv1/w8NIaAwfgyjge6koeLX+KLTpALKP6jPjv SlDkZvizOWxWZLbYLLCimvEd3FMqV6SdBAI8QpQIVUvj9ZH8CFL8Vs4iNN25RBHKQE qo+8eOkkbSW6A== X-KAS-Sym: v3:f51bdf72230551df:lHdkWXAlOH3mFYa7MPhN/Q5mZRaSllnUONUXNce4VNqCbu40d29sJoTMWL/UgPpKmiu+oFAK+SGKiz0pvNPHzzdK8865J0NZZhjD1YGG6aDHJWSqGt9pmYaVeClFza2NY+i+npE0hJgg/gHxSjO6xcwlUb6QQuNPO0hdPziIw4dhYYf4DJSWrRRzANCMomoD/RZTgi346Zz0eW33G9Vcp3B7DR+EaybhZMrqLCjEqGCkGFXPOjSjpT0/ayWciGjXWUz3QuiXUZXlIr+lNW1V5S5HyBJCR/w6EnvHAsYJhPTQhQAx4gJVctdz4XTCaIimRq6ACwja3Rp9OR6uCM1UuQ==:1NB826eVDPETN+l4hVDWyYikyjslCbFvWKtPzXiSOU+N8VD6nDd/VpVp2RzVdJ2OytttrS6KZNvYV2ZqwYQL4XxAUKHc3/ososXXx/fk/VAvSDSlUWcN1KR/5Qp6JsHFeEtWjdCStrU7+xDJnMGor+3Jdan1J0lNSg87Fz+N1TULK7R1tAJG7OzTmfVGe7cVOJuLREEStjcDa4HQsvzZZTDn/wzTb3bk/NuhR5qKkBGMClQ1iHVoeeATu+GUnNscTMnV4rUK4KAtKdhrSfUkOtBlaIQtffA8ZRTm9nZcBJXRSOy1QQENtHbetGSR1bW6PfNSCmfCcn68NFevelkzvrzS4XYt/ncsN94cq/NabsaDPHKvfe8x+CgE+kLOXNNYpJ0cZhvCleet1oEMwGb4gBlU9/ft6DsIhQ6Y9iMSewT++4rTC0qVmq+YSRtHWLpBjNBYRHm3JVrKF77kqCE8LTij2IpdHMJsCS+U0RW1weM+2EL0/guaegVpaPbwq1g10Dsqhl0oXAJ8Eyo4lyX8Tm7cGSOJPfJqJk0LAaopc8Xhg+qpFrCnFeN2FSCHHPfKRP9VlagEcI6iTqXIxclch2Bfj4lFjxDeodqoqGExjnvn2a nA0s+ZDNxeStIflOoTYPUs0fTo1HL56iBo2m35Fms8va2fTsscGq/SGr6NnsZJ7eV/s52eLCQ= Received: from fli4l.lan.fli4l (p54a1b276.dip0.t-ipconnect.de [84.161.178.118]) by dd20012.kasserver.com (Postfix) with ESMTPSA id 8C1F7A4C4872; Sun, 20 Sep 2026 19:09:05 +0200 (CEST) Received: from bruckner.lan.fli4l ([192.168.1.1]:57728) by fli4l.lan.fli4l with esmtp (Exim 4.100.1) (envelope-from ) id 1x8L1g-000000000o7-3egT; Sun, 20 Sep 2026 17:08:29 +0000 From: Bernd Kuhls To: buildroot@buildroot.org Date: Sun, 20 Sep 2026 19:08:11 +0200 Message-ID: <20260920170815.240247-65-bernd@kuhls.net> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170815.240247-1-bernd@kuhls.net> References: <20260920170815.240247-1-bernd@kuhls.net> MIME-Version: 1.0 X-Spamd-Bar: - Subject: [Buildroot] [PATCH v5 64/67] package/uboot-tools: Fix build with OpenSSL 4.0.0 X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zoltan Gyarmati , Marcin Bis , Robert Rose , Yair Ben Avraham , Angelo Compagnucci , Thomas Petazzoni , =?UTF-8?q?C=C3=A9dric=20Ch=C3=A9pied?= , Heiko Thiery , Philipp Richter , Titouan Christophe , Fabrice Fontaine , Joris Lijssens , Thomas Devoogdt , Romain Naour , Roy Kollen Svendsen , Brandon Maier , Francois Perrad , =?UTF-8?q?No=C3=A9=20Rubinstein?= , Norbert Lange , Jesse Van Gavere , Luca Ceresoli , David GOUARIN , Andrey Yurovsky , =?UTF-8?q?Andr=C3=A9=20Zwing?= , Daniel Price , Christian Hitz , Gregory Dymarek , Stefan Ott , Baxiche Su , Philippe Reynes , Sen Hastings , Fabrice Fontaine , James Hilliard , Giulio Benetti , Karoly Kasza , Martin Bark Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Signed-off-by: Bernd Kuhls --- ...Add-support-for-OpenSSL-Provider-API.patch | 304 ++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 package/uboot-tools/0003-Add-support-for-OpenSSL-Provider-API.patch diff --git a/package/uboot-tools/0003-Add-support-for-OpenSSL-Provider-API.patch b/package/uboot-tools/0003-Add-support-for-OpenSSL-Provider-API.patch new file mode 100644 index 0000000000..9a5071cae3 --- /dev/null +++ b/package/uboot-tools/0003-Add-support-for-OpenSSL-Provider-API.patch @@ -0,0 +1,304 @@ +From 9f78e701fa5a4faf69119d9fe1e485e76de2fe3b Mon Sep 17 00:00:00 2001 +From: Eddie Kovsky +Date: Mon, 23 Feb 2026 09:43:22 -0700 +Subject: [PATCH] Add support for OpenSSL Provider API + +The Engine API has been deprecated since the release of OpenSSL 3.0. End +users have been advised to migrate to the new Provider interface. +Several distributions have already removed support for engines, which is +preventing U-Boot from being compiled in those environments. + +Add support for the Provider API while continuing to support the existing +Engine API on distros shipping older releases of OpenSSL. + +This is based on similar work contributed by Jan Stancek updating Linux +to use the Provider interface. + + commit 558bdc45dfb2669e1741384a0c80be9c82fa052c + Author: Jan Stancek + Date: Fri Sep 20 19:52:48 2024 +0300 + + sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3 + +The changes have been tested with the FIT signature verification vboot +tests on Fedora 42 and Debian 13. All 30 tests pass with both the legacy +Engine library installed and with the Provider API. + +Signed-off-by: Eddie Kovsky + +Upstream: https://github.com/u-boot/u-boot/pull/918 + +Signed-off-by: Bernd Kuhls +--- + lib/aes/aes-encrypt.c | 4 +- + lib/rsa/rsa-sign.c | 102 +++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 100 insertions(+), 6 deletions(-) + +diff --git a/lib/aes/aes-encrypt.c b/lib/aes/aes-encrypt.c +index 90e1407b4f0..4fc4ce23247 100644 +--- a/lib/aes/aes-encrypt.c ++++ b/lib/aes/aes-encrypt.c +@@ -16,7 +16,9 @@ + #include + #include + #include +-#include ++#if !defined(OPENSSL_NO_ENGINE) && !defined(OPENSSL_NO_DEPRECATED_3_0) ++# include ++#endif + #include + + #if OPENSSL_VERSION_NUMBER >= 0x10000000L +diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c +index 0e38c9e802f..f456f3c58e6 100644 +--- a/lib/rsa/rsa-sign.c ++++ b/lib/rsa/rsa-sign.c +@@ -19,7 +19,47 @@ + #include + #include + #include +-#include ++#if OPENSSL_VERSION_MAJOR >= 3 ++# define USE_PKCS11_PROVIDER ++# include ++# include ++# include ++#else ++# if !defined(OPENSSL_NO_ENGINE) && !defined(OPENSSL_NO_DEPRECATED_3_0) ++# define USE_PKCS11_ENGINE ++# include ++# endif ++#endif ++ ++#ifdef USE_PKCS11_PROVIDER ++#define ERR(cond, fmt, ...) \ ++ do { \ ++ bool __cond = (cond); \ ++ drain_openssl_errors(__LINE__, 0); \ ++ if (__cond) { \ ++ errx(1, fmt, ## __VA_ARGS__); \ ++ } \ ++ } while (0) ++ ++static void drain_openssl_errors(int l, int silent) ++{ ++ const char *file; ++ char buf[120]; ++ int e, line; ++ ++ if (ERR_peek_error() == 0) ++ return; ++ if (!silent) ++ fprintf(stderr, "At main.c:%d:\n", l); ++ ++ while ((e = ERR_peek_error_line(&file, &line))) { ++ ERR_error_string(e, buf); ++ if (!silent) ++ fprintf(stderr, "- SSL %s: %s:%d\n", buf, file, line); ++ ERR_get_error(); ++ } ++} ++#endif + + static int rsa_err(const char *msg) + { +@@ -94,10 +134,11 @@ err_cert: + * + * @keydir: Key prefix + * @name Name of key +- * @engine Engine to use ++ * @engine Engine to use or NULL when using pkcs11 provider + * @evpp Returns EVP_PKEY object, or NULL on failure + * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL) + */ ++#ifdef USE_PKCS11_ENGINE + static int rsa_engine_get_pub_key(const char *keydir, const char *name, + ENGINE *engine, EVP_PKEY **evpp) + { +@@ -157,21 +198,24 @@ static int rsa_engine_get_pub_key(const char *keydir, const char *name, + + return 0; + } ++#endif + + /** + * rsa_get_pub_key() - read a public key + * + * @keydir: Directory containing the key (PEM file) or key prefix (engine) + * @name Name of key file (will have a .crt extension) +- * @engine Engine to use ++ * @engine Engine to use or NULL when using pkcs11 provider + * @evpp Returns EVP_PKEY object, or NULL on failure + * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL) + */ + static int rsa_get_pub_key(const char *keydir, const char *name, + ENGINE *engine, EVP_PKEY **evpp) + { ++#ifdef USE_PKCS11_ENGINE + if (engine) + return rsa_engine_get_pub_key(keydir, name, engine, evpp); ++#endif + return rsa_pem_get_pub_key(keydir, name, evpp); + } + +@@ -207,13 +251,44 @@ static int rsa_pem_get_priv_key(const char *keydir, const char *name, + return -ENOENT; + } + ++#ifdef USE_PKCS11_PROVIDER ++ EVP_PKEY *private_key = NULL; ++ OSSL_STORE_CTX *store; ++ ++ if (!OSSL_PROVIDER_try_load(NULL, "pkcs11", true)) ++ ERR(1, "OSSL_PROVIDER_try_load(pkcs11)"); ++ if (!OSSL_PROVIDER_try_load(NULL, "default", true)) ++ ERR(1, "OSSL_PROVIDER_try_load(default)"); ++ ++ store = OSSL_STORE_open(path, NULL, NULL, NULL, NULL); ++ ERR(!store, "OSSL_STORE_open"); ++ ++ while (!OSSL_STORE_eof(store)) { ++ OSSL_STORE_INFO *info = OSSL_STORE_load(store); ++ ++ if (!info) { ++ drain_openssl_errors(__LINE__, 0); ++ continue; ++ } ++ if (OSSL_STORE_INFO_get_type(info) == OSSL_STORE_INFO_PKEY) { ++ private_key = OSSL_STORE_INFO_get1_PKEY(info); ++ ERR(!private_key, "OSSL_STORE_INFO_get1_PKEY"); ++ } ++ OSSL_STORE_INFO_free(info); ++ if (private_key) ++ break; ++ } ++ OSSL_STORE_close(store); ++ ++ *evpp = private_key; ++#else + if (!PEM_read_PrivateKey(f, evpp, NULL, path)) { + rsa_err("Failure reading private key"); + fclose(f); + return -EPROTO; + } + fclose(f); +- ++#endif + return 0; + } + +@@ -226,6 +301,7 @@ static int rsa_pem_get_priv_key(const char *keydir, const char *name, + * @evpp Returns EVP_PKEY object, or NULL on failure + * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL) + */ ++#ifdef USE_PKCS11_ENGINE + static int rsa_engine_get_priv_key(const char *keydir, const char *name, + const char *keyfile, + ENGINE *engine, EVP_PKEY **evpp) +@@ -293,22 +369,25 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name, + + return 0; + } ++#endif + + /** + * rsa_get_priv_key() - read a private key + * + * @keydir: Directory containing the key (PEM file) or key prefix (engine) + * @name Name of key +- * @engine Engine to use for signing ++ * @engine Engine to use or NULL when using pkcs11 provider + * @evpp Returns EVP_PKEY object, or NULL on failure + * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL) + */ + static int rsa_get_priv_key(const char *keydir, const char *name, + const char *keyfile, ENGINE *engine, EVP_PKEY **evpp) + { ++#ifdef USE_PKCS11_ENGINE + if (engine) + return rsa_engine_get_priv_key(keydir, name, keyfile, engine, + evpp); ++#endif + return rsa_pem_get_priv_key(keydir, name, keyfile, evpp); + } + +@@ -325,6 +404,7 @@ static int rsa_init(void) + return 0; + } + ++#ifdef USE_PKCS11_ENGINE + static int rsa_engine_init(const char *engine_id, ENGINE **pe) + { + const char *key_pass; +@@ -380,6 +460,7 @@ static void rsa_engine_remove(ENGINE *e) + ENGINE_free(e); + } + } ++#endif + + static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo, + struct checksum_algo *checksum_algo, +@@ -480,11 +561,13 @@ int rsa_sign(struct image_sign_info *info, + if (ret) + return ret; + ++#ifdef USE_PKCS11_ENGINE + if (info->engine_id) { + ret = rsa_engine_init(info->engine_id, &e); + if (ret) + return ret; + } ++#endif + + ret = rsa_get_priv_key(info->keydir, info->keyname, info->keyfile, + e, &pkey); +@@ -496,16 +579,21 @@ int rsa_sign(struct image_sign_info *info, + goto err_sign; + + EVP_PKEY_free(pkey); ++ ++#ifdef USE_PKCS11_ENGINE + if (info->engine_id) + rsa_engine_remove(e); ++#endif + + return ret; + + err_sign: + EVP_PKEY_free(pkey); + err_priv: ++#ifdef USE_PKCS11_ENGINE + if (info->engine_id) + rsa_engine_remove(e); ++#endif + return ret; + } + +@@ -645,11 +733,13 @@ int rsa_add_verify_data(struct image_sign_info *info, void *keydest) + ENGINE *e = NULL; + + debug("%s: Getting verification data\n", __func__); ++#ifdef USE_PKCS11_ENGINE + if (info->engine_id) { + ret = rsa_engine_init(info->engine_id, &e); + if (ret) + return ret; + } ++#endif + ret = rsa_get_pub_key(info->keydir, info->keyname, e, &pkey); + if (ret) + goto err_get_pub_key; +@@ -726,8 +816,10 @@ done: + err_get_params: + EVP_PKEY_free(pkey); + err_get_pub_key: ++#ifdef USE_PKCS11_ENGINE + if (info->engine_id) + rsa_engine_remove(e); ++#endif + + if (ret) + return ret; +-- +2.47.3 + -- 2.47.3 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot