: "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");
asm volatile (".byte 0xf3,0x0f,0xa7,0xd0"
: "+S" (input), "+D" (output), "+a" (iv)
: "d" (control_word), "b" (key), "c" (count));
+ return iv;
}
static void
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);
}