Update aead/chacha20

This commit is contained in:
Frank Denis 2018-04-26 20:41:35 +02:00
parent 615c155dbd
commit a3f51cfea9
3 changed files with 40 additions and 40 deletions

View file

@ -22,7 +22,7 @@
INCL block; \
INCL dst; \
DECL len; \
JA FINALIZE_LOOP \
JG FINALIZE_LOOP \
// func supportsSSE2() bool
TEXT ·supportsSSE2(SB), NOSPLIT, $0-1
@ -152,7 +152,7 @@ CHACHA_LOOP:
PADDQ X0, X3
CMPL Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X0)
MOVOU 0*16(State), X0 // Restore X0 from state
@ -245,7 +245,7 @@ CHACHA_LOOP:
PADDQ 3*16(Stack), X3
CMPL Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X0)
ADDL $64, Src

View file

@ -22,7 +22,7 @@
INCQ block; \
INCQ dst; \
DECQ len; \
JA FINALIZE_LOOP \
JG FINALIZE_LOOP \
// func supportsSSSE3() bool
TEXT ·supportsSSSE3(SB), NOSPLIT, $0-1
@ -191,11 +191,11 @@ TEXT ·xorKeyStreamSSE2(SB), 4, $112-80
MOVO X4, 4*16(Stack)
CMPQ Len, $64
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
CMPQ Len, $128
JBE GENERATE_KEYSTREAM_128
JLE GENERATE_KEYSTREAM_128
CMPQ Len, $192
JBE GENERATE_KEYSTREAM_192
JLE GENERATE_KEYSTREAM_192
GENERATE_KEYSTREAM_256:
MOVO X0, X12
@ -283,7 +283,7 @@ CHACHA_LOOP_256:
SUBQ $192, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -291,11 +291,11 @@ CHACHA_LOOP_256:
SUBQ $64, Len
JZ DONE
CMPQ Len, $64 // If Len <= 64 -> gen. only 64 byte keystream.
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
CMPQ Len, $128 // If 64 < Len <= 128 -> gen. only 128 byte keystream.
JBE GENERATE_KEYSTREAM_128
JLE GENERATE_KEYSTREAM_128
CMPQ Len, $192 // If Len > 192 -> repeat, otherwise Len > 128 && Len <= 192 -> gen. 192 byte keystream
JA GENERATE_KEYSTREAM_256
JG GENERATE_KEYSTREAM_256
GENERATE_KEYSTREAM_192:
MOVO X0, X12
@ -355,7 +355,7 @@ CHACHA_LOOP_192:
SUBQ $128, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -363,7 +363,7 @@ CHACHA_LOOP_192:
SUBQ $64, Len
JZ DONE
CMPQ Len, $64 // If Len <= 64 -> gen. only 64 byte keystream.
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
GENERATE_KEYSTREAM_128:
MOVO X0, X8
@ -406,7 +406,7 @@ CHACHA_LOOP_128:
SUBQ $64, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -436,7 +436,7 @@ CHACHA_LOOP_64:
PADDQ 4*16(Stack), X3
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Src
@ -491,11 +491,11 @@ TEXT ·xorKeyStreamSSSE3(SB), 4, $144-80
MOVO X6, 7*16(Stack)
CMPQ Len, $64
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
CMPQ Len, $128
JBE GENERATE_KEYSTREAM_128
JLE GENERATE_KEYSTREAM_128
CMPQ Len, $192
JBE GENERATE_KEYSTREAM_192
JLE GENERATE_KEYSTREAM_192
GENERATE_KEYSTREAM_256:
MOVO X0, X12
@ -583,7 +583,7 @@ CHACHA_LOOP_256:
SUBQ $192, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -591,11 +591,11 @@ CHACHA_LOOP_256:
SUBQ $64, Len
JZ DONE
CMPQ Len, $64 // If Len <= 64 -> gen. only 64 byte keystream.
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
CMPQ Len, $128 // If 64 < Len <= 128 -> gen. only 128 byte keystream.
JBE GENERATE_KEYSTREAM_128
JLE GENERATE_KEYSTREAM_128
CMPQ Len, $192 // If Len > 192 -> repeat, otherwise Len > 128 && Len <= 192 -> gen. 192 byte keystream
JA GENERATE_KEYSTREAM_256
JG GENERATE_KEYSTREAM_256
GENERATE_KEYSTREAM_192:
MOVO X0, X12
@ -660,7 +660,7 @@ CHACHA_LOOP_192:
SUBQ $128, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -668,7 +668,7 @@ CHACHA_LOOP_192:
SUBQ $64, Len
JZ DONE
CMPQ Len, $64 // If Len <= 64 -> gen. only 64 byte keystream.
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
GENERATE_KEYSTREAM_128:
MOVO X0, X8
@ -714,7 +714,7 @@ CHACHA_LOOP_128:
SUBQ $64, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -747,7 +747,7 @@ CHACHA_LOOP_64:
PADDQ 4*16(Stack), X3
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_SSE(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Src
@ -802,11 +802,11 @@ TEXT ·xorKeyStreamAVX(SB), 4, $144-80
VMOVDQA X6, 7*16(Stack)
CMPQ Len, $64
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
CMPQ Len, $128
JBE GENERATE_KEYSTREAM_128
JLE GENERATE_KEYSTREAM_128
CMPQ Len, $192
JBE GENERATE_KEYSTREAM_192
JLE GENERATE_KEYSTREAM_192
GENERATE_KEYSTREAM_256:
VMOVDQA X0, X12
@ -894,7 +894,7 @@ CHACHA_LOOP_256:
SUBQ $192, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_AVX(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -902,11 +902,11 @@ CHACHA_LOOP_256:
SUBQ $64, Len
JZ DONE
CMPQ Len, $64 // If Len <= 64 -> gen. only 64 byte keystream.
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
CMPQ Len, $128 // If 64 < Len <= 128 -> gen. only 128 byte keystream.
JBE GENERATE_KEYSTREAM_128
JLE GENERATE_KEYSTREAM_128
CMPQ Len, $192 // If Len > 192 -> repeat, otherwise Len > 128 && Len <= 192 -> gen. 192 byte keystream
JA GENERATE_KEYSTREAM_256
JG GENERATE_KEYSTREAM_256
GENERATE_KEYSTREAM_192:
VMOVDQA X0, X12
@ -971,7 +971,7 @@ CHACHA_LOOP_192:
SUBQ $128, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_AVX(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -979,7 +979,7 @@ CHACHA_LOOP_192:
SUBQ $64, Len
JZ DONE
CMPQ Len, $64 // If Len <= 64 -> gen. only 64 byte keystream.
JBE GENERATE_KEYSTREAM_64
JLE GENERATE_KEYSTREAM_64
GENERATE_KEYSTREAM_128:
VMOVDQA X0, X8
@ -1025,7 +1025,7 @@ CHACHA_LOOP_128:
SUBQ $64, Len
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_AVX(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Dst
@ -1058,7 +1058,7 @@ CHACHA_LOOP_64:
VPADDQ 4*16(Stack), X3, X3
CMPQ Len, $64
JB BUFFER_KEYSTREAM
JL BUFFER_KEYSTREAM
XOR_AVX(Dst, Src, 0, X4, X5, X6, X7, X8)
ADDQ $64, Src