linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] lib/crypto: arm/poly1305: Remove unneeded empty weak function
@ 2025-07-11 21:28 Eric Biggers
  2025-07-14  5:36 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2025-07-11 21:28 UTC (permalink / raw)
  To: linux-crypto
  Cc: linux-arm-kernel, linux-kernel, Ard Biesheuvel,
	Jason A . Donenfeld, Arnd Bergmann, Eric Biggers

Fix poly1305-armv4.pl to not do '.globl poly1305_blocks_neon' when
poly1305_blocks_neon() is not defined.  Then, remove the empty __weak
definition of poly1305_blocks_neon(), which was still needed only
because of that unnecessary globl statement.  (It also used to be needed
because the compiler could generate calls to it when
CONFIG_KERNEL_MODE_NEON=n, but that has been fixed.)

Thanks to Arnd Bergmann for reporting that the globl statement in the
asm file was still depending on the weak symbol.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 lib/crypto/arm/poly1305-armv4.pl | 2 +-
 lib/crypto/arm/poly1305-glue.c   | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/crypto/arm/poly1305-armv4.pl b/lib/crypto/arm/poly1305-armv4.pl
index d57c6e2fc84a5..dd7a996361a71 100644
--- a/lib/crypto/arm/poly1305-armv4.pl
+++ b/lib/crypto/arm/poly1305-armv4.pl
@@ -44,11 +44,10 @@ $code.=<<___;
 # define __ARM_ARCH__ __LINUX_ARM_ARCH__
 # define __ARM_MAX_ARCH__ __LINUX_ARM_ARCH__
 # define poly1305_init   poly1305_block_init_arch
 # define poly1305_blocks poly1305_blocks_arm
 # define poly1305_emit   poly1305_emit_arch
-.globl	poly1305_blocks_neon
 #endif
 
 #if defined(__thumb2__)
 .syntax	unified
 .thumb
@@ -720,10 +719,11 @@ poly1305_init_neon:
 
 .Lno_init_neon:
 	ret				@ bx	lr
 .size	poly1305_init_neon,.-poly1305_init_neon
 
+.globl	poly1305_blocks_neon
 .type	poly1305_blocks_neon,%function
 .align	5
 poly1305_blocks_neon:
 .Lpoly1305_blocks_neon:
 	ldr	ip,[$ctx,#36]		@ is_base2_26
diff --git a/lib/crypto/arm/poly1305-glue.c b/lib/crypto/arm/poly1305-glue.c
index 2603b0771f2c4..5b65b840c1666 100644
--- a/lib/crypto/arm/poly1305-glue.c
+++ b/lib/crypto/arm/poly1305-glue.c
@@ -25,15 +25,10 @@ asmlinkage void poly1305_blocks_neon(struct poly1305_block_state *state,
 asmlinkage void poly1305_emit_arch(const struct poly1305_state *state,
 				   u8 digest[POLY1305_DIGEST_SIZE],
 				   const u32 nonce[4]);
 EXPORT_SYMBOL_GPL(poly1305_emit_arch);
 
-void __weak poly1305_blocks_neon(struct poly1305_block_state *state,
-				 const u8 *src, u32 len, u32 hibit)
-{
-}
-
 static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon);
 
 void poly1305_blocks_arch(struct poly1305_block_state *state, const u8 *src,
 			  unsigned int len, u32 padbit)
 {

base-commit: 57b15e9260a31438e91cf83dbfcb63333b24c684
-- 
2.50.1


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

* Re: [PATCH v2] lib/crypto: arm/poly1305: Remove unneeded empty weak function
  2025-07-11 21:28 [PATCH v2] lib/crypto: arm/poly1305: Remove unneeded empty weak function Eric Biggers
@ 2025-07-14  5:36 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2025-07-14  5:36 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-crypto, linux-arm-kernel, linux-kernel, Jason A . Donenfeld,
	Arnd Bergmann

On Sat, 12 Jul 2025 at 07:28, Eric Biggers <ebiggers@kernel.org> wrote:
>
> Fix poly1305-armv4.pl to not do '.globl poly1305_blocks_neon' when
> poly1305_blocks_neon() is not defined.  Then, remove the empty __weak
> definition of poly1305_blocks_neon(), which was still needed only
> because of that unnecessary globl statement.  (It also used to be needed
> because the compiler could generate calls to it when
> CONFIG_KERNEL_MODE_NEON=n, but that has been fixed.)
>
> Thanks to Arnd Bergmann for reporting that the globl statement in the
> asm file was still depending on the weak symbol.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
>  lib/crypto/arm/poly1305-armv4.pl | 2 +-
>  lib/crypto/arm/poly1305-glue.c   | 5 -----
>  2 files changed, 1 insertion(+), 6 deletions(-)
>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

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

end of thread, other threads:[~2025-07-14  5:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11 21:28 [PATCH v2] lib/crypto: arm/poly1305: Remove unneeded empty weak function Eric Biggers
2025-07-14  5:36 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).