summaryrefslogtreecommitdiff
path: root/drivers/crypto/nx/nx-aes-ctr.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-07-14 14:55:32 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-07-14 14:55:32 +0800
commit773bb50625cd23c7711bcd1410fffe8a0cab121b (patch)
tree5153fb0cfa8c29666ef3f997b95378dbf55983fc /drivers/crypto/nx/nx-aes-ctr.c
parent1425d2d17f7309c65e2bd124e0ce8ace743b17f2 (diff)
parent030f4e968741d65aea9cd5f7814d1164967801ef (diff)
downloadlinux-773bb50625cd23c7711bcd1410fffe8a0cab121b.tar.gz
linux-773bb50625cd23c7711bcd1410fffe8a0cab121b.tar.bz2
linux-773bb50625cd23c7711bcd1410fffe8a0cab121b.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Merge the crypto tree to pull in the nx reentrancy patch.
Diffstat (limited to 'drivers/crypto/nx/nx-aes-ctr.c')
-rw-r--r--drivers/crypto/nx/nx-aes-ctr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/crypto/nx/nx-aes-ctr.c b/drivers/crypto/nx/nx-aes-ctr.c
index 2617cd4d54dd..dd7e9f3f5b6b 100644
--- a/drivers/crypto/nx/nx-aes-ctr.c
+++ b/drivers/crypto/nx/nx-aes-ctr.c
@@ -72,7 +72,7 @@ static int ctr3686_aes_nx_set_key(struct crypto_tfm *tfm,
if (key_len < CTR_RFC3686_NONCE_SIZE)
return -EINVAL;
- memcpy(nx_ctx->priv.ctr.iv,
+ memcpy(nx_ctx->priv.ctr.nonce,
in_key + key_len - CTR_RFC3686_NONCE_SIZE,
CTR_RFC3686_NONCE_SIZE);
@@ -131,14 +131,15 @@ static int ctr3686_aes_nx_crypt(struct blkcipher_desc *desc,
unsigned int nbytes)
{
struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm);
- u8 *iv = nx_ctx->priv.ctr.iv;
+ u8 iv[16];
+ memcpy(iv, nx_ctx->priv.ctr.nonce, CTR_RFC3686_IV_SIZE);
memcpy(iv + CTR_RFC3686_NONCE_SIZE,
desc->info, CTR_RFC3686_IV_SIZE);
iv[12] = iv[13] = iv[14] = 0;
iv[15] = 1;
- desc->info = nx_ctx->priv.ctr.iv;
+ desc->info = iv;
return ctr_aes_nx_crypt(desc, dst, src, nbytes);
}