aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorAndreas Steinmetz <ast@domdv.de>2005-07-06 16:55:00 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-06 16:55:00 -0400
commita2a892a236d03a6e985471a7e57d1c863de144c8 (patch)
tree33b52c87bdecf0f24936b952a565a445ce03c616 /crypto
parenta61cc44812ff94793987bf43b70a3d9bc64a6820 (diff)
[CRYPTO] Add x86_64 asm AES
Implementation: =============== The encrypt/decrypt code is based on an x86 implementation I did a while ago which I never published. This unpublished implementation does include an assembler based key schedule and precomputed tables. For simplicity and best acceptance, however, I took Gladman's in-kernel code for table generation and key schedule for the kernel port of my assembler code and modified this code to produce the key schedule as required by my assembler implementation. File locations and Kconfig are kept similar to the i586 AES assembler implementation. It may seem a little bit strange to use 32 bit I/O and registers in the assembler implementation but this gives the best code size. My implementation takes one instruction more per round compared to Gladman's x86 assembler but it doesn't require any stack for local variables or saved registers and it is less serialized than Gladman's code. Note that all comparisons to Gladman's code were done after my code was implemented. I did only use FIPS PUB 197 for the implementation so my implementation is independent work. If anybody has a better assembler solution for x86_64 I'll be pleased to have my code replaced with the better solution. Testing: ======== The implementation passes the in-kernel crypto testing module and I'm running it without any problems on my laptop where it is mainly used for dm-crypt. Microbenchmark: =============== The microbenchmark was done in userspace with similar compile flags as used during kernel compile. Encrypt/decrypt is about 35% faster than the generic C implementation. As the generic C as well as my assembler implementation are both table I don't really expect that there is much room for further improvements though I'll be glad to be corrected here. The key schedule is about 5% slower than the generic C implementation. This is due to the fact that some more work has to be done in the key schedule routine to fit the schedule to the assembler implementation. Code Size: ========== Encrypt and decrypt are together about 2.1 Kbytes smaller than the generic C implementation which is important with regard to L1 cache usage. The key schedule routine is about 100 bytes larger than the generic C implementation. Data Size: ========== There's no difference in data size requirements between the assembler implementation and the generic C implementation. License: ======== Gladmans's code is dual BSD/GPL whereas my assembler code is GPLv2 only (I'm not going to change the license for my code). So I had to change the module license for the x86_64 aes module from 'Dual BSD/GPL' to 'GPL' to reflect the most restrictive license within the module. Signed-off-by: Andreas Steinmetz <ast@domdv.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/Kconfig22
1 files changed, 21 insertions, 1 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 90d6089d60ed..256c0b1fed10 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -146,7 +146,7 @@ config CRYPTO_SERPENT
146 146
147config CRYPTO_AES 147config CRYPTO_AES
148 tristate "AES cipher algorithms" 148 tristate "AES cipher algorithms"
149 depends on CRYPTO && !((X86 || UML_X86) && !64BIT) 149 depends on CRYPTO && !(X86 || UML_X86)
150 help 150 help
151 AES cipher algorithms (FIPS-197). AES uses the Rijndael 151 AES cipher algorithms (FIPS-197). AES uses the Rijndael
152 algorithm. 152 algorithm.
@@ -184,6 +184,26 @@ config CRYPTO_AES_586
184 184
185 See <http://csrc.nist.gov/encryption/aes/> for more information. 185 See <http://csrc.nist.gov/encryption/aes/> for more information.
186 186
187config CRYPTO_AES_X86_64
188 tristate "AES cipher algorithms (x86_64)"
189 depends on CRYPTO && ((X86 || UML_X86) && 64BIT)
190 help
191 AES cipher algorithms (FIPS-197). AES uses the Rijndael
192 algorithm.
193
194 Rijndael appears to be consistently a very good performer in
195 both hardware and software across a wide range of computing
196 environments regardless of its use in feedback or non-feedback
197 modes. Its key setup time is excellent, and its key agility is
198 good. Rijndael's very low memory requirements make it very well
199 suited for restricted-space environments, in which it also
200 demonstrates excellent performance. Rijndael's operations are
201 among the easiest to defend against power and timing attacks.
202
203 The AES specifies three key sizes: 128, 192 and 256 bits
204
205 See <http://csrc.nist.gov/encryption/aes/> for more information.
206
187config CRYPTO_CAST5 207config CRYPTO_CAST5
188 tristate "CAST5 (CAST-128) cipher algorithm" 208 tristate "CAST5 (CAST-128) cipher algorithm"
189 depends on CRYPTO 209 depends on CRYPTO