Commit 751fb252 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: x86/aes-xts - make non-AVX implementation use new glue code

Make the non-AVX implementation of AES-XTS (xts-aes-aesni) use the new
glue code that was introduced for the AVX implementations of AES-XTS.
This reduces code size, and it improves the performance of xts-aes-aesni
due to the optimization for messages that don't span page boundaries.

This required moving the new glue functions higher up in the file and
allowing the IV encryption function to be specified by the caller.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5c6ca9d9
...@@ -751,7 +751,7 @@ ...@@ -751,7 +751,7 @@
// void aes_xts_encrypt_iv(const struct crypto_aes_ctx *tweak_key, // void aes_xts_encrypt_iv(const struct crypto_aes_ctx *tweak_key,
// u8 iv[AES_BLOCK_SIZE]); // u8 iv[AES_BLOCK_SIZE]);
SYM_FUNC_START(aes_xts_encrypt_iv) SYM_TYPED_FUNC_START(aes_xts_encrypt_iv)
vmovdqu (%rsi), %xmm0 vmovdqu (%rsi), %xmm0
vpxor 0*16(%rdi), %xmm0, %xmm0 vpxor 0*16(%rdi), %xmm0, %xmm0
vaesenc 1*16(%rdi), %xmm0, %xmm0 vaesenc 1*16(%rdi), %xmm0, %xmm0
......
...@@ -2843,10 +2843,10 @@ SYM_FUNC_END(aesni_ctr_enc) ...@@ -2843,10 +2843,10 @@ SYM_FUNC_END(aesni_ctr_enc)
pxor KEY, IV; pxor KEY, IV;
/* /*
* void aesni_xts_encrypt(const struct crypto_aes_ctx *ctx, u8 *dst, * void aesni_xts_enc(const struct crypto_aes_ctx *ctx, u8 *dst,
* const u8 *src, unsigned int len, le128 *iv) * const u8 *src, unsigned int len, le128 *iv)
*/ */
SYM_FUNC_START(aesni_xts_encrypt) SYM_FUNC_START(aesni_xts_enc)
FRAME_BEGIN FRAME_BEGIN
#ifndef __x86_64__ #ifndef __x86_64__
pushl IVP pushl IVP
...@@ -2995,13 +2995,13 @@ SYM_FUNC_START(aesni_xts_encrypt) ...@@ -2995,13 +2995,13 @@ SYM_FUNC_START(aesni_xts_encrypt)
movups STATE, (OUTP) movups STATE, (OUTP)
jmp .Lxts_enc_ret jmp .Lxts_enc_ret
SYM_FUNC_END(aesni_xts_encrypt) SYM_FUNC_END(aesni_xts_enc)
/* /*
* void aesni_xts_decrypt(const struct crypto_aes_ctx *ctx, u8 *dst, * void aesni_xts_dec(const struct crypto_aes_ctx *ctx, u8 *dst,
* const u8 *src, unsigned int len, le128 *iv) * const u8 *src, unsigned int len, le128 *iv)
*/ */
SYM_FUNC_START(aesni_xts_decrypt) SYM_FUNC_START(aesni_xts_dec)
FRAME_BEGIN FRAME_BEGIN
#ifndef __x86_64__ #ifndef __x86_64__
pushl IVP pushl IVP
...@@ -3157,4 +3157,4 @@ SYM_FUNC_START(aesni_xts_decrypt) ...@@ -3157,4 +3157,4 @@ SYM_FUNC_START(aesni_xts_decrypt)
movups STATE, (OUTP) movups STATE, (OUTP)
jmp .Lxts_dec_ret jmp .Lxts_dec_ret
SYM_FUNC_END(aesni_xts_decrypt) SYM_FUNC_END(aesni_xts_dec)
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment