From patchwork Wed May 17 15:05:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 763660 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 3wSdYb1RM6z9ryb for ; Thu, 18 May 2017 01:30:27 +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="Awu4d0fx"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id DB126C227BB; Wed, 17 May 2017 15:29:32 +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_H3, RCVD_IN_MSPIKE_WL, 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 C5B31C222CA; Wed, 17 May 2017 15:29:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 85E42C22652; Wed, 17 May 2017 15:06:32 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by lists.denx.de (Postfix) with ESMTPS id C8815C226AE for ; Wed, 17 May 2017 15:06:21 +0000 (UTC) Received: by mail-oi0-f42.google.com with SMTP id w10so18847797oif.0 for ; Wed, 17 May 2017 08:06:21 -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; bh=HI2FFl4BmN2jPuo05o+43ZlOx2Pq2LlmUBfTAzaotiE=; b=Awu4d0fx3S1Gm8tCebOLu3D9fvIHC3so82wVPkamMnw3I7Cc1jHeZcqDcd8oHEARNL 8yOIhUCfoYiXhfYwG1ZQYZCyXtks4XodOQmfqcgm71wc9jFDwB/Yv+LaQe+BqJXxFodu SjIoSRX4O2YY1epw/sZ6o8ViKMbsgN0yP2Auzs0KsFV4GIP/iAPqNwMabeTZZXS9Od3H GE5C4ofOPGcMauKsbmuEoLrnzq3h6hL35u2xrzHoervvuMIgP4xp3cXrffTSoq2KjH47 IGn7pAbu0q3UbVgKnyW+JjLIjJP+3EDim1DNMWrjFkEwJo46Ui70HZ/In7ftvcom3Tbq Ha2w== 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; bh=HI2FFl4BmN2jPuo05o+43ZlOx2Pq2LlmUBfTAzaotiE=; b=Y1cbT4+8WMxKPevcM8quInDERYd1U9B5bmObMveU52XDMkJpi6CIelFTtDaCFERxmf XslLSOH/V4IN42nvTvKFyKo7kk5/ZeiGRtb2oRXOrPaYPLMRJi5hfRicLeBEXOY9Zn2m e3XuC18xPPGnrEcQzHX42NrEOq3Abcz2xbgBJDNIjclp9BWBqlPW30eKnrtQPysDt2fI oRZthpb87CvAXzhzazVy7PXeoKmtPoi+V77rxOHvF8FbrpeCyaylfnZ32VlXNFSrN5gU DJFqOk8OSXjfjdGmWUDuy+vPHhobzazCnfgYFKbBbmP+a9MV29h58LSJ/BzG9mdHKZXi hjyw== X-Gm-Message-State: AODbwcCPl39gYCzXNfwcP2G8jQBq0w/OJDkcW78EkcnorXBc/xJJyw5X SbyV4OJ/w5Ti7oSj X-Received: by 10.157.34.21 with SMTP id o21mr1871099ota.201.1495033580104; Wed, 17 May 2017 08:06:20 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.184.96]) by smtp.gmail.com with ESMTPSA id s1sm1182914otd.48.2017.05.17.08.06.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2017 08:06:19 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 2636E40550; Wed, 17 May 2017 09:06:18 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 17 May 2017 09:05:34 -0600 Message-Id: <20170517150552.6232-31-sjg@chromium.org> X-Mailer: git-send-email 2.13.0.303.g4ebf302169-goog Cc: Tom Rini Subject: [U-Boot] [PATCH v4 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 Reviewed-by: Tom Rini --- Changes in v4: - Make CMD_HASH a hidden option 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..5c39663f56 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 */