Skip to contentSkip to conversation

Kconfig: Add CONFIG_HASH to enable hashing API

PATCH New Simon Glass 2 participants 3 messages May 17, 2017 – May 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v4 30/48 Kconfig: Add CONFIG_HASH to enable hashing API

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.

---

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(-)
cmd/Kconfig +2 -0
index b05e69a8b7..1e3cd02703 100644
@@ -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
common/Kconfig +12 -0
index 1879aefaf8..5c39663f56 100644
@@ -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"
common/Makefile +1 -1
index 14d01844ad..b2d663530d 100644
@@ -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
 
common/hash.c +2 -2
index b645298afc..a0eded98d0 100644
@@ -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 */
Signature · 1 line
2.13.0.303.g4ebf302169-goog
#1 lore raw

PATCH v4 30/48 Kconfig: Add CONFIG_HASH to enable hashing API

Quoted 5 lines · Simon Glass

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170517/93e791de/attachment.sig>
#2 lore raw

PATCH v4 30/48 Kconfig: Add CONFIG_HASH to enable hashing API

In reply to Simon Glass
Quoted 6 lines · Simon Glass

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170522/2cdc503e/attachment.sig>