提交 b369e521 编写于 作者: H Huang Ying 提交者: Herbert Xu

crypto: aesni-intel - Use gas macro for AES-NI instructions

Old binutils do not support AES-NI instructions, to make kernel can be
compiled by them, .byte code is used instead of AES-NI assembly
instructions. But the readability and flexibility of raw .byte code is
not good.

So corresponding assembly instruction like gas macro is used instead.
Signed-off-by: NHuang Ying <ying.huang@intel.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 fd650a63
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/inst.h>
.text .text
...@@ -122,103 +123,72 @@ ENTRY(aesni_set_key) ...@@ -122,103 +123,72 @@ ENTRY(aesni_set_key)
movups 0x10(%rsi), %xmm2 # other user key movups 0x10(%rsi), %xmm2 # other user key
movaps %xmm2, (%rcx) movaps %xmm2, (%rcx)
add $0x10, %rcx add $0x10, %rcx
# aeskeygenassist $0x1, %xmm2, %xmm1 # round 1 AESKEYGENASSIST 0x1 %xmm2 %xmm1 # round 1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x01
call _key_expansion_256a call _key_expansion_256a
# aeskeygenassist $0x1, %xmm0, %xmm1 AESKEYGENASSIST 0x1 %xmm0 %xmm1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x01
call _key_expansion_256b call _key_expansion_256b
# aeskeygenassist $0x2, %xmm2, %xmm1 # round 2 AESKEYGENASSIST 0x2 %xmm2 %xmm1 # round 2
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x02
call _key_expansion_256a call _key_expansion_256a
# aeskeygenassist $0x2, %xmm0, %xmm1 AESKEYGENASSIST 0x2 %xmm0 %xmm1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x02
call _key_expansion_256b call _key_expansion_256b
# aeskeygenassist $0x4, %xmm2, %xmm1 # round 3 AESKEYGENASSIST 0x4 %xmm2 %xmm1 # round 3
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x04
call _key_expansion_256a call _key_expansion_256a
# aeskeygenassist $0x4, %xmm0, %xmm1 AESKEYGENASSIST 0x4 %xmm0 %xmm1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x04
call _key_expansion_256b call _key_expansion_256b
# aeskeygenassist $0x8, %xmm2, %xmm1 # round 4 AESKEYGENASSIST 0x8 %xmm2 %xmm1 # round 4
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x08
call _key_expansion_256a call _key_expansion_256a
# aeskeygenassist $0x8, %xmm0, %xmm1 AESKEYGENASSIST 0x8 %xmm0 %xmm1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x08
call _key_expansion_256b call _key_expansion_256b
# aeskeygenassist $0x10, %xmm2, %xmm1 # round 5 AESKEYGENASSIST 0x10 %xmm2 %xmm1 # round 5
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x10
call _key_expansion_256a call _key_expansion_256a
# aeskeygenassist $0x10, %xmm0, %xmm1 AESKEYGENASSIST 0x10 %xmm0 %xmm1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x10
call _key_expansion_256b call _key_expansion_256b
# aeskeygenassist $0x20, %xmm2, %xmm1 # round 6 AESKEYGENASSIST 0x20 %xmm2 %xmm1 # round 6
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x20
call _key_expansion_256a call _key_expansion_256a
# aeskeygenassist $0x20, %xmm0, %xmm1 AESKEYGENASSIST 0x20 %xmm0 %xmm1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x20
call _key_expansion_256b call _key_expansion_256b
# aeskeygenassist $0x40, %xmm2, %xmm1 # round 7 AESKEYGENASSIST 0x40 %xmm2 %xmm1 # round 7
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x40
call _key_expansion_256a call _key_expansion_256a
jmp .Ldec_key jmp .Ldec_key
.Lenc_key192: .Lenc_key192:
movq 0x10(%rsi), %xmm2 # other user key movq 0x10(%rsi), %xmm2 # other user key
# aeskeygenassist $0x1, %xmm2, %xmm1 # round 1 AESKEYGENASSIST 0x1 %xmm2 %xmm1 # round 1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x01
call _key_expansion_192a call _key_expansion_192a
# aeskeygenassist $0x2, %xmm2, %xmm1 # round 2 AESKEYGENASSIST 0x2 %xmm2 %xmm1 # round 2
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x02
call _key_expansion_192b call _key_expansion_192b
# aeskeygenassist $0x4, %xmm2, %xmm1 # round 3 AESKEYGENASSIST 0x4 %xmm2 %xmm1 # round 3
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x04
call _key_expansion_192a call _key_expansion_192a
# aeskeygenassist $0x8, %xmm2, %xmm1 # round 4 AESKEYGENASSIST 0x8 %xmm2 %xmm1 # round 4
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x08
call _key_expansion_192b call _key_expansion_192b
# aeskeygenassist $0x10, %xmm2, %xmm1 # round 5 AESKEYGENASSIST 0x10 %xmm2 %xmm1 # round 5
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x10
call _key_expansion_192a call _key_expansion_192a
# aeskeygenassist $0x20, %xmm2, %xmm1 # round 6 AESKEYGENASSIST 0x20 %xmm2 %xmm1 # round 6
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x20
call _key_expansion_192b call _key_expansion_192b
# aeskeygenassist $0x40, %xmm2, %xmm1 # round 7 AESKEYGENASSIST 0x40 %xmm2 %xmm1 # round 7
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x40
call _key_expansion_192a call _key_expansion_192a
# aeskeygenassist $0x80, %xmm2, %xmm1 # round 8 AESKEYGENASSIST 0x80 %xmm2 %xmm1 # round 8
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x80
call _key_expansion_192b call _key_expansion_192b
jmp .Ldec_key jmp .Ldec_key
.Lenc_key128: .Lenc_key128:
# aeskeygenassist $0x1, %xmm0, %xmm1 # round 1 AESKEYGENASSIST 0x1 %xmm0 %xmm1 # round 1
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x01
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x2, %xmm0, %xmm1 # round 2 AESKEYGENASSIST 0x2 %xmm0 %xmm1 # round 2
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x02
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x4, %xmm0, %xmm1 # round 3 AESKEYGENASSIST 0x4 %xmm0 %xmm1 # round 3
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x04
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x8, %xmm0, %xmm1 # round 4 AESKEYGENASSIST 0x8 %xmm0 %xmm1 # round 4
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x08
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x10, %xmm0, %xmm1 # round 5 AESKEYGENASSIST 0x10 %xmm0 %xmm1 # round 5
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x10
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x20, %xmm0, %xmm1 # round 6 AESKEYGENASSIST 0x20 %xmm0 %xmm1 # round 6
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x20
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x40, %xmm0, %xmm1 # round 7 AESKEYGENASSIST 0x40 %xmm0 %xmm1 # round 7
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x40
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x80, %xmm0, %xmm1 # round 8 AESKEYGENASSIST 0x80 %xmm0 %xmm1 # round 8
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x80
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x1b, %xmm0, %xmm1 # round 9 AESKEYGENASSIST 0x1b %xmm0 %xmm1 # round 9
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x1b
call _key_expansion_128 call _key_expansion_128
# aeskeygenassist $0x36, %xmm0, %xmm1 # round 10 AESKEYGENASSIST 0x36 %xmm0 %xmm1 # round 10
.byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x36
call _key_expansion_128 call _key_expansion_128
.Ldec_key: .Ldec_key:
sub $0x10, %rcx sub $0x10, %rcx
...@@ -231,8 +201,7 @@ ENTRY(aesni_set_key) ...@@ -231,8 +201,7 @@ ENTRY(aesni_set_key)
.align 4 .align 4
.Ldec_key_loop: .Ldec_key_loop:
movaps (%rdi), %xmm0 movaps (%rdi), %xmm0
# aesimc %xmm0, %xmm1 AESIMC %xmm0 %xmm1
.byte 0x66, 0x0f, 0x38, 0xdb, 0xc8
movaps %xmm1, (%rsi) movaps %xmm1, (%rsi)
add $0x10, %rdi add $0x10, %rdi
sub $0x10, %rsi sub $0x10, %rsi
...@@ -274,51 +243,37 @@ _aesni_enc1: ...@@ -274,51 +243,37 @@ _aesni_enc1:
je .Lenc192 je .Lenc192
add $0x20, TKEYP add $0x20, TKEYP
movaps -0x60(TKEYP), KEY movaps -0x60(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps -0x50(TKEYP), KEY movaps -0x50(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
.align 4 .align 4
.Lenc192: .Lenc192:
movaps -0x40(TKEYP), KEY movaps -0x40(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps -0x30(TKEYP), KEY movaps -0x30(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
.align 4 .align 4
.Lenc128: .Lenc128:
movaps -0x20(TKEYP), KEY movaps -0x20(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps -0x10(TKEYP), KEY movaps -0x10(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps (TKEYP), KEY movaps (TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x10(TKEYP), KEY movaps 0x10(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x20(TKEYP), KEY movaps 0x20(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x30(TKEYP), KEY movaps 0x30(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x40(TKEYP), KEY movaps 0x40(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x50(TKEYP), KEY movaps 0x50(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x60(TKEYP), KEY movaps 0x60(TKEYP), KEY
# aesenc KEY, STATE AESENC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
movaps 0x70(TKEYP), KEY movaps 0x70(TKEYP), KEY
# aesenclast KEY, STATE # last round AESENCLAST KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdd, 0xc2
ret ret
/* /*
...@@ -353,135 +308,79 @@ _aesni_enc4: ...@@ -353,135 +308,79 @@ _aesni_enc4:
je .L4enc192 je .L4enc192
add $0x20, TKEYP add $0x20, TKEYP
movaps -0x60(TKEYP), KEY movaps -0x60(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps -0x50(TKEYP), KEY movaps -0x50(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
#.align 4 #.align 4
.L4enc192: .L4enc192:
movaps -0x40(TKEYP), KEY movaps -0x40(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps -0x30(TKEYP), KEY movaps -0x30(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
#.align 4 #.align 4
.L4enc128: .L4enc128:
movaps -0x20(TKEYP), KEY movaps -0x20(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps -0x10(TKEYP), KEY movaps -0x10(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps (TKEYP), KEY movaps (TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x10(TKEYP), KEY movaps 0x10(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x20(TKEYP), KEY movaps 0x20(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x30(TKEYP), KEY movaps 0x30(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x40(TKEYP), KEY movaps 0x40(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x50(TKEYP), KEY movaps 0x50(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x60(TKEYP), KEY movaps 0x60(TKEYP), KEY
# aesenc KEY, STATE1 AESENC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 AESENC KEY STATE2
# aesenc KEY, STATE2 AESENC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 AESENC KEY STATE4
# aesenc KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdc, 0xea
# aesenc KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
movaps 0x70(TKEYP), KEY movaps 0x70(TKEYP), KEY
# aesenclast KEY, STATE1 # last round AESENCLAST KEY STATE1 # last round
.byte 0x66, 0x0f, 0x38, 0xdd, 0xc2 AESENCLAST KEY STATE2
# aesenclast KEY, STATE2 AESENCLAST KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdd, 0xe2 AESENCLAST KEY STATE4
# aesenclast KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdd, 0xea
# aesenclast KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdd, 0xf2
ret ret
/* /*
...@@ -518,51 +417,37 @@ _aesni_dec1: ...@@ -518,51 +417,37 @@ _aesni_dec1:
je .Ldec192 je .Ldec192
add $0x20, TKEYP add $0x20, TKEYP
movaps -0x60(TKEYP), KEY movaps -0x60(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps -0x50(TKEYP), KEY movaps -0x50(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
.align 4 .align 4
.Ldec192: .Ldec192:
movaps -0x40(TKEYP), KEY movaps -0x40(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps -0x30(TKEYP), KEY movaps -0x30(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
.align 4 .align 4
.Ldec128: .Ldec128:
movaps -0x20(TKEYP), KEY movaps -0x20(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps -0x10(TKEYP), KEY movaps -0x10(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps (TKEYP), KEY movaps (TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x10(TKEYP), KEY movaps 0x10(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x20(TKEYP), KEY movaps 0x20(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x30(TKEYP), KEY movaps 0x30(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x40(TKEYP), KEY movaps 0x40(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x50(TKEYP), KEY movaps 0x50(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x60(TKEYP), KEY movaps 0x60(TKEYP), KEY
# aesdec KEY, STATE AESDEC KEY STATE
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2
movaps 0x70(TKEYP), KEY movaps 0x70(TKEYP), KEY
# aesdeclast KEY, STATE # last round AESDECLAST KEY STATE
.byte 0x66, 0x0f, 0x38, 0xdf, 0xc2
ret ret
/* /*
...@@ -597,135 +482,79 @@ _aesni_dec4: ...@@ -597,135 +482,79 @@ _aesni_dec4:
je .L4dec192 je .L4dec192
add $0x20, TKEYP add $0x20, TKEYP
movaps -0x60(TKEYP), KEY movaps -0x60(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps -0x50(TKEYP), KEY movaps -0x50(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
.align 4 .align 4
.L4dec192: .L4dec192:
movaps -0x40(TKEYP), KEY movaps -0x40(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps -0x30(TKEYP), KEY movaps -0x30(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
.align 4 .align 4
.L4dec128: .L4dec128:
movaps -0x20(TKEYP), KEY movaps -0x20(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps -0x10(TKEYP), KEY movaps -0x10(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps (TKEYP), KEY movaps (TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x10(TKEYP), KEY movaps 0x10(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x20(TKEYP), KEY movaps 0x20(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x30(TKEYP), KEY movaps 0x30(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x40(TKEYP), KEY movaps 0x40(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x50(TKEYP), KEY movaps 0x50(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x60(TKEYP), KEY movaps 0x60(TKEYP), KEY
# aesdec KEY, STATE1 AESDEC KEY STATE1
.byte 0x66, 0x0f, 0x38, 0xde, 0xc2 AESDEC KEY STATE2
# aesdec KEY, STATE2 AESDEC KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xe2 AESDEC KEY STATE4
# aesdec KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xde, 0xea
# aesdec KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xde, 0xf2
movaps 0x70(TKEYP), KEY movaps 0x70(TKEYP), KEY
# aesdeclast KEY, STATE1 # last round AESDECLAST KEY STATE1 # last round
.byte 0x66, 0x0f, 0x38, 0xdf, 0xc2 AESDECLAST KEY STATE2
# aesdeclast KEY, STATE2 AESDECLAST KEY STATE3
.byte 0x66, 0x0f, 0x38, 0xdf, 0xe2 AESDECLAST KEY STATE4
# aesdeclast KEY, STATE3
.byte 0x66, 0x0f, 0x38, 0xdf, 0xea
# aesdeclast KEY, STATE4
.byte 0x66, 0x0f, 0x38, 0xdf, 0xf2
ret ret
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册