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: 1478086 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iftUBPUV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fgvfs26Hxz9sWP for ; Fri, 14 May 2021 00:48:37 +1000 (AEST) 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-Google-Smtp-Source: ABdhPJzK9w069Fto5h1Lf8EPYoJDxxxFHFkScHfkb0XQp3L+KmCGM0ydxgHHYUpEr2pP77rN/un+Bw== 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 Reviewed-by: Heinrich Schuchardt --- 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(-) 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.