[U-Boot] [PATCH 1/1] Kconfig: Add support for hash and sha1sum commands

Tom Rini trini at konsulko.com
Sat May 27 14:59:15 UTC 2017


From: Daniel Thompson <daniel.thompson at linaro.org>

Currently these (board agnostic) commands cannot be selected using
menuconfig and friends. Fix this the obvious way.

Signed-off-by: Daniel Thompson <daniel.thompson at linaro.org>
[trini: Re-apply, add imply for a few cases, run moveconfig.py]
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 README                              | 11 -----------
 arch/Kconfig                        |  1 +
 arch/arm/Kconfig                    |  1 +
 arch/arm/mach-exynos/Kconfig        |  1 +
 cmd/Kconfig                         | 18 ++++++++++++++++++
 configs/bcm958622hr_defconfig       |  1 +
 include/configs/bcm_ep_board.h      |  3 ---
 include/configs/exynos5-common.h    |  3 ---
 include/configs/imx6qdl_icore.h     |  1 -
 include/configs/imx6qdl_icore_rqs.h |  1 -
 include/configs/imx6ul_geam.h       |  1 -
 include/configs/imx6ul_isiot.h      |  1 -
 include/configs/sandbox.h           |  2 --
 include/hash.h                      |  4 ----
 scripts/config_whitelist.txt        |  1 -
 15 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/README b/README
index 9d351ec5ad..f9931f6a6f 100644
--- a/README
+++ b/README
@@ -889,8 +889,6 @@ The following options need to be configured:
 		CONFIG_CMD_SETGETDCR	  Support for DCR Register access
 					  (4xx only)
 		CONFIG_CMD_SF		* Read/write/erase SPI NOR flash
-		CONFIG_CMD_SHA1SUM	* print sha1 memory digest
-					  (requires CONFIG_CMD_MEMORY)
 		CONFIG_CMD_SOFTSWITCH	* Soft switch setting command for BF60x
 		CONFIG_CMD_SOURCE	  "source" command Support
 		CONFIG_CMD_SPI		* SPI serial bus support
@@ -2679,15 +2677,6 @@ The following options need to be configured:
 		A better solution is to properly configure the firewall,
 		but sometimes that is not allowed.
 
-- Hashing support:
-		CONFIG_HASH_VERIFY
-
-		Enable the hash verify command (hash -v). This adds to code
-		size a little.
-
-		Note: There is also a sha1sum command, which should perhaps
-		be deprecated in favour of 'hash sha1'.
-
 - bootcount support:
 		CONFIG_BOOTCOUNT_LIMIT
 
diff --git a/arch/Kconfig b/arch/Kconfig
index 02e887ac86..6e291e7316 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -76,6 +76,7 @@ config SANDBOX
 	imply CMD_IOTRACE
 	imply LZMA
 	imply CMD_LZMADEC
+	imply HASH_VERIFY
 
 config SH
 	bool "SuperH architecture"
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 91f50b0637..0df99904a2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -504,6 +504,7 @@ config TARGET_BCMCYGNUS
 	bool "Support bcmcygnus"
 	select CPU_V7
 	imply CMD_HASH
+	imply HASH_VERIFY
 
 config TARGET_BCMNSP
 	bool "Support bcmnsp"
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 5b6c5ea328..9c5387e37a 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -19,6 +19,7 @@ config ARCH_EXYNOS5
 	select BOARD_EARLY_INIT_F
 	select SHA_HW_ACCEL
 	imply CMD_HASH
+	imply HASH_VERIFY
 	help
 	  Samsung Exynos5 SoC family are based on ARM Cortex-A15 CPU (and
 	  Cortex-A7 CPU in big.LITTLE configuration). There are multiple SoCs
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5ee52f62cc..d3580ec779 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -417,6 +417,18 @@ config MD5SUM_VERFIY
 	help
 	  Add -v option to verify data against an MD5 checksum.
 
+config CMD_SHA1SUM
+	bool "sha1sum"
+	select SHA1
+	help
+	  Compute SHA1 checksum.
+
+config SHA1SUM_VERFIY
+	bool "sha1sum -v"
+	depends on CMD_SHA1SUM
+	help
+	  Add -v option to verify data against an SHA1 checksum.
+
 config LOOPW
 	bool "loopw"
 	help
@@ -1068,6 +1080,12 @@ config CMD_HASH
 	  saved to memory or to an environment variable. It is also possible
 	  to verify a hash against data in memory.
 
+config HASH_VERIFY
+	bool "hash -v"
+	depends on CMD_HASH
+	help
+	  Add -v option to verify data against a hash.
+
 config CMD_TPM
 	bool "Enable the 'tpm' command"
 	depends on TPM
diff --git a/configs/bcm958622hr_defconfig b/configs/bcm958622hr_defconfig
index c2713c61fa..69b9fe878b 100644
--- a/configs/bcm958622hr_defconfig
+++ b/configs/bcm958622hr_defconfig
@@ -14,6 +14,7 @@ CONFIG_CMD_ASKENV=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_HASH=y
+CONFIG_HASH_VERIFY=y
 CONFIG_CMD_FAT=y
 # CONFIG_MMC is not set
 CONFIG_SYS_NS16550=y
diff --git a/include/configs/bcm_ep_board.h b/include/configs/bcm_ep_board.h
index 957cd9e0ba..53220491b8 100644
--- a/include/configs/bcm_ep_board.h
+++ b/include/configs/bcm_ep_board.h
@@ -66,9 +66,6 @@
 /* Commands */
 #define CONFIG_FAT_WRITE
 
-/* SHA hashing */
-#define CONFIG_HASH_VERIFY
-
 /* Enable Time Command */
 
 /* Misc utility code */
diff --git a/include/configs/exynos5-common.h b/include/configs/exynos5-common.h
index 6915dc1a48..378219d83a 100644
--- a/include/configs/exynos5-common.h
+++ b/include/configs/exynos5-common.h
@@ -131,9 +131,6 @@
 #define CONFIG_ENV_SROM_BANK		1
 #endif /*CONFIG_CMD_NET*/
 
-/* SHA hashing */
-#define CONFIG_HASH_VERIFY
-
 /* Enable Time Command */
 
 /* USB */
diff --git a/include/configs/imx6qdl_icore.h b/include/configs/imx6qdl_icore.h
index 741bdfa807..13fc48fa3a 100644
--- a/include/configs/imx6qdl_icore.h
+++ b/include/configs/imx6qdl_icore.h
@@ -125,7 +125,6 @@
 
 /* FIT */
 #ifdef CONFIG_FIT
-# define CONFIG_HASH_VERIFY
 # define CONFIG_IMAGE_FORMAT_LEGACY
 #endif
 
diff --git a/include/configs/imx6qdl_icore_rqs.h b/include/configs/imx6qdl_icore_rqs.h
index f52865b5a0..a588823da0 100644
--- a/include/configs/imx6qdl_icore_rqs.h
+++ b/include/configs/imx6qdl_icore_rqs.h
@@ -107,7 +107,6 @@
 
 /* FIT */
 #ifdef CONFIG_FIT
-# define CONFIG_HASH_VERIFY
 # define CONFIG_IMAGE_FORMAT_LEGACY
 #endif
 
diff --git a/include/configs/imx6ul_geam.h b/include/configs/imx6ul_geam.h
index 2e12b97767..1d48726086 100644
--- a/include/configs/imx6ul_geam.h
+++ b/include/configs/imx6ul_geam.h
@@ -124,7 +124,6 @@
 
 /* FIT */
 #ifdef CONFIG_FIT
-# define CONFIG_HASH_VERIFY
 # define CONFIG_IMAGE_FORMAT_LEGACY
 #endif
 
diff --git a/include/configs/imx6ul_isiot.h b/include/configs/imx6ul_isiot.h
index 76ae159da3..a0eb6e25fe 100644
--- a/include/configs/imx6ul_isiot.h
+++ b/include/configs/imx6ul_isiot.h
@@ -124,7 +124,6 @@
 
 /* FIT */
 #ifdef CONFIG_FIT
-# define CONFIG_HASH_VERIFY
 # define CONFIG_IMAGE_FORMAT_LEGACY
 #endif
 
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index c62b45e51c..fbbd6cd99b 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -98,8 +98,6 @@
 #define CONFIG_BOOTP_SERVERIP
 #define CONFIG_IP_DEFRAG
 
-#define CONFIG_HASH_VERIFY
-
 #define CONFIG_CMD_SANDBOX
 
 #define CONFIG_BOOTARGS ""
diff --git a/include/hash.h b/include/hash.h
index d81433772f..4f9a8cf1db 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -17,10 +17,6 @@ enum {
 	HASH_FLAG_ENV		= 1 << 1,	/* Allow env vars */
 };
 
-#if defined(CONFIG_SHA1SUM_VERIFY) || defined(CONFIG_CRC32_VERIFY)
-#define CONFIG_HASH_VERIFY
-#endif
-
 struct hash_algo {
 	const char *name;			/* Name of algorithm */
 	int digest_size;			/* Length of digest */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index e8f49ebe5d..a20f1c593c 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1074,7 +1074,6 @@ CONFIG_H264_FREQ
 CONFIG_H8300
 CONFIG_HALEAKALA
 CONFIG_HARD_SPI
-CONFIG_HASH_VERIFY
 CONFIG_HAS_DATAFLASH
 CONFIG_HAS_ETH0
 CONFIG_HAS_ETH1
-- 
2.11.0



More information about the U-Boot mailing list