Commit e0fca177 authored by Eric Biggers's avatar Eric Biggers
Browse files

crypto: sha512 - Rename conflicting symbols



Rename existing functions and structs in architecture-optimized SHA-512
code that had names conflicting with the upcoming library interface
which will be added to <crypto/sha2.h>: sha384_init, sha512_init,
sha512_update, sha384, and sha512.

Note: all affected code will be superseded by later commits that migrate
the arch-optimized SHA-512 code into the library.  This commit simply
keeps the kernel building for the initial introduction of the library.

Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250630160320.2888-2-ebiggers@kernel.org


Signed-off-by: default avatarEric Biggers <ebiggers@kernel.org>
parent e49a3eac
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ static void sha512_arm64_transform(struct sha512_state *sst, u8 const *src,
	sha512_blocks_arch(sst->state, src, blocks);
}

static int sha512_update(struct shash_desc *desc, const u8 *data,
static int sha512_update_arm64(struct shash_desc *desc, const u8 *data,
			       unsigned int len)
{
	return sha512_base_do_update_blocks(desc, data, len,
@@ -44,7 +44,7 @@ static int sha512_finup(struct shash_desc *desc, const u8 *data,
static struct shash_alg algs[] = { {
	.digestsize		= SHA512_DIGEST_SIZE,
	.init			= sha512_base_init,
	.update			= sha512_update,
	.update			= sha512_update_arm64,
	.finup			= sha512_finup,
	.descsize		= SHA512_STATE_SIZE,
	.base.cra_name		= "sha512",
@@ -57,7 +57,7 @@ static struct shash_alg algs[] = { {
}, {
	.digestsize		= SHA384_DIGEST_SIZE,
	.init			= sha384_base_init,
	.update			= sha512_update,
	.update			= sha512_update_arm64,
	.finup			= sha512_finup,
	.descsize		= SHA512_STATE_SIZE,
	.base.cra_name		= "sha384",
+4 −4
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@

#include "sha.h"

static int sha512_init(struct shash_desc *desc)
static int sha512_init_s390(struct shash_desc *desc)
{
	struct s390_sha_ctx *ctx = shash_desc_ctx(desc);

@@ -62,7 +62,7 @@ static int sha512_import(struct shash_desc *desc, const void *in)

static struct shash_alg sha512_alg = {
	.digestsize	=	SHA512_DIGEST_SIZE,
	.init		=	sha512_init,
	.init		=	sha512_init_s390,
	.update		=	s390_sha_update_blocks,
	.finup		=	s390_sha_finup,
	.export		=	sha512_export,
@@ -82,7 +82,7 @@ static struct shash_alg sha512_alg = {

MODULE_ALIAS_CRYPTO("sha512");

static int sha384_init(struct shash_desc *desc)
static int sha384_init_s390(struct shash_desc *desc)
{
	struct s390_sha_ctx *ctx = shash_desc_ctx(desc);

@@ -103,7 +103,7 @@ static int sha384_init(struct shash_desc *desc)

static struct shash_alg sha384_alg = {
	.digestsize	=	SHA384_DIGEST_SIZE,
	.init		=	sha384_init,
	.init		=	sha384_init_s390,
	.update		=	s390_sha_update_blocks,
	.finup		=	s390_sha_finup,
	.export		=	sha512_export,
+7 −7
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ static int sha512_sparc64_finup(struct shash_desc *desc, const u8 *src,
	return sha512_base_finish(desc, out);
}

static struct shash_alg sha512 = {
static struct shash_alg sha512_alg = {
	.digestsize	=	SHA512_DIGEST_SIZE,
	.init		=	sha512_base_init,
	.update		=	sha512_sparc64_update,
@@ -55,7 +55,7 @@ static struct shash_alg sha512 = {
	}
};

static struct shash_alg sha384 = {
static struct shash_alg sha384_alg = {
	.digestsize	=	SHA384_DIGEST_SIZE,
	.init		=	sha384_base_init,
	.update		=	sha512_sparc64_update,
@@ -87,13 +87,13 @@ static bool __init sparc64_has_sha512_opcode(void)
static int __init sha512_sparc64_mod_init(void)
{
	if (sparc64_has_sha512_opcode()) {
		int ret = crypto_register_shash(&sha384);
		int ret = crypto_register_shash(&sha384_alg);
		if (ret < 0)
			return ret;

		ret = crypto_register_shash(&sha512);
		ret = crypto_register_shash(&sha512_alg);
		if (ret < 0) {
			crypto_unregister_shash(&sha384);
			crypto_unregister_shash(&sha384_alg);
			return ret;
		}

@@ -106,8 +106,8 @@ static int __init sha512_sparc64_mod_init(void)

static void __exit sha512_sparc64_mod_fini(void)
{
	crypto_unregister_shash(&sha384);
	crypto_unregister_shash(&sha512);
	crypto_unregister_shash(&sha384_alg);
	crypto_unregister_shash(&sha512_alg);
}

module_init(sha512_sparc64_mod_init);
+5 −5
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@
asmlinkage void sha512_transform_ssse3(struct sha512_state *state,
				       const u8 *data, int blocks);

static int sha512_update(struct shash_desc *desc, const u8 *data,
static int sha512_update_x86(struct shash_desc *desc, const u8 *data,
			     unsigned int len, sha512_block_fn *sha512_xform)
{
	int remain;
@@ -69,7 +69,7 @@ static int sha512_finup(struct shash_desc *desc, const u8 *data,
static int sha512_ssse3_update(struct shash_desc *desc, const u8 *data,
		       unsigned int len)
{
	return sha512_update(desc, data, len, sha512_transform_ssse3);
	return sha512_update_x86(desc, data, len, sha512_transform_ssse3);
}

static int sha512_ssse3_finup(struct shash_desc *desc, const u8 *data,
@@ -141,7 +141,7 @@ static bool avx_usable(void)
static int sha512_avx_update(struct shash_desc *desc, const u8 *data,
		       unsigned int len)
{
	return sha512_update(desc, data, len, sha512_transform_avx);
	return sha512_update_x86(desc, data, len, sha512_transform_avx);
}

static int sha512_avx_finup(struct shash_desc *desc, const u8 *data,
@@ -203,7 +203,7 @@ asmlinkage void sha512_transform_rorx(struct sha512_state *state,
static int sha512_avx2_update(struct shash_desc *desc, const u8 *data,
		       unsigned int len)
{
	return sha512_update(desc, data, len, sha512_transform_rorx);
	return sha512_update_x86(desc, data, len, sha512_transform_rorx);
}

static int sha512_avx2_finup(struct shash_desc *desc, const u8 *data,