[PATCH v6 01/17] s390/sha3: Rename conflicting functions

David Howells posted 17 patches 3 months, 3 weeks ago
[PATCH v6 01/17] s390/sha3: Rename conflicting functions
Posted by David Howells 3 months, 3 weeks ago
Rename the s390 sha3_* functions to have an "s390_" prefix to avoid
conflict with generic code.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-By: Harald Freudenberger <freude@linux.ibm.com>
cc: Eric Biggers <ebiggers@kernel.org>
cc: Jason A. Donenfeld <Jason@zx2c4.com>
cc: Ard Biesheuvel <ardb@kernel.org>
cc: Holger Dengler <dengler@linux.ibm.com>
cc: Herbert Xu <herbert@gondor.apana.org.au>
cc: Stephan Mueller <smueller@chronox.de>
cc: linux-crypto@vger.kernel.org
cc: linux-s390@vger.kernel.org
---
 arch/s390/crypto/sha3_256_s390.c | 26 +++++++++++++-------------
 arch/s390/crypto/sha3_512_s390.c | 26 +++++++++++++-------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/arch/s390/crypto/sha3_256_s390.c b/arch/s390/crypto/sha3_256_s390.c
index 03bb4f4bab70..fd5ecae60a57 100644
--- a/arch/s390/crypto/sha3_256_s390.c
+++ b/arch/s390/crypto/sha3_256_s390.c
@@ -19,7 +19,7 @@
 
 #include "sha.h"
 
-static int sha3_256_init(struct shash_desc *desc)
+static int s390_sha3_256_init(struct shash_desc *desc)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 
@@ -32,7 +32,7 @@ static int sha3_256_init(struct shash_desc *desc)
 	return 0;
 }
 
-static int sha3_256_export(struct shash_desc *desc, void *out)
+static int s390_sha3_256_export(struct shash_desc *desc, void *out)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 	union {
@@ -50,7 +50,7 @@ static int sha3_256_export(struct shash_desc *desc, void *out)
 	return 0;
 }
 
-static int sha3_256_import(struct shash_desc *desc, const void *in)
+static int s390_sha3_256_import(struct shash_desc *desc, const void *in)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 	union {
@@ -68,22 +68,22 @@ static int sha3_256_import(struct shash_desc *desc, const void *in)
 	return 0;
 }
 
-static int sha3_224_import(struct shash_desc *desc, const void *in)
+static int s390_sha3_224_import(struct shash_desc *desc, const void *in)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 
-	sha3_256_import(desc, in);
+	s390_sha3_256_import(desc, in);
 	sctx->func = CPACF_KIMD_SHA3_224;
 	return 0;
 }
 
 static struct shash_alg sha3_256_alg = {
 	.digestsize	=	SHA3_256_DIGEST_SIZE,	   /* = 32 */
-	.init		=	sha3_256_init,
+	.init		=	s390_sha3_256_init,
 	.update		=	s390_sha_update_blocks,
 	.finup		=	s390_sha_finup,
-	.export		=	sha3_256_export,
-	.import		=	sha3_256_import,
+	.export		=	s390_sha3_256_export,
+	.import		=	s390_sha3_256_import,
 	.descsize	=	S390_SHA_CTX_SIZE,
 	.statesize	=	SHA3_STATE_SIZE,
 	.base		=	{
@@ -96,22 +96,22 @@ static struct shash_alg sha3_256_alg = {
 	}
 };
 
-static int sha3_224_init(struct shash_desc *desc)
+static int s390_sha3_224_init(struct shash_desc *desc)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 
-	sha3_256_init(desc);
+	s390_sha3_256_init(desc);
 	sctx->func = CPACF_KIMD_SHA3_224;
 	return 0;
 }
 
 static struct shash_alg sha3_224_alg = {
 	.digestsize	=	SHA3_224_DIGEST_SIZE,
-	.init		=	sha3_224_init,
+	.init		=	s390_sha3_224_init,
 	.update		=	s390_sha_update_blocks,
 	.finup		=	s390_sha_finup,
-	.export		=	sha3_256_export, /* same as for 256 */
-	.import		=	sha3_224_import, /* function code different! */
+	.export		=	s390_sha3_256_export, /* same as for 256 */
+	.import		=	s390_sha3_224_import, /* function code different! */
 	.descsize	=	S390_SHA_CTX_SIZE,
 	.statesize	=	SHA3_STATE_SIZE,
 	.base		=	{
diff --git a/arch/s390/crypto/sha3_512_s390.c b/arch/s390/crypto/sha3_512_s390.c
index a5c9690eecb1..f4b52a3a0433 100644
--- a/arch/s390/crypto/sha3_512_s390.c
+++ b/arch/s390/crypto/sha3_512_s390.c
@@ -18,7 +18,7 @@
 
 #include "sha.h"
 
-static int sha3_512_init(struct shash_desc *desc)
+static int s390_sha3_512_init(struct shash_desc *desc)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 
@@ -31,7 +31,7 @@ static int sha3_512_init(struct shash_desc *desc)
 	return 0;
 }
 
-static int sha3_512_export(struct shash_desc *desc, void *out)
+static int s390_sha3_512_export(struct shash_desc *desc, void *out)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 	union {
@@ -49,7 +49,7 @@ static int sha3_512_export(struct shash_desc *desc, void *out)
 	return 0;
 }
 
-static int sha3_512_import(struct shash_desc *desc, const void *in)
+static int s390_sha3_512_import(struct shash_desc *desc, const void *in)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 	union {
@@ -67,22 +67,22 @@ static int sha3_512_import(struct shash_desc *desc, const void *in)
 	return 0;
 }
 
-static int sha3_384_import(struct shash_desc *desc, const void *in)
+static int s390_sha3_384_import(struct shash_desc *desc, const void *in)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 
-	sha3_512_import(desc, in);
+	s390_sha3_512_import(desc, in);
 	sctx->func = CPACF_KIMD_SHA3_384;
 	return 0;
 }
 
 static struct shash_alg sha3_512_alg = {
 	.digestsize	=	SHA3_512_DIGEST_SIZE,
-	.init		=	sha3_512_init,
+	.init		=	s390_sha3_512_init,
 	.update		=	s390_sha_update_blocks,
 	.finup		=	s390_sha_finup,
-	.export		=	sha3_512_export,
-	.import		=	sha3_512_import,
+	.export		=	s390_sha3_512_export,
+	.import		=	s390_sha3_512_import,
 	.descsize	=	S390_SHA_CTX_SIZE,
 	.statesize	=	SHA3_STATE_SIZE,
 	.base		=	{
@@ -97,22 +97,22 @@ static struct shash_alg sha3_512_alg = {
 
 MODULE_ALIAS_CRYPTO("sha3-512");
 
-static int sha3_384_init(struct shash_desc *desc)
+static int s390_sha3_384_init(struct shash_desc *desc)
 {
 	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
 
-	sha3_512_init(desc);
+	s390_sha3_512_init(desc);
 	sctx->func = CPACF_KIMD_SHA3_384;
 	return 0;
 }
 
 static struct shash_alg sha3_384_alg = {
 	.digestsize	=	SHA3_384_DIGEST_SIZE,
-	.init		=	sha3_384_init,
+	.init		=	s390_sha3_384_init,
 	.update		=	s390_sha_update_blocks,
 	.finup		=	s390_sha_finup,
-	.export		=	sha3_512_export, /* same as for 512 */
-	.import		=	sha3_384_import, /* function code different! */
+	.export		=	s390_sha3_512_export, /* same as for 512 */
+	.import		=	s390_sha3_384_import, /* function code different! */
 	.descsize	=	S390_SHA_CTX_SIZE,
 	.statesize	=	SHA3_STATE_SIZE,
 	.base		=	{
Re: [PATCH v6 01/17] s390/sha3: Rename conflicting functions
Posted by Christophe Leroy 3 months, 3 weeks ago

Le 17/10/2025 à 16:42, David Howells a écrit :
> Rename the s390 sha3_* functions to have an "s390_" prefix to avoid
> conflict with generic code.

The functions are static, why would they conflict with generic code ?

Also generic code doesn't have such functions at the moment, are they 
added by a follow patch ?

Christophe

> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> Acked-By: Harald Freudenberger <freude@linux.ibm.com>
> cc: Eric Biggers <ebiggers@kernel.org>
> cc: Jason A. Donenfeld <Jason@zx2c4.com>
> cc: Ard Biesheuvel <ardb@kernel.org>
> cc: Holger Dengler <dengler@linux.ibm.com>
> cc: Herbert Xu <herbert@gondor.apana.org.au>
> cc: Stephan Mueller <smueller@chronox.de>
> cc: linux-crypto@vger.kernel.org
> cc: linux-s390@vger.kernel.org
> ---
>   arch/s390/crypto/sha3_256_s390.c | 26 +++++++++++++-------------
>   arch/s390/crypto/sha3_512_s390.c | 26 +++++++++++++-------------
>   2 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/s390/crypto/sha3_256_s390.c b/arch/s390/crypto/sha3_256_s390.c
> index 03bb4f4bab70..fd5ecae60a57 100644
> --- a/arch/s390/crypto/sha3_256_s390.c
> +++ b/arch/s390/crypto/sha3_256_s390.c
> @@ -19,7 +19,7 @@
>   
>   #include "sha.h"
>   
> -static int sha3_256_init(struct shash_desc *desc)
> +static int s390_sha3_256_init(struct shash_desc *desc)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   
> @@ -32,7 +32,7 @@ static int sha3_256_init(struct shash_desc *desc)
>   	return 0;
>   }
>   
> -static int sha3_256_export(struct shash_desc *desc, void *out)
> +static int s390_sha3_256_export(struct shash_desc *desc, void *out)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   	union {
> @@ -50,7 +50,7 @@ static int sha3_256_export(struct shash_desc *desc, void *out)
>   	return 0;
>   }
>   
> -static int sha3_256_import(struct shash_desc *desc, const void *in)
> +static int s390_sha3_256_import(struct shash_desc *desc, const void *in)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   	union {
> @@ -68,22 +68,22 @@ static int sha3_256_import(struct shash_desc *desc, const void *in)
>   	return 0;
>   }
>   
> -static int sha3_224_import(struct shash_desc *desc, const void *in)
> +static int s390_sha3_224_import(struct shash_desc *desc, const void *in)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   
> -	sha3_256_import(desc, in);
> +	s390_sha3_256_import(desc, in);
>   	sctx->func = CPACF_KIMD_SHA3_224;
>   	return 0;
>   }
>   
>   static struct shash_alg sha3_256_alg = {
>   	.digestsize	=	SHA3_256_DIGEST_SIZE,	   /* = 32 */
> -	.init		=	sha3_256_init,
> +	.init		=	s390_sha3_256_init,
>   	.update		=	s390_sha_update_blocks,
>   	.finup		=	s390_sha_finup,
> -	.export		=	sha3_256_export,
> -	.import		=	sha3_256_import,
> +	.export		=	s390_sha3_256_export,
> +	.import		=	s390_sha3_256_import,
>   	.descsize	=	S390_SHA_CTX_SIZE,
>   	.statesize	=	SHA3_STATE_SIZE,
>   	.base		=	{
> @@ -96,22 +96,22 @@ static struct shash_alg sha3_256_alg = {
>   	}
>   };
>   
> -static int sha3_224_init(struct shash_desc *desc)
> +static int s390_sha3_224_init(struct shash_desc *desc)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   
> -	sha3_256_init(desc);
> +	s390_sha3_256_init(desc);
>   	sctx->func = CPACF_KIMD_SHA3_224;
>   	return 0;
>   }
>   
>   static struct shash_alg sha3_224_alg = {
>   	.digestsize	=	SHA3_224_DIGEST_SIZE,
> -	.init		=	sha3_224_init,
> +	.init		=	s390_sha3_224_init,
>   	.update		=	s390_sha_update_blocks,
>   	.finup		=	s390_sha_finup,
> -	.export		=	sha3_256_export, /* same as for 256 */
> -	.import		=	sha3_224_import, /* function code different! */
> +	.export		=	s390_sha3_256_export, /* same as for 256 */
> +	.import		=	s390_sha3_224_import, /* function code different! */
>   	.descsize	=	S390_SHA_CTX_SIZE,
>   	.statesize	=	SHA3_STATE_SIZE,
>   	.base		=	{
> diff --git a/arch/s390/crypto/sha3_512_s390.c b/arch/s390/crypto/sha3_512_s390.c
> index a5c9690eecb1..f4b52a3a0433 100644
> --- a/arch/s390/crypto/sha3_512_s390.c
> +++ b/arch/s390/crypto/sha3_512_s390.c
> @@ -18,7 +18,7 @@
>   
>   #include "sha.h"
>   
> -static int sha3_512_init(struct shash_desc *desc)
> +static int s390_sha3_512_init(struct shash_desc *desc)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   
> @@ -31,7 +31,7 @@ static int sha3_512_init(struct shash_desc *desc)
>   	return 0;
>   }
>   
> -static int sha3_512_export(struct shash_desc *desc, void *out)
> +static int s390_sha3_512_export(struct shash_desc *desc, void *out)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   	union {
> @@ -49,7 +49,7 @@ static int sha3_512_export(struct shash_desc *desc, void *out)
>   	return 0;
>   }
>   
> -static int sha3_512_import(struct shash_desc *desc, const void *in)
> +static int s390_sha3_512_import(struct shash_desc *desc, const void *in)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   	union {
> @@ -67,22 +67,22 @@ static int sha3_512_import(struct shash_desc *desc, const void *in)
>   	return 0;
>   }
>   
> -static int sha3_384_import(struct shash_desc *desc, const void *in)
> +static int s390_sha3_384_import(struct shash_desc *desc, const void *in)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   
> -	sha3_512_import(desc, in);
> +	s390_sha3_512_import(desc, in);
>   	sctx->func = CPACF_KIMD_SHA3_384;
>   	return 0;
>   }
>   
>   static struct shash_alg sha3_512_alg = {
>   	.digestsize	=	SHA3_512_DIGEST_SIZE,
> -	.init		=	sha3_512_init,
> +	.init		=	s390_sha3_512_init,
>   	.update		=	s390_sha_update_blocks,
>   	.finup		=	s390_sha_finup,
> -	.export		=	sha3_512_export,
> -	.import		=	sha3_512_import,
> +	.export		=	s390_sha3_512_export,
> +	.import		=	s390_sha3_512_import,
>   	.descsize	=	S390_SHA_CTX_SIZE,
>   	.statesize	=	SHA3_STATE_SIZE,
>   	.base		=	{
> @@ -97,22 +97,22 @@ static struct shash_alg sha3_512_alg = {
>   
>   MODULE_ALIAS_CRYPTO("sha3-512");
>   
> -static int sha3_384_init(struct shash_desc *desc)
> +static int s390_sha3_384_init(struct shash_desc *desc)
>   {
>   	struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
>   
> -	sha3_512_init(desc);
> +	s390_sha3_512_init(desc);
>   	sctx->func = CPACF_KIMD_SHA3_384;
>   	return 0;
>   }
>   
>   static struct shash_alg sha3_384_alg = {
>   	.digestsize	=	SHA3_384_DIGEST_SIZE,
> -	.init		=	sha3_384_init,
> +	.init		=	s390_sha3_384_init,
>   	.update		=	s390_sha_update_blocks,
>   	.finup		=	s390_sha_finup,
> -	.export		=	sha3_512_export, /* same as for 512 */
> -	.import		=	sha3_384_import, /* function code different! */
> +	.export		=	s390_sha3_512_export, /* same as for 512 */
> +	.import		=	s390_sha3_384_import, /* function code different! */
>   	.descsize	=	S390_SHA_CTX_SIZE,
>   	.statesize	=	SHA3_STATE_SIZE,
>   	.base		=	{
> 
> 

Re: [PATCH v6 01/17] s390/sha3: Rename conflicting functions
Posted by David Howells 3 months, 3 weeks ago
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:

> Le 17/10/2025 à 16:42, David Howells a écrit :
> > Rename the s390 sha3_* functions to have an "s390_" prefix to avoid
> > conflict with generic code.
> 
> The functions are static, why would they conflict with generic code ?

Because of #include <crypto/sha3.h>

> Also generic code doesn't have such functions at the moment, are they added by
> a follow patch ?

Yes.  See patch 3.

David