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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 3D19AC04FF3 for ; Mon, 24 May 2021 19:29:28 +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 A04F9613F7 for ; Mon, 24 May 2021 19:29:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A04F9613F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 6053282EC8; Mon, 24 May 2021 21:29:16 +0200 (CEST) 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="fkqstaBu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 146F782EBC; Mon, 24 May 2021 21:29:09 +0200 (CEST) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0: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 6A74482EA6 for ; Mon, 24 May 2021 21:29:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-ot1-x331.google.com with SMTP id i23-20020a9d68d70000b02902dc19ed4c15so26344310oto.0 for ; Mon, 24 May 2021 12:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IkjpxjfwVFac0oqq6ls1kBK14ArPba+0XwBARvCONDI=; b=fkqstaBudArY5Ud1cT693VAF68ArWx9iTxRvYVO8gVyR8sDLC7hy1k5WBsUPDt256m HTlCbUbEd/zLheJ3KcE8VZbhvRXowpQW3/qePptJSAS8NscS0GPJFG3eyRJL1AH8RXlp o3PZwWXSygGgj7EyrKEbg5Y4YggKeeh4jjAcMHl99ElTpvBScl3D28r091FC6hVeYPqJ UC5LhzelAQkJhyGFdYfL+SkRvU9a2s2bAqcduwWUXqMRl9sxLc75ybZA6FcYGWqfV6M2 q3H+tzt85iauyUtWYIxsmIBtQbgzk8+T074/NEV6tY2ESoyvji8tTToHeaWRJkRHsxFT rQBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IkjpxjfwVFac0oqq6ls1kBK14ArPba+0XwBARvCONDI=; b=qXch4Gcu2z+3hqbx0Cwsz5Y4dO8XxaYYoWYENXl9OkLHd3SznuJif+V5VzXZHCcg9u e1Z0tsTrESlIta6vSc40b5NhzpOrqYHGpDZVxRW/JcLTqKf6lIaUdkOnR3iC54u9r2C1 UkWhEfbSN4LOKeN2oRor9jUZZrFZ3nK0IpaTbgok4iQfOlRUTRVsYMZWZ2q8WG8Eoc7J 7PH/J88nZjkc0u9h5nqAkn8kHuGAl0ORVeQjC5n7Agv6DekmFrx5wt2wLAWAtxWiVuzw uOfq7dK7o1E23Ru5veHP1aYuVls2w5hG+Pxhho0Q5qpsJWcC9eNQvQfiRipa1d+X0OLA SppA== X-Gm-Message-State: AOAM532NhVwZodNA5gYqnW19EPEvEriTMQHR2QSEMi0PAtymFbMHp+t2 3m1rfRVDgYus2o39AB1rJKix3epsyYi9Ww== X-Google-Smtp-Source: ABdhPJyRUduCMUODuZK0z7+1gPM2TGZe+zCTVk7Rr86YGzgqN1DrVXSASdHg3HxAADt3lbvNLsLowA== X-Received: by 2002:a9d:74c7:: with SMTP id a7mr20567152otl.42.1621884540813; Mon, 24 May 2021 12:29:00 -0700 (PDT) Received: from nuclearis3.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id w198sm2778664oie.26.2021.05.24.12.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 12:29:00 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: Alexandru Gagniuc , masahisa.kojima@linaro.org, xypron.glpk@gmx.de, trini@konsulko.com, sjg@chromium.org Subject: [PATCH RFC 2/2] efi_loader: Work-around build issue due to missing hash_calculate() Date: Mon, 24 May 2021 14:28:57 -0500 Message-Id: <20210524192857.1486696-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524192857.1486696-1-mr.nuke.me@gmail.com> References: <20210524192857.1486696-1-mr.nuke.me@gmail.com> 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.102.4 at phobos.denx.de X-Virus-Status: Clean The hash_calculate() symbol is provided by hash-checksum.c. It depends on hash_progressive_lookup_algo(), provided when CONFIG_HASH=y. The issue is that hash_calculate() is used by the efi_loader, irregardless of CONFIG_FIT_SIGNATURE. As pointed out in commit 87316da05f2f ("lib: introduce HASH_CALCULATE option"), enabling hash_calculate() based on CONFIG_FIT_SIGNATURE is incorrect. To resolve this, use CONFIG_HASH as the compile switch for hash-checksum.c. This ensures that all dependencies are compiled, and is the most natural Kconfig to use. There is the issue of having to 'select HASH' in a couple of places that already 'select SHA256'. This is a deeper problem with how hashes are organized, and fixing it is beyonf the scope of this change. Signed-off-by: Alexandru Gagniuc --- lib/Makefile | 2 +- lib/efi_loader/Kconfig | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 6825671955..b4795a62a0 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -61,7 +61,7 @@ endif obj-$(CONFIG_$(SPL_)ACPIGEN) += acpi/ obj-$(CONFIG_$(SPL_)MD5) += md5.o obj-$(CONFIG_$(SPL_)RSA) += rsa/ -obj-$(CONFIG_FIT_SIGNATURE) += hash-checksum.o +obj-$(CONFIG_HASH) += hash-checksum.o obj-$(CONFIG_SHA1) += sha1.o obj-$(CONFIG_SHA256) += sha256.o obj-$(CONFIG_SHA512_ALGO) += sha512.o diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index c259abe033..b112e62334 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -166,6 +166,7 @@ config EFI_CAPSULE_AUTHENTICATE depends on EFI_CAPSULE_FIRMWARE depends on EFI_CAPSULE_ON_DISK depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT + select HASH select SHA256 select RSA select RSA_VERIFY @@ -333,6 +334,7 @@ config EFI_LOAD_FILE2_INITRD config EFI_SECURE_BOOT bool "Enable EFI secure boot support" depends on EFI_LOADER + select HASH select SHA256 select RSA select RSA_VERIFY_WITH_PKEY -- 2.31.1