diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2012-10-20 08:06:36 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-10-24 09:10:54 -0400 |
commit | 58990986f1cba40c23c0c10592ace08616de3ffa (patch) | |
tree | 84466698a28860d1457c804b857b2e97d1995fcb /arch/x86/crypto/cast6_avx_glue.c | |
parent | e080b17a8cec92ef42343989ae65c73c25529346 (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/cast6_avx_glue.c')
-rw-r--r-- | arch/x86/crypto/cast6_avx_glue.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/crypto/cast6_avx_glue.c b/arch/x86/crypto/cast6_avx_glue.c index 15e5f85a5011..1dfd33b5b4fb 100644 --- a/arch/x86/crypto/cast6_avx_glue.c +++ b/arch/x86/crypto/cast6_avx_glue.c | |||
@@ -78,19 +78,19 @@ static void cast6_decrypt_cbc_xway(void *ctx, u128 *dst, const u128 *src) | |||
78 | u128_xor(dst + (j + 1), dst + (j + 1), ivs + j); | 78 | u128_xor(dst + (j + 1), dst + (j + 1), ivs + j); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void cast6_crypt_ctr(void *ctx, u128 *dst, const u128 *src, u128 *iv) | 81 | static void cast6_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv) |
82 | { | 82 | { |
83 | be128 ctrblk; | 83 | be128 ctrblk; |
84 | 84 | ||
85 | u128_to_be128(&ctrblk, iv); | 85 | le128_to_be128(&ctrblk, iv); |
86 | u128_inc(iv); | 86 | le128_inc(iv); |
87 | 87 | ||
88 | __cast6_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk); | 88 | __cast6_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk); |
89 | u128_xor(dst, src, (u128 *)&ctrblk); | 89 | u128_xor(dst, src, (u128 *)&ctrblk); |
90 | } | 90 | } |
91 | 91 | ||
92 | static void cast6_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src, | 92 | static void cast6_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src, |
93 | u128 *iv) | 93 | le128 *iv) |
94 | { | 94 | { |
95 | be128 ctrblks[CAST6_PARALLEL_BLOCKS]; | 95 | be128 ctrblks[CAST6_PARALLEL_BLOCKS]; |
96 | unsigned int i; | 96 | unsigned int i; |
@@ -99,8 +99,8 @@ static void cast6_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src, | |||
99 | if (dst != src) | 99 | if (dst != src) |
100 | dst[i] = src[i]; | 100 | dst[i] = src[i]; |
101 | 101 | ||
102 | u128_to_be128(&ctrblks[i], iv); | 102 | le128_to_be128(&ctrblks[i], iv); |
103 | u128_inc(iv); | 103 | le128_inc(iv); |
104 | } | 104 | } |
105 | 105 | ||
106 | cast6_enc_blk_xway_xor(ctx, (u8 *)dst, (u8 *)ctrblks); | 106 | cast6_enc_blk_xway_xor(ctx, (u8 *)dst, (u8 *)ctrblks); |