From patchwork Wed May 17 09:25:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 763434 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wSWHY5Ls8z9s82 for ; Wed, 17 May 2017 20:47:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="s94xC3EL"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 1F3AFC223D3; Wed, 17 May 2017 09:47:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 947B7C22329; Wed, 17 May 2017 09:37:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0C140C2237F; Wed, 17 May 2017 09:27:12 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by lists.denx.de (Postfix) with ESMTPS id 263EEC2226F for ; Wed, 17 May 2017 09:27:12 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id b204so7919301oii.1 for ; Wed, 17 May 2017 02:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+PznxclTVgF9EaXLMUmboA0UY2WbGs2w1SxTjm1a28s=; b=s94xC3EL3yh+i/2isnGwTJiqEqk6ZIuhEK/GQ6LWi+PmLPNG0COSRAV8i1ebXUU0oe yGt1U0itp0p7NkCzsXyxW+EAvnATMZo6Q6+aIGQrW791mGASKP64A6XXoYWr1sXfKVif 90b3WUj/PCoW1UUJN7lGpgUj2lVClniaKeFskvq64iXRAlCtaqidQHQn6FfYHy6FBGsq bFw/aKZ902MYsadMX1q1Fa+XMXuKjBCgX+Q4xLyXOFWksTKmQ9Y+uIJaXMw4nayHQ9oJ OXufS5EnuKzl9+TGy790i/4HTvcJeqX5iqrVPd8ZW0a81ryqYSpSW7wMben9adA8dKO2 00DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+PznxclTVgF9EaXLMUmboA0UY2WbGs2w1SxTjm1a28s=; b=fkyKI0TknpKsfMxY4hIXkCw3FF8E+DT3859g6FNYY8sxcHmJz/hmA1ijUxKL9/PIx/ Xh0JswAupuQ8E1UnQcc/GZ5P6h+kbjbmX4es0GL+9XB5dLOpsWAqO9OcfL7AYy4yy+C5 xiOnShre2EpNtMR8NfVJ2c+NY0eIXSlMUAlrPc1e5HXvzBy1GDLD7X4GWdL7noMzMziv cy55sIOn2AhGCyYKGV6i4Yv70sv3Cn+eP5Eqh9VBJQR/7xRxIR7RWGep9saN0m1Ynm6Y kYlcqdl90zPnxf5Bl39uzBK1jDkioJ3M7+68b/YGedzRqk/YzLnhgekUjfiqNK1wM7eq RVrA== X-Gm-Message-State: AODbwcD76jEgN0PscC3RhJ1HmDtK45Guh/aop2SPm6tkv/vV1nMZgMWy fYMx2kQzS35ZNTUM X-Received: by 10.202.199.69 with SMTP id x66mr1082175oif.215.1495013230912; Wed, 17 May 2017 02:27:10 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:11:f934:5ed:f6d9:d017]) by smtp.gmail.com with ESMTPSA id x184sm838901oix.23.2017.05.17.02.27.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2017 02:27:10 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id BB69340563; Wed, 17 May 2017 03:27:09 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 17 May 2017 03:25:26 -0600 Message-Id: <20170517092544.19357-31-sjg@chromium.org> X-Mailer: git-send-email 2.13.0.303.g4ebf302169-goog In-Reply-To: <20170517092544.19357-1-sjg@chromium.org> References: <20170517092544.19357-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v3 30/48] Kconfig: Add CONFIG_HASH to enable hashing API X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present CONFIG_CMD_HASH enables the 'hash' command which also brings in the hashing API. Some boards may wish to enable the API without the command. Add a separate CONFIG to permit this. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None cmd/Kconfig | 2 ++ common/Kconfig | 12 ++++++++++++ common/Makefile | 2 +- common/hash.c | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index b05e69a8b7..1e3cd02703 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -350,6 +350,7 @@ config CMD_MEMORY config CMD_CRC32 bool "crc32" + select HASH default y help Compute CRC32. @@ -998,6 +999,7 @@ config CMD_BLOB config CMD_HASH bool "Support 'hash' command" + select HASH help This provides a way to hash data in memory using various supported algorithms (such as SHA1, MD5, CRC32). The computed digest can be diff --git a/common/Kconfig b/common/Kconfig index 1879aefaf8..23bcf99a2c 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -493,4 +493,16 @@ config BOARD_EARLY_INIT_F endmenu +menu "Security support" + +config HASH + bool "Support hashing API (SHA1, SHA256, etc.)" + help + This provides a way to hash data in memory using various supported + algorithms (such as SHA1, MD5, CRC32). The API is defined in hash.h + and the algorithms it supports are defined in common/hash.c. See + also CMD_HASH for command-line access. + +endmenu + source "common/spl/Kconfig" diff --git a/common/Makefile b/common/Makefile index 14d01844ad..b2d663530d 100644 --- a/common/Makefile +++ b/common/Makefile @@ -10,7 +10,7 @@ ifndef CONFIG_SPL_BUILD obj-y += init/ obj-y += main.o obj-y += exports.o -obj-y += hash.o +obj-$(CONFIG_HASH) += hash.o obj-$(CONFIG_HUSH_PARSER) += cli_hush.o obj-$(CONFIG_AUTOBOOT) += autoboot.o diff --git a/common/hash.c b/common/hash.c index b645298afc..a0eded98d0 100644 --- a/common/hash.c +++ b/common/hash.c @@ -473,5 +473,5 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag, return 0; } -#endif -#endif +#endif /* CONFIG_CMD_HASH || CONFIG_CMD_SHA1SUM || CONFIG_CMD_CRC32) */ +#endif /* !USE_HOSTCC */