From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au, will.deacon@arm.com,
catalin.marinas@arm.com, marc.zyngier@arm.com,
mark.rutland@arm.com, dann.frazier@canonical.com,
steve.capper@linaro.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/7] arm64/crypto: aes-cipher: move S-box to .rodata section
Date: Wed, 10 Jan 2018 12:11:37 +0000 [thread overview]
Message-ID: <20180110121142.18291-3-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180110121142.18291-1-ard.biesheuvel@linaro.org>
Move the AES inverse S-box to the .rodata section where it is safe from
abuse by speculation.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm64/crypto/aes-cipher-core.S | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/crypto/aes-cipher-core.S b/arch/arm64/crypto/aes-cipher-core.S
index 6d2445d603cc..3a44eada2347 100644
--- a/arch/arm64/crypto/aes-cipher-core.S
+++ b/arch/arm64/crypto/aes-cipher-core.S
@@ -125,6 +125,16 @@ CPU_BE( rev w7, w7 )
ret
.endm
+ENTRY(__aes_arm64_encrypt)
+ do_crypt fround, crypto_ft_tab, crypto_ft_tab + 1, 2
+ENDPROC(__aes_arm64_encrypt)
+
+ .align 5
+ENTRY(__aes_arm64_decrypt)
+ do_crypt iround, crypto_it_tab, __aes_arm64_inverse_sbox, 0
+ENDPROC(__aes_arm64_decrypt)
+
+ .section ".rodata", "a"
.align L1_CACHE_SHIFT
.type __aes_arm64_inverse_sbox, %object
__aes_arm64_inverse_sbox:
@@ -161,12 +171,3 @@ __aes_arm64_inverse_sbox:
.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
.size __aes_arm64_inverse_sbox, . - __aes_arm64_inverse_sbox
-
-ENTRY(__aes_arm64_encrypt)
- do_crypt fround, crypto_ft_tab, crypto_ft_tab + 1, 2
-ENDPROC(__aes_arm64_encrypt)
-
- .align 5
-ENTRY(__aes_arm64_decrypt)
- do_crypt iround, crypto_it_tab, __aes_arm64_inverse_sbox, 0
-ENDPROC(__aes_arm64_decrypt)
--
2.11.0
next prev parent reply other threads:[~2018-01-10 12:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 12:11 [PATCH 0/7] arm64: move literal data into .rodata section Ard Biesheuvel
2018-01-10 12:11 ` [PATCH 1/7] arm64: kernel: avoid executable literal pools Ard Biesheuvel
2018-01-10 12:11 ` Ard Biesheuvel [this message]
2018-01-10 12:11 ` [PATCH 3/7] arm64/crypto: aes-neon: move literal data to .rodata section Ard Biesheuvel
2018-01-10 12:11 ` [PATCH 4/7] arm64/crypto: crc32: " Ard Biesheuvel
2018-01-10 12:11 ` [PATCH 5/7] arm64/crypto: crct10dif: " Ard Biesheuvel
2018-01-10 12:11 ` [PATCH 6/7] arm64/crypto: sha2-ce: move the round constant table " Ard Biesheuvel
2018-01-10 12:11 ` [PATCH 7/7] arm64/crypto: sha1-ce: get rid of literal pool Ard Biesheuvel
2018-01-18 11:41 ` [PATCH 0/7] arm64: move literal data into .rodata section Herbert Xu
2018-01-18 11:46 ` Ard Biesheuvel
2018-01-18 12:02 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180110121142.18291-3-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=dann.frazier@canonical.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=steve.capper@linaro.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).