mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-28 13:16:19 +08:00
sm4: format asm code
This commit is contained in:
parent
ff434b7bd7
commit
acffd83cc9
@ -16,19 +16,19 @@
|
||||
|
||||
#include "aesni_amd64.h"
|
||||
|
||||
#define SM4_TAO_L2(x, y) \
|
||||
SM4_SBOX(x, y, XTMP6); \
|
||||
#define SM4_TAO_L2(x, y, tmp1, tmp2) \
|
||||
SM4_SBOX(x, y, tmp1); \
|
||||
; \ //#################### 4 parallel L2 linear transforms ##################//
|
||||
MOVOU x, y; \
|
||||
MOVOU x, XTMP6; \
|
||||
PSLLL $13, XTMP6; \
|
||||
MOVOU x, tmp1; \
|
||||
PSLLL $13, tmp1; \
|
||||
PSRLL $19, y; \
|
||||
POR XTMP6, y; \ //y = X roll 13
|
||||
PSLLL $10, XTMP6; \
|
||||
MOVOU x, XTMP7; \
|
||||
PSRLL $9, XTMP7; \
|
||||
POR XTMP6, XTMP7; \ //XTMP7 = x roll 23
|
||||
PXOR XTMP7, y; \
|
||||
POR tmp1, y; \ //y = X roll 13
|
||||
PSLLL $10, tmp1; \
|
||||
MOVOU x, tmp2; \
|
||||
PSRLL $9, tmp2; \
|
||||
POR tmp1, tmp2; \ //tmp2 = x roll 23
|
||||
PXOR tmp2, y; \
|
||||
PXOR y, x
|
||||
|
||||
#define SM4_ROUND(index, x, y, t0, t1, t2, t3) \
|
||||
@ -53,7 +53,7 @@
|
||||
PXOR t1, x; \
|
||||
PXOR t2, x; \
|
||||
PXOR t3, x; \
|
||||
SM4_TAO_L2(x, y); \
|
||||
SM4_TAO_L2(x, y, XTMP6, XTMP7); \
|
||||
PXOR x, t0; \
|
||||
PEXTRD $0, t0, R8; \
|
||||
MOVL R8, (index * 4)(DX)(CX*1); \
|
||||
|
@ -268,6 +268,7 @@ encryptBlocksLoop:
|
||||
sm4niblocks:
|
||||
VLD1.P 64(R8), [V0.S4, V1.S4, V2.S4, V3.S4]
|
||||
VLD1.P 64(R8), [V4.S4, V5.S4, V6.S4, V7.S4]
|
||||
|
||||
sm4niblockloop:
|
||||
SM4E_ROUND()
|
||||
SUB $16, R12, R12 // message length - 16bytes, then compare with 16bytes
|
||||
|
@ -99,7 +99,6 @@ loopSrc:
|
||||
VMOV t0.S[2], t2.S[0]
|
||||
VMOV t0.S[3], t3.S[0]
|
||||
|
||||
|
||||
EOR R2, R2
|
||||
MOVD rkSave, R0
|
||||
|
||||
@ -122,6 +121,7 @@ encryptBlockLoop:
|
||||
VMOV t3.B16, IV.B16
|
||||
|
||||
B loopSrc
|
||||
|
||||
done_sm4:
|
||||
VST1 [IV.B16], (R5)
|
||||
RET
|
||||
|
Loading…
x
Reference in New Issue
Block a user