From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60546C25B50 for ; Sat, 21 Jan 2023 15:58:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA60D856B4; Sat, 21 Jan 2023 16:58:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="azAP0bn5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B04085463; Sat, 21 Jan 2023 16:48:43 +0100 (CET) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B40D38558A for ; Sat, 21 Jan 2023 16:48:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=paulerwan.rio@gmail.com Received: by mail-wm1-x331.google.com with SMTP id c10-20020a05600c0a4a00b003db0636ff84so5689886wmq.0 for ; Sat, 21 Jan 2023 07:48:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oecGN6bZTg6hQr7FhPDxf/NjlbiGp8xtY3RHwM/5WPE=; b=azAP0bn5AoHKE1uSXoNWHdb/mv5bZdx8PU7moiA7xqbdWuiyz5+B065573f6UntuPF +o5oc3U06ZPTDbW2Li55NNz03bwWb1WxwTYHhUJyttX7DxAjH+qJ58LRRIBHeYQAe2Su FGp4whpLR+vX3jZttrYfHUTrtKXwkd7jIyHBc1pTdFHZjHQxag5vqv/cr9zfvswQuhtH UujZAczfxq8XrzsktPfbe+6ggkheMxX8h8N3ZvmHxu9SGCG/mNIQHrPJyXgnjHilUJVy rNw+ibNvp38eiOlrKRdRLIGbaTHBCXSHul4vKmW28KO+IbHm6XMrq0yX6MJX/EC8e/+f C3jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oecGN6bZTg6hQr7FhPDxf/NjlbiGp8xtY3RHwM/5WPE=; b=CJaQgrHs/sw/JbVLw+RZ8TMjs03E1NsqvDvfORu0xhk5FpJbyt6RZ2NF1SpZX8ay8U PYewwmDDAgOGzFOF6/mkhhFdb+ABoR4tGagIGKAdyXSz/nZ7/OY4z8oFHyUOCkiISaYf rtnMJuUcBElo37cXWm0Klx72NTBD5boPDTgQ+T+3d4ul5YYtBXj+njxCHxD+OPksCLK3 bOrd4pTikTCUsHskeuSFiPncEy/dIK4Ff1viRXI9XSEQp2ZeGkeBZBkV7aczuSm5jc5C 9BPLGoWcfLxQDq9lcma8bNFzDLD/SqUJnxQUyeELfzIsHpFLYWzzFaxZ3su8ltxUFgvj cE4Q== X-Gm-Message-State: AFqh2ko17axutHDehDT0jilo1kFvslAspRem/8bssejaxzHqCauaMd17 5pHX667p1cJghpAbdEGH9wmllUMhDYkYJFVX X-Google-Smtp-Source: AMrXdXso4WXBMdMZoxP/agSdSCccAYM9P7kfJ8e6gHN60l8xh3+/TZp9ZDkg7+RVYino7SUMjqBjxQ== X-Received: by 2002:a7b:c45a:0:b0:3d1:ed41:57c0 with SMTP id l26-20020a7bc45a000000b003d1ed4157c0mr26325496wmi.30.1674316118048; Sat, 21 Jan 2023 07:48:38 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:359:6c00:9194:e12b:fad2:6b35]) by smtp.gmail.com with ESMTPSA id j8-20020a05600c190800b003d9aa76dc6asm7744143wmq.0.2023.01.21.07.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 07:48:37 -0800 (PST) From: Paul-Erwan Rio To: u-boot@lists.denx.de Cc: Simon Glass , Paul-Erwan Rio , AKASHI Takahiro , Andre Przywara , Fabio Estevam , Heinrich Schuchardt , Jan Kiszka , Mamta Shukla , Mark Kettenis , Mikhail Ilin , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Philippe Reynes , Sean Anderson , Stefan Eichenberger , Steven Lawrance , Thomas Haemmerle Subject: [PATCH v1 2/2] tools: fix build without LIBCRYPTO support Date: Sat, 21 Jan 2023 16:47:42 +0100 Message-Id: <20230121154743.667253-3-paulerwan.rio@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121154743.667253-1-paulerwan.rio@gmail.com> References: <20230121154743.667253-1-paulerwan.rio@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 21 Jan 2023 16:58:23 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Commit introduced a target-independent configuration to build crypto features in host tools. But since commit <2c21256b27d70b5950bd059330cdab027fb6ab7e>, the build without OpenSSL is broken, due to FIT signature/encryption features. Add missing conditional compilation tokens to fix this. Signed-off-by: Paul-Erwan Rio --- include/image.h | 2 +- tools/Kconfig | 1 + tools/fit_image.c | 2 +- tools/image-host.c | 2 ++ tools/mkimage.c | 5 +++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/image.h b/include/image.h index 7717a4c13d..6a616d15fb 100644 --- a/include/image.h +++ b/include/image.h @@ -1388,7 +1388,7 @@ int calculate_hash(const void *data, int data_len, const char *algo, * device */ #if defined(USE_HOSTCC) -# if defined(CONFIG_FIT_SIGNATURE) +# if CONFIG_IS_ENABLED(FIT_SIGNATURE) # define IMAGE_ENABLE_SIGN 1 # define FIT_IMAGE_ENABLE_VERIFY 1 # include diff --git a/tools/Kconfig b/tools/Kconfig index 539708f277..cfad26302c 100644 --- a/tools/Kconfig +++ b/tools/Kconfig @@ -46,6 +46,7 @@ config TOOLS_FIT_RSASSA_PSS Support the rsassa-pss signature scheme in the tools builds config TOOLS_FIT_SIGNATURE + depends on TOOLS_LIBCRYPTO def_bool y help Enable signature verification of FIT uImages in the tools builds diff --git a/tools/fit_image.c b/tools/fit_image.c index 8a18b1b0ba..148dc5df40 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -61,7 +61,7 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, ret = fit_set_timestamp(ptr, 0, time); } - if (!ret) + if (CONFIG_IS_ENABLED(FIT_SIGNATURE) && !ret) ret = fit_pre_load_data(params->keydir, dest_blob, ptr); if (!ret) { diff --git a/tools/image-host.c b/tools/image-host.c index 4a24dee815..d09a03bd76 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -1119,6 +1119,7 @@ static int fit_config_add_verification_data(const char *keydir, return 0; } +#if CONFIG_IS_ENABLED(FIT_SIGNATURE) /* * 0) open file (open) * 1) read certificate (PEM_read_X509) @@ -1227,6 +1228,7 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit) out: return ret; } +#endif int fit_cipher_data(const char *keydir, void *keydest, void *fit, const char *comment, int require_keys, diff --git a/tools/mkimage.c b/tools/mkimage.c index 8306861ce5..866410934e 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -115,7 +115,7 @@ static void usage(const char *msg) " -B => align size in hex for FIT structure and header\n" " -b => append the device tree binary to the FIT\n" " -t => update the timestamp in the FIT\n"); -#ifdef CONFIG_FIT_SIGNATURE +#if CONFIG_IS_ENABLED(FIT_SIGNATURE) fprintf(stderr, "Signing / verified boot options: [-k keydir] [-K dtb] [ -c ] [-p addr] [-r] [-N engine]\n" " -k => set directory containing private keys\n" @@ -130,8 +130,9 @@ static void usage(const char *msg) " -o => algorithm to use for signing\n"); #else fprintf(stderr, - "Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)\n"); + "Signing / verified boot not supported (CONFIG_TOOLS_FIT_SIGNATURE undefined)\n"); #endif + fprintf(stderr, " %s -V ==> print version information and exit\n", params.cmdname); fprintf(stderr, "Use '-T list' to see a list of available image types\n"); -- 2.39.0