[PATCH] crypto: powerpc/poly1305 - Fix input mixup in poly1305_emit_arch

From: Herbert Xu
Date: Fri May 09 2025 - 08:29:40 EST


On Thu, May 08, 2025 at 08:35:48PM +0530, Venkat Rao Bagalkote wrote:
>
> Unfortunately, above patch dosent fix the boot warning.

This works for me:

---8<---
Swap the order of the arguments in poly1305_emit_arch to match
the prototype.

Fixes: 14d31979145d ("crypto: powerpc/poly1305 - Add block-only interface")
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/arch/powerpc/lib/crypto/poly1305-p10le_64.S b/arch/powerpc/lib/crypto/poly1305-p10le_64.S
index 2ba2911b8038..5b368baf96d2 100644
--- a/arch/powerpc/lib/crypto/poly1305-p10le_64.S
+++ b/arch/powerpc/lib/crypto/poly1305-p10le_64.S
@@ -1027,7 +1027,7 @@ Out_no_poly1305_64:
SYM_FUNC_END(poly1305_64s)

#
-# Input: r3 = h, r4 = s, r5 = mac
+# Input: r3 = h, r4 = mac, r5 = s
# mac = h + s
#
SYM_FUNC_START(poly1305_emit_arch)
@@ -1051,14 +1051,14 @@ SYM_FUNC_START(poly1305_emit_arch)
mr 12, 8

Skip_h64:
- ld 6, 0(4)
- ld 7, 8(4)
+ ld 6, 0(5)
+ ld 7, 8(5)
addc 10, 10, 6
adde 11, 11, 7
addze 12, 12

- std 10, 0(5)
- std 11, 8(5)
+ std 10, 0(4)
+ std 11, 8(4)
blr
SYM_FUNC_END(poly1305_emit_arch)

--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt