Skip to content

Commit

Permalink
Kconfig: Add CONFIG_HASH to enable hashing API
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
  • Loading branch information
sjg20 authored and trini committed May 22, 2017
1 parent 551c393 commit d70f919
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ config CMD_MEMORY

config CMD_CRC32
bool "crc32"
select HASH
default y
help
Compute CRC32.
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions common/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions common/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit d70f919

Please sign in to comment.