mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] common: let MACHINE_ID select SHA1
@ 2022-02-09  8:51 Uwe Kleine-König
  2022-02-09  9:32 ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2022-02-09  8:51 UTC (permalink / raw)
  To: barebox; +Cc: Bastian Krause

SHA1 is a symbol that cannot be enabled manually and all other symbols
needing it, select it:

$ git grep -B3 -E '(depends on|select) SHA1\>' HEAD
HEAD:common/Kconfig-config MACHINE_ID
HEAD:common/Kconfig-    bool "compute unique machine-id"
HEAD:common/Kconfig-    depends on FLEXIBLE_BOOTARGS
HEAD:common/Kconfig:    depends on SHA1
--
HEAD:crypto/Kconfig-
HEAD:crypto/Kconfig-config DIGEST_SHA1_GENERIC
HEAD:crypto/Kconfig-    bool "SHA1"
HEAD:crypto/Kconfig:    select SHA1
--
HEAD:crypto/Kconfig-config DIGEST_SHA1_ARM
HEAD:crypto/Kconfig-    tristate "SHA1 digest algorithm (ARM-asm)"
HEAD:crypto/Kconfig-    depends on ARM
HEAD:crypto/Kconfig:    select SHA1

Fixes: aada84e72e15 ("common: machine_id: introduce machine id generation")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index e540cba7ebaa..79f6afd8de85 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1042,7 +1042,7 @@ config RESET_SOURCE
 config MACHINE_ID
 	bool "compute unique machine-id"
 	depends on FLEXIBLE_BOOTARGS
-	depends on SHA1
+	select SHA1
 	help
 	  Compute a persistent machine-specific id and store it to $global.machine_id.
 	  The id is a hash of device-specific information added via

base-commit: f1077640937f6e8139463136edff215163465599
-- 
2.34.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] common: let MACHINE_ID select SHA1
  2022-02-09  8:51 [PATCH] common: let MACHINE_ID select SHA1 Uwe Kleine-König
@ 2022-02-09  9:32 ` Ahmad Fatoum
  2022-02-09  9:59   ` [PATCH] crypto: consistently name the algo digest symbols HAVE_DIGEST_ Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2022-02-09  9:32 UTC (permalink / raw)
  To: Uwe Kleine-König, barebox; +Cc: Bastian Krause

On 09.02.22 09:51, Uwe Kleine-König wrote:
> SHA1 is a symbol that cannot be enabled manually and all other symbols
> needing it, select it:
> 
> $ git grep -B3 -E '(depends on|select) SHA1\>' HEAD
> HEAD:common/Kconfig-config MACHINE_ID
> HEAD:common/Kconfig-    bool "compute unique machine-id"
> HEAD:common/Kconfig-    depends on FLEXIBLE_BOOTARGS
> HEAD:common/Kconfig:    depends on SHA1
> --
> HEAD:crypto/Kconfig-
> HEAD:crypto/Kconfig-config DIGEST_SHA1_GENERIC
> HEAD:crypto/Kconfig-    bool "SHA1"
> HEAD:crypto/Kconfig:    select SHA1
> --
> HEAD:crypto/Kconfig-config DIGEST_SHA1_ARM
> HEAD:crypto/Kconfig-    tristate "SHA1 digest algorithm (ARM-asm)"
> HEAD:crypto/Kconfig-    depends on ARM
> HEAD:crypto/Kconfig:    select SHA1
> 
> Fixes: aada84e72e15 ("common: machine_id: introduce machine id generation")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

SHA1 is selected by either DIGEST_SHA1_GENERIC or DIGEST_SHA1_ARM.
I don't think this is correct.

> ---
>  common/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index e540cba7ebaa..79f6afd8de85 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1042,7 +1042,7 @@ config RESET_SOURCE
>  config MACHINE_ID
>  	bool "compute unique machine-id"
>  	depends on FLEXIBLE_BOOTARGS
> -	depends on SHA1
> +	select SHA1
>  	help
>  	  Compute a persistent machine-specific id and store it to $global.machine_id.
>  	  The id is a hash of device-specific information added via
> 
> base-commit: f1077640937f6e8139463136edff215163465599


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] crypto: consistently name the algo digest symbols HAVE_DIGEST_...
  2022-02-09  9:32 ` Ahmad Fatoum
@ 2022-02-09  9:59   ` Uwe Kleine-König
  2022-02-10 15:41     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2022-02-09  9:59 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Bastian Krause


[-- Attachment #1.1: Type: text/plain, Size: 4145 bytes --]

The better naming prevents confusion (for me at least) because
MACHINE_ID depends on a symbol that cannot be enabled manually.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
On Wed, Feb 09, 2022 at 10:32:21AM +0100, Ahmad Fatoum wrote:
> On 09.02.22 09:51, Uwe Kleine-König wrote:
> > SHA1 is a symbol that cannot be enabled manually and all other symbols
> > needing it, select it:
> > 
> > $ git grep -B3 -E '(depends on|select) SHA1\>' HEAD
> > HEAD:common/Kconfig-config MACHINE_ID
> > HEAD:common/Kconfig-    bool "compute unique machine-id"
> > HEAD:common/Kconfig-    depends on FLEXIBLE_BOOTARGS
> > HEAD:common/Kconfig:    depends on SHA1
> > --
> > HEAD:crypto/Kconfig-
> > HEAD:crypto/Kconfig-config DIGEST_SHA1_GENERIC
> > HEAD:crypto/Kconfig-    bool "SHA1"
> > HEAD:crypto/Kconfig:    select SHA1
> > --
> > HEAD:crypto/Kconfig-config DIGEST_SHA1_ARM
> > HEAD:crypto/Kconfig-    tristate "SHA1 digest algorithm (ARM-asm)"
> > HEAD:crypto/Kconfig-    depends on ARM
> > HEAD:crypto/Kconfig:    select SHA1
> > 
> > Fixes: aada84e72e15 ("common: machine_id: introduce machine id generation")
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> SHA1 is selected by either DIGEST_SHA1_GENERIC or DIGEST_SHA1_ARM.
> I don't think this is correct.

Yes, understood that now, too and agree my patch is bad.

My confusion wouldn't have happend with this patch:

 common/Kconfig |  2 +-
 crypto/Kconfig | 34 +++++++++++++++++-----------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index e540cba7ebaa..6e82f8900e6b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1042,7 +1042,7 @@ config RESET_SOURCE
 config MACHINE_ID
 	bool "compute unique machine-id"
 	depends on FLEXIBLE_BOOTARGS
-	depends on SHA1
+	depends on HAVE_DIGEST_SHA1
 	help
 	  Compute a persistent machine-specific id and store it to $global.machine_id.
 	  The id is a hash of device-specific information added via
diff --git a/crypto/Kconfig b/crypto/Kconfig
index ff83a40f5b43..19994c9d8372 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -14,25 +14,25 @@ menuconfig DIGEST
 
 if DIGEST
 
-config MD5
+config HAVE_DIGEST_MD5
 	bool
 
-config SHA1
+config HAVE_DIGEST_SHA1
 	bool
 
-config SHA224
+config HAVE_DIGEST_SHA224
 	bool
 
-config SHA256
+config HAVE_DIGEST_SHA256
 	bool
 
-config SHA384
+config HAVE_DIGEST_SHA384
 	bool
 
-config SHA512
+config HAVE_DIGEST_SHA512
 	bool
 
-config DIGEST_HMAC
+config HAVE_DIGEST_HMAC
 	bool
 
 config DIGEST_CRC32_GENERIC
@@ -41,36 +41,36 @@ config DIGEST_CRC32_GENERIC
 
 config DIGEST_MD5_GENERIC
 	bool "MD5"
-	select MD5
+	select HAVE_DIGEST_MD5
 
 config DIGEST_SHA1_GENERIC
 	bool "SHA1"
-	select SHA1
+	select HAVE_DIGEST_SHA1
 
 config DIGEST_SHA224_GENERIC
 	bool "SHA224"
-	select SHA224
+	select HAVE_DIGEST_SHA224
 
 config DIGEST_SHA256_GENERIC
 	bool "SHA256"
-	select SHA256
+	select HAVE_DIGEST_SHA256
 
 config DIGEST_SHA384_GENERIC
 	bool "SHA384"
-	select SHA384
+	select HAVE_DIGEST_SHA384
 
 config DIGEST_SHA512_GENERIC
 	bool "SHA512"
-	select SHA512
+	select HAVE_DIGEST_SHA512
 
 config DIGEST_HMAC_GENERIC
 	bool "HMAC"
-	select DIGEST_HMAC
+	select HAVE_DIGEST_HMAC
 
 config DIGEST_SHA1_ARM
 	tristate "SHA1 digest algorithm (ARM-asm)"
 	depends on ARM
-	select SHA1
+	select HAVE_DIGEST_SHA1
 	help
 	  SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2) implemented
 	  using optimized ARM assembler.
@@ -78,8 +78,8 @@ config DIGEST_SHA1_ARM
 config DIGEST_SHA256_ARM
 	tristate "SHA-224/256 digest algorithm (ARM-asm and NEON)"
 	depends on ARM
-	select SHA256
-	select SHA224
+	select HAVE_DIGEST_SHA256
+	select HAVE_DIGEST_SHA224
 	help
 	  SHA-256 secure hash standard (DFIPS 180-2) implemented
 	  using optimized ARM assembler and NEON, when available.
-- 
2.34.1


-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: consistently name the algo digest symbols HAVE_DIGEST_...
  2022-02-09  9:59   ` [PATCH] crypto: consistently name the algo digest symbols HAVE_DIGEST_ Uwe Kleine-König
@ 2022-02-10 15:41     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2022-02-10 15:41 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Ahmad Fatoum, barebox, Bastian Krause

On Wed, Feb 09, 2022 at 10:59:24AM +0100, Uwe Kleine-König wrote:
> The better naming prevents confusion (for me at least) because
> MACHINE_ID depends on a symbol that cannot be enabled manually.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Applied, thanks

Sascha

> On Wed, Feb 09, 2022 at 10:32:21AM +0100, Ahmad Fatoum wrote:
> > On 09.02.22 09:51, Uwe Kleine-König wrote:
> > > SHA1 is a symbol that cannot be enabled manually and all other symbols
> > > needing it, select it:
> > > 
> > > $ git grep -B3 -E '(depends on|select) SHA1\>' HEAD
> > > HEAD:common/Kconfig-config MACHINE_ID
> > > HEAD:common/Kconfig-    bool "compute unique machine-id"
> > > HEAD:common/Kconfig-    depends on FLEXIBLE_BOOTARGS
> > > HEAD:common/Kconfig:    depends on SHA1
> > > --
> > > HEAD:crypto/Kconfig-
> > > HEAD:crypto/Kconfig-config DIGEST_SHA1_GENERIC
> > > HEAD:crypto/Kconfig-    bool "SHA1"
> > > HEAD:crypto/Kconfig:    select SHA1
> > > --
> > > HEAD:crypto/Kconfig-config DIGEST_SHA1_ARM
> > > HEAD:crypto/Kconfig-    tristate "SHA1 digest algorithm (ARM-asm)"
> > > HEAD:crypto/Kconfig-    depends on ARM
> > > HEAD:crypto/Kconfig:    select SHA1
> > > 
> > > Fixes: aada84e72e15 ("common: machine_id: introduce machine id generation")
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 
> > SHA1 is selected by either DIGEST_SHA1_GENERIC or DIGEST_SHA1_ARM.
> > I don't think this is correct.
> 
> Yes, understood that now, too and agree my patch is bad.
> 
> My confusion wouldn't have happend with this patch:
> 
>  common/Kconfig |  2 +-
>  crypto/Kconfig | 34 +++++++++++++++++-----------------
>  2 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index e540cba7ebaa..6e82f8900e6b 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1042,7 +1042,7 @@ config RESET_SOURCE
>  config MACHINE_ID
>  	bool "compute unique machine-id"
>  	depends on FLEXIBLE_BOOTARGS
> -	depends on SHA1
> +	depends on HAVE_DIGEST_SHA1
>  	help
>  	  Compute a persistent machine-specific id and store it to $global.machine_id.
>  	  The id is a hash of device-specific information added via
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index ff83a40f5b43..19994c9d8372 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -14,25 +14,25 @@ menuconfig DIGEST
>  
>  if DIGEST
>  
> -config MD5
> +config HAVE_DIGEST_MD5
>  	bool
>  
> -config SHA1
> +config HAVE_DIGEST_SHA1
>  	bool
>  
> -config SHA224
> +config HAVE_DIGEST_SHA224
>  	bool
>  
> -config SHA256
> +config HAVE_DIGEST_SHA256
>  	bool
>  
> -config SHA384
> +config HAVE_DIGEST_SHA384
>  	bool
>  
> -config SHA512
> +config HAVE_DIGEST_SHA512
>  	bool
>  
> -config DIGEST_HMAC
> +config HAVE_DIGEST_HMAC
>  	bool
>  
>  config DIGEST_CRC32_GENERIC
> @@ -41,36 +41,36 @@ config DIGEST_CRC32_GENERIC
>  
>  config DIGEST_MD5_GENERIC
>  	bool "MD5"
> -	select MD5
> +	select HAVE_DIGEST_MD5
>  
>  config DIGEST_SHA1_GENERIC
>  	bool "SHA1"
> -	select SHA1
> +	select HAVE_DIGEST_SHA1
>  
>  config DIGEST_SHA224_GENERIC
>  	bool "SHA224"
> -	select SHA224
> +	select HAVE_DIGEST_SHA224
>  
>  config DIGEST_SHA256_GENERIC
>  	bool "SHA256"
> -	select SHA256
> +	select HAVE_DIGEST_SHA256
>  
>  config DIGEST_SHA384_GENERIC
>  	bool "SHA384"
> -	select SHA384
> +	select HAVE_DIGEST_SHA384
>  
>  config DIGEST_SHA512_GENERIC
>  	bool "SHA512"
> -	select SHA512
> +	select HAVE_DIGEST_SHA512
>  
>  config DIGEST_HMAC_GENERIC
>  	bool "HMAC"
> -	select DIGEST_HMAC
> +	select HAVE_DIGEST_HMAC
>  
>  config DIGEST_SHA1_ARM
>  	tristate "SHA1 digest algorithm (ARM-asm)"
>  	depends on ARM
> -	select SHA1
> +	select HAVE_DIGEST_SHA1
>  	help
>  	  SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2) implemented
>  	  using optimized ARM assembler.
> @@ -78,8 +78,8 @@ config DIGEST_SHA1_ARM
>  config DIGEST_SHA256_ARM
>  	tristate "SHA-224/256 digest algorithm (ARM-asm and NEON)"
>  	depends on ARM
> -	select SHA256
> -	select SHA224
> +	select HAVE_DIGEST_SHA256
> +	select HAVE_DIGEST_SHA224
>  	help
>  	  SHA-256 secure hash standard (DFIPS 180-2) implemented
>  	  using optimized ARM assembler and NEON, when available.
> -- 
> 2.34.1
> 
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | https://www.pengutronix.de/ |



> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-10 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09  8:51 [PATCH] common: let MACHINE_ID select SHA1 Uwe Kleine-König
2022-02-09  9:32 ` Ahmad Fatoum
2022-02-09  9:59   ` [PATCH] crypto: consistently name the algo digest symbols HAVE_DIGEST_ Uwe Kleine-König
2022-02-10 15:41     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox