Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132683
b: refs/heads/master
c: 07bf44f
h: refs/heads/master
i:
  132681: 0d8e0c1
  132679: b1ac0ee
v: v3
  • Loading branch information
Huang Ying authored and Herbert Xu committed Feb 18, 2009
1 parent 0895618 commit ab2680f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 109568e110ed67d4be1b28609b9fa00fca97f8eb
refs/heads/master: 07bf44f86989f5ed866510374fe761d1903681fb
18 changes: 9 additions & 9 deletions trunk/arch/x86/crypto/aes-i586-asm_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
#define tlen 1024 // length of each of 4 'xor' arrays (256 32-bit words)

/* offsets to parameters with one register pushed onto stack */
#define tfm 8
#define ctx 8
#define out_blk 12
#define in_blk 16

/* offsets in crypto_tfm structure */
#define klen (crypto_tfm_ctx_offset + 480)
#define ekey (crypto_tfm_ctx_offset + 0)
#define dkey (crypto_tfm_ctx_offset + 240)
/* offsets in crypto_aes_ctx structure */
#define klen (480)
#define ekey (0)
#define dkey (240)

// register mapping for encrypt and decrypt subroutines

Expand Down Expand Up @@ -217,7 +217,7 @@
do_col (table, r5,r0,r1,r4, r2,r3); /* idx=r5 */

// AES (Rijndael) Encryption Subroutine
/* void aes_enc_blk(struct crypto_tfm *tfm, u8 *out_blk, const u8 *in_blk) */
/* void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out_blk, const u8 *in_blk) */

.global aes_enc_blk

Expand All @@ -228,7 +228,7 @@

aes_enc_blk:
push %ebp
mov tfm(%esp),%ebp
mov ctx(%esp),%ebp

// CAUTION: the order and the values used in these assigns
// rely on the register mappings
Expand Down Expand Up @@ -292,7 +292,7 @@ aes_enc_blk:
ret

// AES (Rijndael) Decryption Subroutine
/* void aes_dec_blk(struct crypto_tfm *tfm, u8 *out_blk, const u8 *in_blk) */
/* void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out_blk, const u8 *in_blk) */

.global aes_dec_blk

Expand All @@ -303,7 +303,7 @@ aes_enc_blk:

aes_dec_blk:
push %ebp
mov tfm(%esp),%ebp
mov ctx(%esp),%ebp

// CAUTION: the order and the values used in these assigns
// rely on the register mappings
Expand Down
6 changes: 2 additions & 4 deletions trunk/arch/x86/crypto/aes-x86_64-asm_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include <asm/asm-offsets.h>

#define BASE crypto_tfm_ctx_offset

#define R1 %rax
#define R1E %eax
#define R1X %ax
Expand Down Expand Up @@ -56,13 +54,13 @@
.align 8; \
FUNC: movq r1,r2; \
movq r3,r4; \
leaq BASE+KEY+48(r8),r9; \
leaq KEY+48(r8),r9; \
movq r10,r11; \
movl (r7),r5 ## E; \
movl 4(r7),r1 ## E; \
movl 8(r7),r6 ## E; \
movl 12(r7),r7 ## E; \
movl BASE+480(r8),r10 ## E; \
movl 480(r8),r10 ## E; \
xorl -48(r9),r5 ## E; \
xorl -44(r9),r1 ## E; \
xorl -40(r9),r6 ## E; \
Expand Down
20 changes: 16 additions & 4 deletions trunk/arch/x86/crypto/aes_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@

#include <crypto/aes.h>

asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in);
asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in);
asmlinkage void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
asmlinkage void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);

void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
{
aes_enc_blk(ctx, dst, src);
}
EXPORT_SYMBOL_GPL(crypto_aes_encrypt_x86);

void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
{
aes_dec_blk(ctx, dst, src);
}
EXPORT_SYMBOL_GPL(crypto_aes_decrypt_x86);

static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
aes_enc_blk(tfm, dst, src);
aes_enc_blk(crypto_tfm_ctx(tfm), dst, src);
}

static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
aes_dec_blk(tfm, dst, src);
aes_dec_blk(crypto_tfm_ctx(tfm), dst, src);
}

static struct crypto_alg aes_alg = {
Expand Down
11 changes: 11 additions & 0 deletions trunk/arch/x86/include/asm/aes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef ASM_X86_AES_H
#define ASM_X86_AES_H

#include <linux/crypto.h>
#include <crypto/aes.h>

void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst,
const u8 *src);
void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst,
const u8 *src);
#endif

0 comments on commit ab2680f

Please sign in to comment.