mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* sha2 digest on ppc
@ 2022-03-18  9:14 Barbier, Renaud
  2022-03-22  8:07 ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Barbier, Renaud @ 2022-03-18  9:14 UTC (permalink / raw)
  To: Barebox List

Commit 03fb5524b06 has changed the configuration selection for hash algorithm. For instance:

-config SHA256
+config HAVE_DIGEST_SHA256
 	Bool

This breaks on my PPC platform as the configuration selection has not been changed in crypto/sha2.c
if (!IS_ENABLED(CONFIG_SHA256))

Still working on my ARM platform because the algo is registered somewhere else (arch/arm/crypto/sha256_glue.c)

RENAUD: sha256_digest_register
RENAUD: sha256_digest_register: ALGO NOT REGISTERED
...
RENAUD: digest_algo_get_by_name: sha256 sha256
RENAUD: digest_algo_get_by_name: sha224 sha256
RENAUD: digest_algo_get_by_name: md5 sha256
FIT: /images/kernel-1/hash-1: hash OK


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


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

* Re: sha2 digest on ppc
  2022-03-18  9:14 sha2 digest on ppc Barbier, Renaud
@ 2022-03-22  8:07 ` Ahmad Fatoum
  2022-03-22  9:00   ` [PATCH] crypto: Followup to crypto symbol renaming for algo registration Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2022-03-22  8:07 UTC (permalink / raw)
  To: Barbier, Renaud, Barebox List, Uwe Kleine-König

Hello Renaud,

On 18.03.22 10:14, Barbier, Renaud wrote:
> Commit 03fb5524b06 has changed the configuration selection for hash algorithm. For instance:
> 
> -config SHA256
> +config HAVE_DIGEST_SHA256
>  	Bool
> 
> This breaks on my PPC platform as the configuration selection has not been changed in crypto/sha2.c
> if (!IS_ENABLED(CONFIG_SHA256))
> 
> Still working on my ARM platform because the algo is registered somewhere else (arch/arm/crypto/sha256_glue.c)
> 
> RENAUD: sha256_digest_register
> RENAUD: sha256_digest_register: ALGO NOT REGISTERED
> ...
> RENAUD: digest_algo_get_by_name: sha256 sha256
> RENAUD: digest_algo_get_by_name: sha224 sha256
> RENAUD: digest_algo_get_by_name: md5 sha256
> FIT: /images/kernel-1/hash-1: hash OK

Indeed. There are other instances as well broken by this.
This already got into a release unfortunately.

Cc += Uwe, who introduced above mentioned commit.

Cheers,
Ahmad

> 
> 
> _______________________________________________
> 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

* [PATCH] crypto: Followup to crypto symbol renaming for algo registration
  2022-03-22  8:07 ` Ahmad Fatoum
@ 2022-03-22  9:00   ` Uwe Kleine-König
  2022-03-28 10:03     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2022-03-22  9:00 UTC (permalink / raw)
  To: Renaud Barbier; +Cc: Ahmad Fatoum, barebox

The symbols were renamed to a nicer and consistent naming scheme, but I
missed to adapt a few usages.

This was done using:

	perl -p -i -e 's/\bCONFIG_(?:DIGEST_)?(MD5|SHA1|SHA224|SHA256|SHA384|SHA512|HMAC)\b/CONFIG_HAVE_DIGEST_$1/;' crypto/hmac.c crypto/sha2.c crypto/sha4.c

Now there don't seem to be any old names left:

Reported-by: Renaud Barbier <Renaud.Barbier@ametek.com>
Fixes: 03fb5524b064 ("crypto: consistently name the algo digest symbols HAVE_DIGEST_...")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 crypto/hmac.c | 12 ++++++------
 crypto/sha2.c |  4 ++--
 crypto/sha4.c |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/crypto/hmac.c b/crypto/hmac.c
index 37b270df7a95..20fc470d9059 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -181,17 +181,17 @@ static int digest_hmac_register(char *name, unsigned int pad_length)
 
 static int digest_hmac_initcall(void)
 {
-	if (IS_ENABLED(CONFIG_MD5))
+	if (IS_ENABLED(CONFIG_HAVE_DIGEST_MD5))
 		digest_hmac_register("md5", 64);
-	if (IS_ENABLED(CONFIG_SHA1))
+	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA1))
 		digest_hmac_register("sha1", 64);
-	if (IS_ENABLED(CONFIG_SHA224))
+	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA224))
 		digest_hmac_register("sha224", 64);
-	if (IS_ENABLED(CONFIG_SHA256))
+	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA256))
 		digest_hmac_register("sha256", 64);
-	if (IS_ENABLED(CONFIG_SHA384))
+	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA384))
 		digest_hmac_register("sha384", 128);
-	if (IS_ENABLED(CONFIG_SHA512))
+	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA512))
 		digest_hmac_register("sha512", 128);
 
 	return 0;
diff --git a/crypto/sha2.c b/crypto/sha2.c
index 013f5bb3b248..cac509564814 100644
--- a/crypto/sha2.c
+++ b/crypto/sha2.c
@@ -338,7 +338,7 @@ static struct digest_algo m224 = {
 
 static int sha224_digest_register(void)
 {
-	if (!IS_ENABLED(CONFIG_SHA224))
+	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA224))
 		return 0;
 
 	return digest_algo_register(&m224);
@@ -365,7 +365,7 @@ struct digest_algo m256 = {
 #ifndef __PBL__
 static int sha256_digest_register(void)
 {
-	if (!IS_ENABLED(CONFIG_SHA256))
+	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA256))
 		return 0;
 
 	return digest_algo_register(&m256);
diff --git a/crypto/sha4.c b/crypto/sha4.c
index a2e90c0a2cae..8c94f5011dc2 100644
--- a/crypto/sha4.c
+++ b/crypto/sha4.c
@@ -258,7 +258,7 @@ static struct digest_algo m384 = {
 
 static int sha384_digest_register(void)
 {
-	if (!IS_ENABLED(CONFIG_SHA384))
+	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA384))
 		return 0;
 
 	return digest_algo_register(&m384);
@@ -284,7 +284,7 @@ static struct digest_algo m512 = {
 
 static int sha512_digest_register(void)
 {
-	if (!IS_ENABLED(CONFIG_SHA512))
+	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA512))
 		return 0;
 
 	return digest_algo_register(&m512);
-- 
2.35.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] crypto: Followup to crypto symbol renaming for algo registration
  2022-03-22  9:00   ` [PATCH] crypto: Followup to crypto symbol renaming for algo registration Uwe Kleine-König
@ 2022-03-28 10:03     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2022-03-28 10:03 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Renaud Barbier, Ahmad Fatoum, barebox

On Tue, Mar 22, 2022 at 10:00:07AM +0100, Uwe Kleine-König wrote:
> The symbols were renamed to a nicer and consistent naming scheme, but I
> missed to adapt a few usages.
> 
> This was done using:
> 
> 	perl -p -i -e 's/\bCONFIG_(?:DIGEST_)?(MD5|SHA1|SHA224|SHA256|SHA384|SHA512|HMAC)\b/CONFIG_HAVE_DIGEST_$1/;' crypto/hmac.c crypto/sha2.c crypto/sha4.c
> 
> Now there don't seem to be any old names left:
> 
> Reported-by: Renaud Barbier <Renaud.Barbier@ametek.com>
> Fixes: 03fb5524b064 ("crypto: consistently name the algo digest symbols HAVE_DIGEST_...")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  crypto/hmac.c | 12 ++++++------
>  crypto/sha2.c |  4 ++--
>  crypto/sha4.c |  4 ++--
>  3 files changed, 10 insertions(+), 10 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/crypto/hmac.c b/crypto/hmac.c
> index 37b270df7a95..20fc470d9059 100644
> --- a/crypto/hmac.c
> +++ b/crypto/hmac.c
> @@ -181,17 +181,17 @@ static int digest_hmac_register(char *name, unsigned int pad_length)
>  
>  static int digest_hmac_initcall(void)
>  {
> -	if (IS_ENABLED(CONFIG_MD5))
> +	if (IS_ENABLED(CONFIG_HAVE_DIGEST_MD5))
>  		digest_hmac_register("md5", 64);
> -	if (IS_ENABLED(CONFIG_SHA1))
> +	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA1))
>  		digest_hmac_register("sha1", 64);
> -	if (IS_ENABLED(CONFIG_SHA224))
> +	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA224))
>  		digest_hmac_register("sha224", 64);
> -	if (IS_ENABLED(CONFIG_SHA256))
> +	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA256))
>  		digest_hmac_register("sha256", 64);
> -	if (IS_ENABLED(CONFIG_SHA384))
> +	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA384))
>  		digest_hmac_register("sha384", 128);
> -	if (IS_ENABLED(CONFIG_SHA512))
> +	if (IS_ENABLED(CONFIG_HAVE_DIGEST_SHA512))
>  		digest_hmac_register("sha512", 128);
>  
>  	return 0;
> diff --git a/crypto/sha2.c b/crypto/sha2.c
> index 013f5bb3b248..cac509564814 100644
> --- a/crypto/sha2.c
> +++ b/crypto/sha2.c
> @@ -338,7 +338,7 @@ static struct digest_algo m224 = {
>  
>  static int sha224_digest_register(void)
>  {
> -	if (!IS_ENABLED(CONFIG_SHA224))
> +	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA224))
>  		return 0;
>  
>  	return digest_algo_register(&m224);
> @@ -365,7 +365,7 @@ struct digest_algo m256 = {
>  #ifndef __PBL__
>  static int sha256_digest_register(void)
>  {
> -	if (!IS_ENABLED(CONFIG_SHA256))
> +	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA256))
>  		return 0;
>  
>  	return digest_algo_register(&m256);
> diff --git a/crypto/sha4.c b/crypto/sha4.c
> index a2e90c0a2cae..8c94f5011dc2 100644
> --- a/crypto/sha4.c
> +++ b/crypto/sha4.c
> @@ -258,7 +258,7 @@ static struct digest_algo m384 = {
>  
>  static int sha384_digest_register(void)
>  {
> -	if (!IS_ENABLED(CONFIG_SHA384))
> +	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA384))
>  		return 0;
>  
>  	return digest_algo_register(&m384);
> @@ -284,7 +284,7 @@ static struct digest_algo m512 = {
>  
>  static int sha512_digest_register(void)
>  {
> -	if (!IS_ENABLED(CONFIG_SHA512))
> +	if (!IS_ENABLED(CONFIG_HAVE_DIGEST_SHA512))
>  		return 0;
>  
>  	return digest_algo_register(&m512);
> -- 
> 2.35.1
> 
> 
> _______________________________________________
> 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-03-28 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18  9:14 sha2 digest on ppc Barbier, Renaud
2022-03-22  8:07 ` Ahmad Fatoum
2022-03-22  9:00   ` [PATCH] crypto: Followup to crypto symbol renaming for algo registration Uwe Kleine-König
2022-03-28 10:03     ` Sascha Hauer

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