[PATCH] Kconfig: Add support for hash and sha1sum commands

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Kconfig: Add support for hash and sha1sum commands

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

Signed-off-by: Daniel Thompson <[hidden email]>
---
 cmd/Kconfig | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index d9f7151bacdc..f459f8440346 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -338,6 +338,19 @@ config CMD_CRC32
  help
   Compute CRC32.

+config CMD_HASH
+ bool "hash"
+ default n
+ help
+  Compute a hash using any algorithm supported by hash_lookup_algo().
+
+config HASH_VERIFY
+ bool "hash -v"
+ default n
+ depends on CMD_HASH
+ help
+  Add -v option to verify data against a hash.
+
 config CMD_MD5SUM
  bool "md5sum"
  default n
@@ -352,6 +365,20 @@ config MD5SUM_VERFIY
  help
   Add -v option to verify data against an MD5 checksum.

+config CMD_SHA1SUM
+ bool "sha1sum"
+ default n
+ select SHA1
+ help
+  Compute SHA1 checksum.
+
+config SHA1SUM_VERFIY
+ bool "sha1sum -v"
+ default n
+ depends on CMD_SHA1SUM
+ help
+  Add -v option to verify data against an SHA1 checksum.
+
 config LOOPW
  bool "loopw"
  help
--
2.9.4

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Kconfig: Add support for hash and sha1sum commands

Simon Glass-3
Hi Daniel,

On 19 May 2017 at 10:26, Daniel Thompson <[hidden email]> wrote:
> Currently these (board agnostic) commands cannot be selected using
> menuconfig and friends. Fix this the obvious way.
>
> Signed-off-by: Daniel Thompson <[hidden email]>
> ---
>  cmd/Kconfig | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

Great to see this. However CMD_HASH is already in progress at
u-boot-dm/kconfig-working. I hope it will make it to mainline soon.
But in the meantime could you please  rebase on that and send v2?

Regards,
Simon
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Kconfig: Add support for hash and sha1sum commands

Tom Rini-4
On Mon, May 22, 2017 at 02:26:57PM -0600, Simon Glass wrote:

> Hi Daniel,
>
> On 19 May 2017 at 10:26, Daniel Thompson <[hidden email]> wrote:
> > Currently these (board agnostic) commands cannot be selected using
> > menuconfig and friends. Fix this the obvious way.
> >
> > Signed-off-by: Daniel Thompson <[hidden email]>
> > ---
> >  cmd/Kconfig | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
>
> Great to see this. However CMD_HASH is already in progress at
> u-boot-dm/kconfig-working. I hope it will make it to mainline soon.
> But in the meantime could you please  rebase on that and send v2?
Since this needs moveconfig.py run as well, I'll just v2 it, thanks!

--
Tom

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Kconfig: Add support for hash and sha1sum commands

Daniel Thompson
On 22/05/17 22:17, Tom Rini wrote:

> On Mon, May 22, 2017 at 02:26:57PM -0600, Simon Glass wrote:
>> Hi Daniel,
>>
>> On 19 May 2017 at 10:26, Daniel Thompson <[hidden email]> wrote:
>>> Currently these (board agnostic) commands cannot be selected using
>>> menuconfig and friends. Fix this the obvious way.
>>>
>>> Signed-off-by: Daniel Thompson <[hidden email]>
>>> ---
>>>   cmd/Kconfig | 27 +++++++++++++++++++++++++++
>>>   1 file changed, 27 insertions(+)
>>
>> Great to see this. However CMD_HASH is already in progress at
>> u-boot-dm/kconfig-working. I hope it will make it to mainline soon.
>> But in the meantime could you please  rebase on that and send v2?
>
> Since this needs moveconfig.py run as well, I'll just v2 it, thanks!

Does that translate into "Daniel, don't worry about the rebase there are
other things that I'd need to change as well and its quicker and easier
for me just to do them".

I totally happy with that translation but just want to check it's correct.


Daniel.

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Kconfig: Add support for hash and sha1sum commands

Tom Rini-4
On Tue, May 23, 2017 at 11:10:35AM +0100, Daniel Thompson wrote:

> On 22/05/17 22:17, Tom Rini wrote:
> >On Mon, May 22, 2017 at 02:26:57PM -0600, Simon Glass wrote:
> >>Hi Daniel,
> >>
> >>On 19 May 2017 at 10:26, Daniel Thompson <[hidden email]> wrote:
> >>>Currently these (board agnostic) commands cannot be selected using
> >>>menuconfig and friends. Fix this the obvious way.
> >>>
> >>>Signed-off-by: Daniel Thompson <[hidden email]>
> >>>---
> >>>  cmd/Kconfig | 27 +++++++++++++++++++++++++++
> >>>  1 file changed, 27 insertions(+)
> >>
> >>Great to see this. However CMD_HASH is already in progress at
> >>u-boot-dm/kconfig-working. I hope it will make it to mainline soon.
> >>But in the meantime could you please  rebase on that and send v2?
> >
> >Since this needs moveconfig.py run as well, I'll just v2 it, thanks!
>
> Does that translate into "Daniel, don't worry about the rebase there
> are other things that I'd need to change as well and its quicker and
> easier for me just to do them".
>
> I totally happy with that translation but just want to check it's correct.
Correct, I'll pick it up and rebase it and so forth.

--
Tom

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Tom Rini-4
In reply to this post by Daniel Thompson
From: Daniel Thompson <[hidden email]>

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

Signed-off-by: Daniel Thompson <[hidden email]>
[trini: Re-apply, add imply for a few cases, run moveconfig.py]
Signed-off-by: Tom Rini <[hidden email]>
---
 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

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/1] Kconfig: Add support for hash and sha1sum commands

Simon Glass-3
On 27 May 2017 at 08:59, Tom Rini <[hidden email]> wrote:

> From: Daniel Thompson <[hidden email]>
>
> Currently these (board agnostic) commands cannot be selected using
> menuconfig and friends. Fix this the obvious way.
>
> Signed-off-by: Daniel Thompson <[hidden email]>
> [trini: Re-apply, add imply for a few cases, run moveconfig.py]
> Signed-off-by: Tom Rini <[hidden email]>
> ---
>  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(-)

Reviewed-by: Simon Glass <[hidden email]>
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot