summaryrefslogtreecommitdiff
path: root/arch/arm/crypto/aes-cipher-core.S
diff options
context:
space:
mode:
authorJinbum Park <jinb.park7@gmail.com>2018-02-12 16:52:37 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2018-02-22 17:16:19 +0300
commit4ff8b1dd814ba4c2dc4a8ce3cf77274e01bd1c93 (patch)
treeabb324f05143909412f0e872a222c8a219e78005 /arch/arm/crypto/aes-cipher-core.S
parent7c73cf4cc2ac16465f5102437dc0a12d66671bd6 (diff)
downloadlinux-4ff8b1dd814ba4c2dc4a8ce3cf77274e01bd1c93.tar.xz
crypto: arm/aes-cipher - move S-box to .rodata section
Move the AES inverse S-box to the .rodata section where it is safe from abuse by speculation. Signed-off-by: Jinbum Park <jinb.park7@gmail.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/arm/crypto/aes-cipher-core.S')
-rw-r--r--arch/arm/crypto/aes-cipher-core.S19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/arm/crypto/aes-cipher-core.S b/arch/arm/crypto/aes-cipher-core.S
index 54b384084637..184d6c2d15d5 100644
--- a/arch/arm/crypto/aes-cipher-core.S
+++ b/arch/arm/crypto/aes-cipher-core.S
@@ -174,6 +174,16 @@
.ltorg
.endm
+ENTRY(__aes_arm_encrypt)
+ do_crypt fround, crypto_ft_tab, crypto_ft_tab + 1, 2
+ENDPROC(__aes_arm_encrypt)
+
+ .align 5
+ENTRY(__aes_arm_decrypt)
+ do_crypt iround, crypto_it_tab, __aes_arm_inverse_sbox, 0
+ENDPROC(__aes_arm_decrypt)
+
+ .section ".rodata", "a"
.align L1_CACHE_SHIFT
.type __aes_arm_inverse_sbox, %object
__aes_arm_inverse_sbox:
@@ -210,12 +220,3 @@ __aes_arm_inverse_sbox:
.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
.size __aes_arm_inverse_sbox, . - __aes_arm_inverse_sbox
-
-ENTRY(__aes_arm_encrypt)
- do_crypt fround, crypto_ft_tab, crypto_ft_tab + 1, 2
-ENDPROC(__aes_arm_encrypt)
-
- .align 5
-ENTRY(__aes_arm_decrypt)
- do_crypt iround, crypto_it_tab, __aes_arm_inverse_sbox, 0
-ENDPROC(__aes_arm_decrypt)