From e4be0219898a9077314d1e281201292f68e7a7e9 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 14 Apr 2026 07:47:50 +0800 Subject: [PATCH] kernel: kmod-ltq-deu: rename some sha1 functions They are conflict with the kernel crypto library on 6.18 kernel. Fixes: ifxmips_sha1.c:83:8: error: redefinition of 'struct sha1_ctx' 83 | struct sha1_ctx { | ^~~~~~~~ In file included from ifxmips_sha1.c:50: /workspaces/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xway/linux-6.18.21/include/crypto/sha1.h:50:8: note: originally defined here 50 | struct sha1_ctx { | ^~~~~~~~ ifxmips_sha1.c:164:12: error: conflicting types for 'sha1_update'; have 'int(struct shash_desc *, const u8 *, unsigned int)' {aka 'int(struct shash_desc *, const unsigned char *, unsigned int)'} 164 | static int sha1_update(struct shash_desc * desc, const u8 *data, | ^~~~~~~~~~~ /workspaces/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xway/linux-6.18.21/include/crypto/sha1.h:76:6: note: previous declaration of 'sha1_update' with type 'void(struct sha1_ctx *, const u8 *, size_t)' {aka 'void(struct sha1_ctx *, const unsigned char *, unsigned int)'} 76 | void sha1_update(struct sha1_ctx *ctx, const u8 *data, size_t len); | ^~~~~~~~~~~ ifxmips_sha1.c:195:12: error: conflicting types for 'sha1_final'; have 'int(struct shash_desc *, u8 *)' {aka 'int(struct shash_desc *, unsigned char *)'} 195 | static int sha1_final(struct shash_desc *desc, u8 *out) | ^~~~~~~~~~ /workspaces/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xway/linux-6.18.21/include/crypto/sha1.h:87:6: note: previous declaration of 'sha1_final' with type 'void(struct sha1_ctx *, u8 *)' {aka 'void(struct sha1_ctx *, unsigned char *)'} 87 | void sha1_final(struct sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]); | ^~~~~~~~~~ Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/22921 Signed-off-by: Robert Marko --- .../kernel/lantiq/ltq-deu/src/ifxmips_sha1.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c index f095d41830f..2a87c1c55a8 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c @@ -80,7 +80,7 @@ extern char debug_level; /* * \brief SHA1 private structure */ -struct sha1_ctx { +struct ltq_sha1_ctx { int started; u64 count; u32 hash[5]; @@ -96,7 +96,7 @@ extern int disable_deudma; * \param state current state * \param in 64-byte block of input */ -static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in) +static void sha1_transform1 (struct ltq_sha1_ctx *sctx, u32 *state, const u32 *in) { int i = 0; volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START; @@ -147,24 +147,24 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in) */ static int sha1_init1(struct shash_desc *desc) { - struct sha1_ctx *sctx = shash_desc_ctx(desc); + struct ltq_sha1_ctx *sctx = shash_desc_ctx(desc); sctx->started = 0; sctx->count = 0; return 0; } -/*! \fn static void sha1_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len) +/*! \fn static void ltq_sha1_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len) * \ingroup IFX_SHA1_FUNCTIONS * \brief on-the-fly sha1 computation * \param tfm linux crypto algo transform * \param data input data * \param len size of input data */ -static int sha1_update(struct shash_desc * desc, const u8 *data, +static int ltq_sha1_update(struct shash_desc * desc, const u8 *data, unsigned int len) { - struct sha1_ctx *sctx = shash_desc_ctx(desc); + struct ltq_sha1_ctx *sctx = shash_desc_ctx(desc); unsigned int i, j; j = (sctx->count >> 3) & 0x3f; @@ -186,15 +186,15 @@ static int sha1_update(struct shash_desc * desc, const u8 *data, return 0; } -/*! \fn static void sha1_final(struct crypto_tfm *tfm, u8 *out) +/*! \fn static void ltq_sha1_final(struct crypto_tfm *tfm, u8 *out) * \ingroup IFX_SHA1_FUNCTIONS * \brief compute final sha1 value * \param tfm linux crypto algo transform * \param out final md5 output value */ -static int sha1_final(struct shash_desc *desc, u8 *out) +static int ltq_sha1_final(struct shash_desc *desc, u8 *out) { - struct sha1_ctx *sctx = shash_desc_ctx(desc); + struct ltq_sha1_ctx *sctx = shash_desc_ctx(desc); u32 index, padlen; u64 t; u8 bits[8] = { 0, }; @@ -222,10 +222,10 @@ static int sha1_final(struct shash_desc *desc, u8 *out) /* Pad out to 56 mod 64 */ index = (sctx->count >> 3) & 0x3f; padlen = (index < 56) ? (56 - index) : ((64 + 56) - index); - sha1_update (desc, padding, padlen); + ltq_sha1_update (desc, padding, padlen); /* Append length */ - sha1_update (desc, bits, sizeof bits); + ltq_sha1_update (desc, bits, sizeof bits); memcpy(out, sctx->hash, SHA1_DIGEST_SIZE); @@ -241,9 +241,9 @@ static int sha1_final(struct shash_desc *desc, u8 *out) static struct shash_alg ifxdeu_sha1_alg = { .digestsize = SHA1_DIGEST_SIZE, .init = sha1_init1, - .update = sha1_update, - .final = sha1_final, - .descsize = sizeof(struct sha1_ctx), + .update = ltq_sha1_update, + .final = ltq_sha1_final, + .descsize = sizeof(struct ltq_sha1_ctx), .statesize = sizeof(struct sha1_state), .base = { .cra_name = "sha1",