Skip to content

Commit c893e1c

Browse files
committed
crypto/internal/fips140/aes: actually use the VTBL instruction on arm64
Support for the VTBL instruction was added in CL 110015 - use it directly, rather than using WORD encodings. Note that one of the WORD encodings does not actually match the instruction in the comment - use the instruction that matches the existing encoding instead. Change-Id: I1933162f8144a6b86b38e8b550d36907131b1dd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/666795 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent a204ed5 commit c893e1c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/crypto/internal/fips140/aes/aes_arm64.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ TEXT ·expandKeyAsm(SB),NOSPLIT,$0
134134
MOVW $0x1b, R14
135135
ks128Loop:
136136
VMOV R7, V2.S[0]
137-
WORD $0x4E030042 // TBL V3.B16, [V2.B16], V2.B16
137+
VTBL V3.B16, [V2.B16], V2.B16
138138
AESE V0.B16, V2.B16 // Use AES to compute the SBOX
139139
EORW R13, R4
140140
LSLW $1, R13 // Compute next Rcon
@@ -180,7 +180,7 @@ ks192:
180180
ks192Loop:
181181
STPW.P (R6, R7), 8(R10)
182182
VMOV R7, V2.S[0]
183-
WORD $0x4E030042 //TBL V3.B16, [V2.B16], V2.B16
183+
VTBL V3.B16, [V2.B16], V2.B16
184184
AESE V0.B16, V2.B16
185185
EORW R13, R2
186186
LSLW $1, R13
@@ -233,7 +233,7 @@ ks256Loop:
233233
STPW.P (R4, R5), 8(R10)
234234
STPW.P (R6, R7), 8(R10)
235235
VMOV R7, V2.S[0]
236-
WORD $0x4E030042 //TBL V3.B16, [V2.B16], V2.B16
236+
VTBL V3.B16, [V2.B16], V2.B16
237237
AESE V0.B16, V2.B16
238238
EORW R13, R0
239239
LSLW $1, R13
@@ -244,7 +244,7 @@ ks256Loop:
244244
EORW R1, R2
245245
EORW R2, R3
246246
VMOV R3, V2.S[0]
247-
WORD $0x4E040042 //TBL V3.B16, [V2.B16], V2.B16
247+
VTBL V4.B16, [V2.B16], V2.B16
248248
AESE V0.B16, V2.B16
249249
VMOV V2.S[0], R9
250250
EORW R9, R4

0 commit comments

Comments
 (0)