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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCA9CC48BDF for ; Mon, 21 Jun 2021 02:56:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B8E9D6113E for ; Mon, 21 Jun 2021 02:56:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8E9D6113E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7FFC3829B2; Mon, 21 Jun 2021 04:56:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org 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=sholland.org header.i=@sholland.org header.b="jofVgJ2g"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CBtef+hd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 46BBC829B2; Mon, 21 Jun 2021 04:56:04 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 263F082917 for ; Mon, 21 Jun 2021 04:55:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 678745C016A; Sun, 20 Jun 2021 22:55:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 20 Jun 2021 22:55:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=lb1ub2GlIeuC0 3shn+wQllwMCM8RQE7qTDizQUPcX+I=; b=jofVgJ2g2obuuo73fF6X5wbjSi1PE zCRGwUsCpQNKr8mCs0YyZm+3w46jiUVPz3s1boza5Q1uJd5K8HbDxOxwCeZz1lDl AUPOB6fiSVY+R6Fddm5OAO9syCs/dTh21Vu7WBRM6E/RtFm0tphJaYXS72g+gey3 wN4KC3O+8bjFglN0SCfPqoxlGO7vH8w6StAZl/K/Rk5mdpn2MmJgnIYXQFh6fJ5t W6oDdKq5NjugcJdfv6oNzWCsh1Rv0CuZdtI0ESy0h6fZYbag2F+hQMmtmiC70B4/ gNwyLJIJYYUgMm4wO/MgKDBlC/dOqjwITd3kB+1RffXnmVFtW3kDQ5l/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=lb1ub2GlIeuC03shn+wQllwMCM8RQE7qTDizQUPcX+I=; b=CBtef+hd E2yzrGlvxzq4CaZvOrb8qhXGGA6c0OSrCHufKgSDitMN80Tq43PgSoQf6cqbZ7Dy WHpAh1qzzKakpKuQhm7nAPpoJdZurlxu634/llFrOTDiqg+2DklbxP7uLaskTsRr 6LR4Z1EUGvYH+ZCpsQPiLyMP3EjieIgLUQqywmw/t3xbmZTfyGRZMX1lDSoOQlKY 49HRI29xlFyyfTQvgLFZT/KYITabauWQ1rL0BTeZaiA+YO3L8YH9Pq48ZyRlsd3x 0cH55aqgD9PKXhI1GOqovhiAD7wgHDr+rdrMVFQRt4mkMpMro8XRf4ayLCQea6go Npbb/y3I/O8mdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeefkedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 20 Jun 2021 22:55:57 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Andre Przywara , Hans de Goede Cc: u-boot@lists.denx.de, Samuel Holland , Stefano Babic , Fabio Estevam , "NXP i.MX U-Boot Team" , Stefan Roese , Simon Glass Subject: [PATCH 1/4] tools: Refactor mkimage linking with OpenSSL Date: Sun, 20 Jun 2021 21:55:52 -0500 Message-Id: <20210621025555.19390-2-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210621025555.19390-1-samuel@sholland.org> References: <20210621025555.19390-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Some mkimage features require linking with OpenSSL. Instead of linking OpenSSL based on the individual platform symbols, create a single Kconfig symbol which can be selected by platforms as necessary. Then, all OpenSSL-dependent image types can be enabled at once. Cc: Stefano Babic Cc: Fabio Estevam Cc: "NXP i.MX U-Boot Team" Cc: Stefan Roese Cc: Simon Glass Signed-off-by: Samuel Holland --- arch/arm/mach-imx/mxs/Kconfig | 2 ++ arch/arm/mach-mvebu/Kconfig | 1 + common/Kconfig.boot | 2 ++ scripts/config_whitelist.txt | 1 - tools/Kconfig | 3 +++ tools/Makefile | 22 +++++++--------------- tools/mxsimage.c | 3 --- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-imx/mxs/Kconfig b/arch/arm/mach-imx/mxs/Kconfig index 9f48ffda414..f067a9c38e0 100644 --- a/arch/arm/mach-imx/mxs/Kconfig +++ b/arch/arm/mach-imx/mxs/Kconfig @@ -3,6 +3,7 @@ if ARCH_MX23 config MX23 bool default y + select MKIMAGE_LINK_OPENSSL choice prompt "MX23 board select" @@ -34,6 +35,7 @@ if ARCH_MX28 config MX28 bool default y + select MKIMAGE_LINK_OPENSSL choice prompt "MX28 board select" diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index cda65f74786..2a4f861015d 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -29,6 +29,7 @@ config ARMADA_38X bool select ARMADA_32BIT select HAVE_MVEBU_EFUSE + select MKIMAGE_LINK_OPENSSL config ARMADA_38X_HS_IMPEDANCE_THRESH hex "Armada 38x USB 2.0 High-Speed Impedance Threshold (0x0 - 0x7)" diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 89a3161f1fa..7d022d1ccfa 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -80,6 +80,7 @@ config FIT_SIGNATURE select RSA_VERIFY select IMAGE_SIGN_INFO select FIT_FULL_CHECK + select MKIMAGE_LINK_OPENSSL help This option enables signature verification of FIT uImages, using a hash signed and verified using RSA. If @@ -115,6 +116,7 @@ config FIT_CIPHER bool "Enable ciphering data in a FIT uImages" depends on DM select AES + select MKIMAGE_LINK_OPENSSL help Enable the feature of data ciphering/unciphering in the tool mkimage and in the u-boot support of the FIT image. diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 3dbcc042a8a..e013e1f26aa 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1066,7 +1066,6 @@ CONFIG_MXC_UART_BASE CONFIG_MXC_USB_FLAGS CONFIG_MXC_USB_PORT CONFIG_MXC_USB_PORTSC -CONFIG_MXS CONFIG_MXS_AUART CONFIG_MXS_AUART_BASE CONFIG_MXS_OCOTP diff --git a/tools/Kconfig b/tools/Kconfig index b2f5012240c..df3dffa9e18 100644 --- a/tools/Kconfig +++ b/tools/Kconfig @@ -9,4 +9,7 @@ config MKIMAGE_DTC_PATH some cases the system dtc may not support all required features and the path to a different version should be given here. +config MKIMAGE_LINK_OPENSSL + bool + endmenu diff --git a/tools/Makefile b/tools/Makefile index d020c55d664..8843185703c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -75,9 +75,10 @@ ECDSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/ecdsa/, ecdsa-libcrypto.o) AES_OBJS-$(CONFIG_FIT_CIPHER) := $(addprefix lib/aes/, \ aes-encrypt.o aes-decrypt.o) -# Cryptographic helpers that depend on openssl/libcrypto -LIBCRYPTO_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/, \ - fdt-libcrypto.o) +# Cryptographic helpers and image types that depend on openssl/libcrypto +OPENSSL_OBJS-$(CONFIG_MKIMAGE_LINK_OPENSSL) := \ + lib/fdt-libcrypto.o \ + mxsimage.o \ ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o @@ -101,7 +102,6 @@ dumpimage-mkimage-objs := aisimage.o \ kwbimage.o \ lib/md5.o \ lpc32xximage.o \ - mxsimage.o \ omapimage.o \ os_support.o \ pblimage.o \ @@ -121,7 +121,7 @@ dumpimage-mkimage-objs := aisimage.o \ zynqimage.o \ zynqmpimage.o \ zynqmpbif.o \ - $(LIBCRYPTO_OBJS-y) \ + $(OPENSSL_OBJS-y) \ $(LIBFDT_OBJS) \ gpimage.o \ gpimage-common.o \ @@ -136,12 +136,7 @@ fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o file2include-objs := file2include.o -ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),) -# Add CONFIG_MXS into host CFLAGS, so we can check whether or not register -# the mxsimage support within tools/mxsimage.c . -HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS -endif - +ifneq ($(CONFIG_MKIMAGE_LINK_OPENSSL),) ifdef CONFIG_FIT_SIGNATURE # This affects include/image.h, but including the board config file # is tricky, so manually define this options here. @@ -159,12 +154,9 @@ ifdef CONFIG_SYS_U_BOOT_OFFS HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS) endif -ifneq ($(CONFIG_ARMADA_38X),) +# Enable image features which depend on OpenSSL. HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE -endif -# MXSImage needs LibSSL -ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_FIT_SIGNATURE)$(CONFIG_FIT_CIPHER),) HOSTCFLAGS_kwbimage.o += \ $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "") HOSTLDLIBS_mkimage += \ diff --git a/tools/mxsimage.c b/tools/mxsimage.c index 002f4b525aa..2bfbb421eb6 100644 --- a/tools/mxsimage.c +++ b/tools/mxsimage.c @@ -5,8 +5,6 @@ * Copyright (C) 2012-2013 Marek Vasut */ -#ifdef CONFIG_MXS - #include #include #include @@ -2363,4 +2361,3 @@ U_BOOT_IMAGE_TYPE( NULL, mxsimage_generate ); -#endif -- 2.31.1