Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4179
b: refs/heads/master
c: 476df25
h: refs/heads/master
i:
  4177: 86272d9
  4175: 4fcd1d8
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jul 6, 2005
1 parent 66d1a64 commit ec480e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 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: 915e8561d559abba1b81934e31e54a3f850fa7bf
refs/heads/master: 476df259cd577e20379b02a7f7ffd086ea925a83
13 changes: 9 additions & 4 deletions trunk/drivers/crypto/padlock-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,16 @@ static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
: "d"(control_word), "b"(key), "c"(count));
}

static inline void padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
u8 *iv, void *control_word, u32 count)
static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
u8 *iv, void *control_word, u32 count)
{
/* Enforce key reload. */
asm volatile ("pushfl; popfl");
/* rep xcryptcbc */
asm volatile (".byte 0xf3,0x0f,0xa7,0xd0"
: "+S" (input), "+D" (output), "+a" (iv)
: "d" (control_word), "b" (key), "c" (count));
return iv;
}

static void
Expand Down Expand Up @@ -447,8 +448,12 @@ static unsigned int aes_encrypt_cbc(const struct cipher_desc *desc, u8 *out,
const u8 *in, unsigned int nbytes)
{
struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm));
padlock_xcrypt_cbc(in, out, ctx->E, desc->info, &ctx->cword.encrypt,
nbytes / AES_BLOCK_SIZE);
u8 *iv;

iv = padlock_xcrypt_cbc(in, out, ctx->E, desc->info,
&ctx->cword.encrypt, nbytes / AES_BLOCK_SIZE);
memcpy(desc->info, iv, AES_BLOCK_SIZE);

return nbytes & ~(AES_BLOCK_SIZE - 1);
}

Expand Down

0 comments on commit ec480e2

Please sign in to comment.