aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/crypto/serpent_sse2_glue.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2012-10-20 08:06:36 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-10-24 09:10:54 -0400
commit58990986f1cba40c23c0c10592ace08616de3ffa (patch)
tree84466698a28860d1457c804b857b2e97d1995fcb /arch/x86/crypto/serpent_sse2_glue.c
parente080b17a8cec92ef42343989ae65c73c25529346 (diff)
crypto: x86/glue_helper - use le128 instead of u128 for CTR mode
'u128' currently used for CTR mode is on little-endian 'long long' swapped and would require extra swap operations by SSE/AVX code. Use of le128 instead of u128 allows IV calculations to be done with vector registers easier. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/x86/crypto/serpent_sse2_glue.c')
-rw-r--r--arch/x86/crypto/serpent_sse2_glue.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/crypto/serpent_sse2_glue.c b/arch/x86/crypto/serpent_sse2_glue.c
index 9107a9908c4..97a356ece24 100644
--- a/arch/x86/crypto/serpent_sse2_glue.c
+++ b/arch/x86/crypto/serpent_sse2_glue.c
@@ -59,19 +59,19 @@ static void serpent_decrypt_cbc_xway(void *ctx, u128 *dst, const u128 *src)
59 u128_xor(dst + (j + 1), dst + (j + 1), ivs + j); 59 u128_xor(dst + (j + 1), dst + (j + 1), ivs + j);
60} 60}
61 61
62static void serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, u128 *iv) 62static void serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv)
63{ 63{
64 be128 ctrblk; 64 be128 ctrblk;
65 65
66 u128_to_be128(&ctrblk, iv); 66 le128_to_be128(&ctrblk, iv);
67 u128_inc(iv); 67 le128_inc(iv);
68 68
69 __serpent_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk); 69 __serpent_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk);
70 u128_xor(dst, src, (u128 *)&ctrblk); 70 u128_xor(dst, src, (u128 *)&ctrblk);
71} 71}
72 72
73static void serpent_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src, 73static void serpent_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src,
74 u128 *iv) 74 le128 *iv)
75{ 75{
76 be128 ctrblks[SERPENT_PARALLEL_BLOCKS]; 76 be128 ctrblks[SERPENT_PARALLEL_BLOCKS];
77 unsigned int i; 77 unsigned int i;
@@ -80,8 +80,8 @@ static void serpent_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src,
80 if (dst != src) 80 if (dst != src)
81 dst[i] = src[i]; 81 dst[i] = src[i];
82 82
83 u128_to_be128(&ctrblks[i], iv); 83 le128_to_be128(&ctrblks[i], iv);
84 u128_inc(iv); 84 le128_inc(iv);
85 } 85 }
86 86
87 serpent_enc_blk_xway_xor(ctx, (u8 *)dst, (u8 *)ctrblks); 87 serpent_enc_blk_xway_xor(ctx, (u8 *)dst, (u8 *)ctrblks);