From 0760bce9848be002740a5eb96d7844909fe8c237 Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Thu, 3 Oct 2024 16:26:28 +0800 Subject: [PATCH] zuc: eea ppc64x, fix 1 #255 --- zuc/asm_ppc64x.s | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zuc/asm_ppc64x.s b/zuc/asm_ppc64x.s index d91c1b8..0086d83 100644 --- a/zuc/asm_ppc64x.s +++ b/zuc/asm_ppc64x.s @@ -321,7 +321,7 @@ TEXT ·genKeywordAsm(SB),NOSPLIT,$0 XOR W, W \ LFSR_UPDT(idx, addr, W, tmpR1, tmpR2, tmpR3, tmpR4) -#define ONEROUND_REV32(idx, addr, dst, W, tmpR1, tmpR2, tmpR3, tmpR4) \ +#define ONEROUND_REV32LE(idx, addr, dst, W, tmpR1, tmpR2, tmpR3, tmpR4) \ BITS_REORG(idx, addr, W, tmpR1, tmpR2, tmpR3) \ NONLIN_FUN(W, tmpR1, tmpR2, tmpR3) \ XOR BRC_X3, W \ @@ -330,11 +330,17 @@ TEXT ·genKeywordAsm(SB),NOSPLIT,$0 XOR W, W \ LFSR_UPDT(idx, addr, W, tmpR1, tmpR2, tmpR3, tmpR4) +#ifdef GOARCH_ppc64le +#define ONEROUND_REV32(idx, addr, dst, W, tmpR1, tmpR2, tmpR3, tmpR4) ONEROUND_REV32LE(idx, addr, dst, W, tmpR1, tmpR2, tmpR3, tmpR4) +#else +#define ONEROUND_REV32(idx, addr, dst, W, tmpR1, tmpR2, tmpR3, tmpR4) ONEROUND(idx, addr, dst, W, tmpR1, tmpR2, tmpR3, tmpR4) +#endif + // func genKeyStreamAsm(keyStream []uint32, pState *zucState32) TEXT ·genKeyStreamAsm(SB),NOSPLIT,$0 LOAD_CONSTS - MOVD pState+0(FP), R4 + MOVD pState+24(FP), R4 MOVD ks+0(FP), R3 MOVD ks_len+8(FP), R5 @@ -420,10 +426,11 @@ zucRet: TEXT ·genKeyStreamRev32Asm(SB),NOSPLIT,$0 LOAD_CONSTS - MOVD pState+0(FP), R4 + MOVD pState+24(FP), R4 MOVD ks+0(FP), R3 MOVD ks_len+8(FP), R5 + SRD $2, R5, R5 LOAD_STATE(R4) CMP R5, $16