From patchwork Thu May 13 14:48:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 437337 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp396113jao; Thu, 13 May 2021 07:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNmb8zUqNTO8YDQHkrM3EYQk++ZquJXQLhEf2jVpAvhdDF82Zh14Dn8NGnpTPP1pbZVTVZ X-Received: by 2002:a17:906:c218:: with SMTP id d24mr43386453ejz.363.1620917315113; Thu, 13 May 2021 07:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620917315; cv=none; d=google.com; s=arc-20160816; b=v232OPiA+TkSfRN17AO9IpdV8D+G7w8Vd0fCVc2FBRUSuZfFGQdYh7fdtJK5+SpSeY STo5JaSJ3SJEbb945HslLbcwRPS61ijnCLekuarXytbsy1zxDWcCHcsynCdxNtP2iE7O OYA/uJ7tlhVz/knLVBp+p+z0P1NVtUy9j5bIfApwNHgn8eEIRiu4zKfJbv8H0TG/y/fc 9G/NxA0kU41knybzQfG/Yr3ijrHCFWWeZzKkXuuyt77SEoiez7ub8Ls9koS4tR0Pu9vf yGz9SZL7HxDMFPxf5zkF7llgV4O4o41WX/8xUalZRRZ17ylzgw/6D1hrZnXlmRuiZ1fn PbiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=oatmxmNuDnC6v1rC+/NHWLg2MfeLxEOt5coudAmRSII=; b=nsZl5MRwEfrOxG3EAZfitBpA3VLLrxtrZNRI9/1RP7ClQdRVjmy7Yk5vzHTAc3KnBu i5gi9xiE+Lf7YKIleVqbanQNnPxk9o20nlyPVydczXFNbaRQ0va2SbLFtGqu/zhiNCS9 Ajww8BIMpVHtDu/FJg/PhM5cBnzyJpCPxUJtPOQUEeyVFZfhI+O3yP4HbmHpCohd8uDG V8+Oxt5VjfmUexZ9hddCTpOhseOXBZnabvm9dbMbZTae8MSIpJ11b1hM5OzWg+FcA3i9 FULKKOdYvXMTYW/bZIQqjyq8A0Z6YZ6O0asf54mZ7g76w0Atq77usT/GKoh1mu/ZDDHN JFUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iftUBPUV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id bx6si3299264edb.419.2021.05.13.07.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 07:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iftUBPUV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 47E8881E53; Thu, 13 May 2021 16:48:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="iftUBPUV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B7FE81EB0; Thu, 13 May 2021 16:48:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (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 2AB6C81C67 for ; Thu, 13 May 2021 16:48:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pg1-x529.google.com with SMTP id k15so8831121pgb.10 for ; Thu, 13 May 2021 07:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oatmxmNuDnC6v1rC+/NHWLg2MfeLxEOt5coudAmRSII=; b=iftUBPUVgVmB6NGAAiNg6KwPSH65L/ZKjfALB60wvDvT57J4fp6fGlomPKGxSEyoIN uxJF47UT9bRBM4VXk91QI0ndec6x7ja3tmq1LWEQLu6ysDi6ZZUlHK8O2yVKX022tZn6 S2XuBtQeLGz/KBb9HcQCQ7PPk9H6Vg6U3j316Y7fcV8dUHCtA+NhAEklq6SR6Xcytggw ZB9xeSDuEi8eO+yXUZyPDxFu5xCcnitzcdTwydNmkNZap1gvtdaPuFMKEr/oALeEcDnR sftYEo+txfkiPx22pGFf0ysATrbynLqfwsJcBp78RtuUkq637YKA/htlHxtRgRIBc1s+ EC7g== 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; bh=oatmxmNuDnC6v1rC+/NHWLg2MfeLxEOt5coudAmRSII=; b=Z4fphsN/f1N3GETFBtpoK/cDDap3qSR/XXDLjI8NxuP0zUq1xM5cZWsj/cEceDSKUk eYPMjrsQQ3mocKBZUHj9y5oFOz18sZgUjMKR0VMvukG7uRF3BG5j7aWfBcnB5QjMO6MB hiGmMLERq2FnJhcFtoeU8dTDwVjWoH5m2Ew4hH3+3gN2vBDuTpZDEzhmvfyHYi89nfai 68zyeQtIiNfw6loB4nvu1I1F5HxFYytur0SocpThqdgZAqAzObvYoIgf3C6hXwoiduyk pPnwfAL6sVrYxlHkQVvc9ZESgTSBTHsW2gmGb4EABxhAYi8Jm4/domVAWIHs5fgeXjWA FwcQ== X-Gm-Message-State: AOAM532M7FFBxeoNR+Uuyk/L5wJqpCQVBvI9TOeKFgb/ZLFk/IDl/Gs+ 37E6EL5JSUg2Yz2JwzdZQWwJmg== X-Received: by 2002:a63:6207:: with SMTP id w7mr43209942pgb.260.1620917299536; Thu, 13 May 2021 07:48:19 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id j27sm2547906pgb.54.2021.05.13.07.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 07:48:18 -0700 (PDT) From: Masahisa Kojima To: Heinrich Schuchardt Cc: Alexander Graf , Simon Glass , Ilias Apalodimas , Masahisa Kojima , Dhananjay Phadke , Takahiro Akashi , Alexandru Gagniuc , u-boot@lists.denx.de Subject: [PATCH v7 1/3] lib: introduce HASH_CALCULATE option Date: Thu, 13 May 2021 23:48:08 +0900 Message-Id: <20210513144810.17261-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210513144810.17261-1-masahisa.kojima@linaro.org> References: <20210513144810.17261-1-masahisa.kojima@linaro.org> 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 Build error occurs when CONFIG_EFI_SECURE_BOOT or CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled, because hash-checksum.c is not compiled. Since hash_calculate() implemented in hash-checksum.c can be commonly used aside from FIT image signature verification, this commit itroduces HASH_CALCULATE option to decide if hash-checksum.c shall be compiled. Signed-off-by: Masahisa Kojima --- Changes in v7: - newly introduce HASH_CALCULATE option Changes in v6: - update lib/Makefile to compile hash-checksum.c, instead of selecting FIT_SIGNATURE in secure boot and capsule authentication. Changes in v5: - Missing option for EFI_TCG2_PROTOROL already added in different commit. This commit adds FIT_SIGNATURE only. Changes in v4: - newly added in this patch series, due to rebasing the base code. common/Kconfig.boot | 1 + lib/Kconfig | 3 +++ lib/Makefile | 2 +- lib/efi_loader/Kconfig | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Heinrich Schuchardt diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 5a18d62d78..56608226cc 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 HASH_CALCULATE help This option enables signature verification of FIT uImages, using a hash signed and verified using RSA. If diff --git a/lib/Kconfig b/lib/Kconfig index 6d2d41de30..df67eb0503 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -428,6 +428,9 @@ config CRC32C config XXHASH bool +config HASH_CALCULATE + bool + endmenu menu "Compression Support" diff --git a/lib/Makefile b/lib/Makefile index 6825671955..0835ea292c 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_CALCULATE) += 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..eb5c4d6f29 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -174,6 +174,7 @@ config EFI_CAPSULE_AUTHENTICATE select PKCS7_MESSAGE_PARSER select PKCS7_VERIFY select IMAGE_SIGN_INFO + select HASH_CALCULATE default n help Select this option if you want to enable capsule @@ -342,6 +343,7 @@ config EFI_SECURE_BOOT select X509_CERTIFICATE_PARSER select PKCS7_MESSAGE_PARSER select PKCS7_VERIFY + select HASH_CALCULATE default n help Select this option to enable EFI secure boot support.