From patchwork Fri May 14 00:53:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 438006 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp26221jam; Thu, 13 May 2021 17:54:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpR3n4v/+1lfMF5VEfNQPFd/H9uWoNzuo2u79tnnbTYlte9hilv9PQKuFlH/qDL68Q7hsR X-Received: by 2002:aa7:dad1:: with SMTP id x17mr52969885eds.47.1620953648162; Thu, 13 May 2021 17:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620953648; cv=none; d=google.com; s=arc-20160816; b=xQ4ljfcyny4wu6dIZYqhJ+dZZpRar3EGL14jRk9jP6BfBORZ8rPE2kd63t6UJdLknI rv9dpn0bha8zA5L4aFQYQQQd+M80B/m/EHwCltrwmxJ336DkncQ+F6DNfyhGiUtfvP+H vcM9ZA6VocP4P7M9IXnIAJlvq3mnM9FfcnMFqTTc3HlWQjX5pCONVbpBqu3SvVc8GjqU 8y1Fd+CR4DZK+GSm7y63ObPYdYwZD0TZBd0tS9lxGgzo4W9rPIQ9Pam26aV4HF7hhR/S J6N+lOq2YkM4EP3spOYwZGlWGw8cjrxBwJk+n23LXnTpnW9GrAmRw3s124vnkmaZXwg9 rG9A== 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=GeQy9BHj1Nurip7FPSmtJ+BN5lMX/7QPvL2BtXYuP/Q=; b=H8EArG/ihT6Nu26pzZS+p9/i++JooIkmCeir/i5MpsrSNaXcCkTAc+7imeX6aImkZB 0hTq0ltsR8yYhycNqLKEiRd0xWIVXVKXTfn9Gq14GouK6df4GGdrCKa9+kFw8Pfrrtrl 1BcD8J84W1ZPJANzBu/pjB80ppWG9J+eulaGgjgI+mOOu/QkSieWI1zh6bcvNYWHfJUY ZQwhxt1a93loWqxBKIvFkMlhObIlsZsOdqDPTnGrZCSSjo6jovSbuqjDs0ggNv0xQT/a op/YTJfmzwKpZY2pHUg2EMhnE/Pp6Hfjih6ACx1MYB6eerQyg8KiABymavQKJ5CxXWaA rdtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B2m0J9cq; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id d12si5429837ejj.422.2021.05.13.17.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 17:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B2m0J9cq; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 B88EF82061; Fri, 14 May 2021 02:53:57 +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="B2m0J9cq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DDADD81F9B; Fri, 14 May 2021 02:53:50 +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-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) (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 BD3C481E18 for ; Fri, 14 May 2021 02:53:46 +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-x532.google.com with SMTP id s22so22830533pgk.6 for ; Thu, 13 May 2021 17:53:46 -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=GeQy9BHj1Nurip7FPSmtJ+BN5lMX/7QPvL2BtXYuP/Q=; b=B2m0J9cqOGQEfbfkfrzrMBHgCMdn+htMKbxfvArL3CORCGhMXTdgQFLWIjihHW0W4t EK8T1QjPMllFZdrIS14D6pq+MO9iFQipXhPbhQjSa+cxtJiYtEDQ3v/7B1nrNu/zh0ot O70/MtWc8RMXyoKLC81Ze9GBaAqd3fE7cV2M1uFYEf+cjMbeu2BXe0v99bfjFqWeSM9K mbhoszsAFccZjXa1xvEM+NcBiO8Wsi9wuXxGAvpNtbMnfemTvYZubsfLyAuWX4X4VVVs S0QD+tnNtmH8LAtCL1hZTuXvTzAd+vJYYxTKTF2/b+nv3TCpxWfiJEqSpttYGlelGaUx UR/w== 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=GeQy9BHj1Nurip7FPSmtJ+BN5lMX/7QPvL2BtXYuP/Q=; b=FwOSxgvC71rR6/nIPQHBXCQi2rLA47kW9SZiMXSEFqPejbusEW61CvgNAbazu9fjPz bp25SzfvCnPOLwPcGaNo4gGgMBb3Fr3HozuyzdzlNNXcqc5LFvmYcXNDOKhe0cY4J3ZH BM/3tVZ80aTPPPXnNAAAwGsdyHiquVK917Bb7QtxCsMOKd1p2ZGwIQP44XV7Mok1XICG tOeNIRwprP3RjTyJFdEJwOK26OEOGxh/Ku6SaVw06lt8oMovTlzZmU7OJVOI/VjLfWvk jeFj7t+Nb1orgRR611NcSFz0+K0DGPI98lUu/5QSoj58aPHpabVoDBM1yfdurczQ6f3w puIw== X-Gm-Message-State: AOAM5309KiKJdXqJ7K42zD+IOlHzt84/0jbTQuQQ0xNcTlPu1uwHcgqp ce9cw8RnIzDmVlfYVC07SfulNg== X-Received: by 2002:aa7:962e:0:b029:2cd:23f0:e4de with SMTP id r14-20020aa7962e0000b02902cd23f0e4demr12128533pfg.17.1620953625255; Thu, 13 May 2021 17:53:45 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id k8sm3086578pfp.99.2021.05.13.17.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 17:53:44 -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 v8 1/3] lib: introduce HASH_CALCULATE option Date: Fri, 14 May 2021 09:53:35 +0900 Message-Id: <20210514005337.5243-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210514005337.5243-1-masahisa.kojima@linaro.org> References: <20210514005337.5243-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 --- (no changes since v7) 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 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.