Skip to content

Commit

Permalink
zuc: eia128 ppc64x fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Sep 30, 2024
1 parent 50f5d29 commit 0adad61
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions zuc/eia_asm_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ TEXT ·eia3Round16B(SB),NOSPLIT,$0
VSRW XDATA, XTMP2, XTMP1
VAND BIT_REV_AND_TAB, XTMP1, XTMP1

MOVD $0x20, PTR
LXVD2X (PTR)(R0), BIT_REV_TAB_L
MOVD $0x10, R8
LXVD2X (PTR)(R8), BIT_REV_TAB_L
VSLB BIT_REV_TAB_L, XTMP2, BIT_REV_TAB_H
VPERM BIT_REV_TAB_L, BIT_REV_TAB_L, XTMP3, XTMP3
VPERM BIT_REV_TAB_H, BIT_REV_TAB_H, XTMP1, XTMP1
Expand All @@ -69,19 +69,19 @@ TEXT ·eia3Round16B(SB),NOSPLIT,$0
// ZUC authentication part, 4x32 data bits
// setup data
VSPLTISB $0, XTMP2
MOVD $0x30, PTR
LXVD2X (PTR)(R0), XTMP4
MOVD $0x20, R8
LXVD2X (PTR)(R8), XTMP4
VPERM XTMP2, XTMP3, XTMP4, XTMP1
MOVD $0x40, PTR
LXVD2X (PTR)(R0), XTMP4
MOVD $0x30, R8
LXVD2X (PTR)(R8), XTMP4
VPERM XTMP2, XTMP3, XTMP4, XTMP2

// setup KS
LXVW4X (R4), KS_L
MOVD $8, PTR
LXVW4X (PTR)(R4), KS_M1
MOVD $0x50, PTR
LXVD2X (PTR)(R0), XTMP1
MOVD $8, R8
LXVW4X (R8)(R4), KS_M1
MOVD $0x40, R8
LXVD2X (PTR)(R8), XTMP1
VPERM KS_L, KS_L, XTMP1, KS_L
VPERM KS_M1, KS_M1, XTMP1, KS_M1

Expand All @@ -94,14 +94,14 @@ TEXT ·eia3Round16B(SB),NOSPLIT,$0
VSPLTW $2, XTMP3, XDIGEST

// Update tag
MFVSRWZ XDIGEST, PTR
MFVSRWZ XDIGEST, R8
MOVWZ (R3), R6
XOR R6, PTR, R6
XOR R6, R8, R6
MOVW R6, (R3)

// Copy last 16 bytes of KS to the front
MOVD $16, PTR
LXVD2X (PTR)(R4), XTMP1
MOVD $16, R8
LXVD2X (R8)(R4), XTMP1
STXVD2X XTMP1, (R4)(R0)

RET

0 comments on commit 0adad61

Please sign in to comment.