aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/crypto
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2011-09-26 09:47:20 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2011-10-21 08:23:08 -0400
commit91d41f159d75d602f6001218eec64c5e761475a6 (patch)
tree1bc2607e291604764348bccdb6cf6f9a0b5e4fbb /arch/x86/crypto
parentee5002a5497f3219b4144b5370203ed6e43f7269 (diff)
crypto: twofish-x86-asm - make assembler functions use twofish_ctx instead of crypto_tfm
This needed by 3-way twofish patch to be able to easily use one block assembler functions. As glue code is shared between i586/x86_64 apply change to i586 assembler too. Also export assembler functions for 3-way parallel twofish module. CC: Joachim Fritschi <jfritschi@freenet.de> 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')
-rw-r--r--arch/x86/crypto/twofish-i586-asm_32.S10
-rw-r--r--arch/x86/crypto/twofish-x86_64-asm_64.S6
-rw-r--r--arch/x86/crypto/twofish_glue.c12
3 files changed, 15 insertions, 13 deletions
diff --git a/arch/x86/crypto/twofish-i586-asm_32.S b/arch/x86/crypto/twofish-i586-asm_32.S
index 575331cb2a8a..658af4bb35c9 100644
--- a/arch/x86/crypto/twofish-i586-asm_32.S
+++ b/arch/x86/crypto/twofish-i586-asm_32.S
@@ -26,7 +26,7 @@
26 26
27#define in_blk 12 /* input byte array address parameter*/ 27#define in_blk 12 /* input byte array address parameter*/
28#define out_blk 8 /* output byte array address parameter*/ 28#define out_blk 8 /* output byte array address parameter*/
29#define tfm 4 /* Twofish context structure */ 29#define ctx 4 /* Twofish context structure */
30 30
31#define a_offset 0 31#define a_offset 0
32#define b_offset 4 32#define b_offset 4
@@ -229,8 +229,8 @@ twofish_enc_blk:
229 push %esi 229 push %esi
230 push %edi 230 push %edi
231 231
232 mov tfm + 16(%esp), %ebp /* abuse the base pointer: set new base bointer to the crypto tfm */ 232 mov ctx + 16(%esp), %ebp /* abuse the base pointer: set new base
233 add $crypto_tfm_ctx_offset, %ebp /* ctx address */ 233 * pointer to the ctx address */
234 mov in_blk+16(%esp),%edi /* input address in edi */ 234 mov in_blk+16(%esp),%edi /* input address in edi */
235 235
236 mov (%edi), %eax 236 mov (%edi), %eax
@@ -285,8 +285,8 @@ twofish_dec_blk:
285 push %edi 285 push %edi
286 286
287 287
288 mov tfm + 16(%esp), %ebp /* abuse the base pointer: set new base bointer to the crypto tfm */ 288 mov ctx + 16(%esp), %ebp /* abuse the base pointer: set new base
289 add $crypto_tfm_ctx_offset, %ebp /* ctx address */ 289 * pointer to the ctx address */
290 mov in_blk+16(%esp),%edi /* input address in edi */ 290 mov in_blk+16(%esp),%edi /* input address in edi */
291 291
292 mov (%edi), %eax 292 mov (%edi), %eax
diff --git a/arch/x86/crypto/twofish-x86_64-asm_64.S b/arch/x86/crypto/twofish-x86_64-asm_64.S
index 573aa102542e..7bcf3fcc3668 100644
--- a/arch/x86/crypto/twofish-x86_64-asm_64.S
+++ b/arch/x86/crypto/twofish-x86_64-asm_64.S
@@ -221,10 +221,9 @@
221twofish_enc_blk: 221twofish_enc_blk:
222 pushq R1 222 pushq R1
223 223
224 /* %rdi contains the crypto tfm address */ 224 /* %rdi contains the ctx address */
225 /* %rsi contains the output address */ 225 /* %rsi contains the output address */
226 /* %rdx contains the input address */ 226 /* %rdx contains the input address */
227 add $crypto_tfm_ctx_offset, %rdi /* set ctx address */
228 /* ctx address is moved to free one non-rex register 227 /* ctx address is moved to free one non-rex register
229 as target for the 8bit high operations */ 228 as target for the 8bit high operations */
230 mov %rdi, %r11 229 mov %rdi, %r11
@@ -274,10 +273,9 @@ twofish_enc_blk:
274twofish_dec_blk: 273twofish_dec_blk:
275 pushq R1 274 pushq R1
276 275
277 /* %rdi contains the crypto tfm address */ 276 /* %rdi contains the ctx address */
278 /* %rsi contains the output address */ 277 /* %rsi contains the output address */
279 /* %rdx contains the input address */ 278 /* %rdx contains the input address */
280 add $crypto_tfm_ctx_offset, %rdi /* set ctx address */
281 /* ctx address is moved to free one non-rex register 279 /* ctx address is moved to free one non-rex register
282 as target for the 8bit high operations */ 280 as target for the 8bit high operations */
283 mov %rdi, %r11 281 mov %rdi, %r11
diff --git a/arch/x86/crypto/twofish_glue.c b/arch/x86/crypto/twofish_glue.c
index cefaf8b9aa18..dc6b3fb817fc 100644
--- a/arch/x86/crypto/twofish_glue.c
+++ b/arch/x86/crypto/twofish_glue.c
@@ -44,17 +44,21 @@
44#include <linux/module.h> 44#include <linux/module.h>
45#include <linux/types.h> 45#include <linux/types.h>
46 46
47asmlinkage void twofish_enc_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 47asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst,
48asmlinkage void twofish_dec_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 48 const u8 *src);
49EXPORT_SYMBOL_GPL(twofish_enc_blk);
50asmlinkage void twofish_dec_blk(struct twofish_ctx *ctx, u8 *dst,
51 const u8 *src);
52EXPORT_SYMBOL_GPL(twofish_dec_blk);
49 53
50static void twofish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 54static void twofish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
51{ 55{
52 twofish_enc_blk(tfm, dst, src); 56 twofish_enc_blk(crypto_tfm_ctx(tfm), dst, src);
53} 57}
54 58
55static void twofish_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 59static void twofish_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
56{ 60{
57 twofish_dec_blk(tfm, dst, src); 61 twofish_dec_blk(crypto_tfm_ctx(tfm), dst, src);
58} 62}
59 63
60static struct crypto_alg alg = { 64static struct crypto_alg alg = {