aboutsummaryrefslogtreecommitdiff
path: root/drivers/crypto/nx/nx-aes-ctr.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-09-04 17:16:39 +0100
committerMark Brown <broonie@kernel.org>2015-09-04 17:16:39 +0100
commit04782ca20a8ebb5acf0c35756a38964ae5ea7321 (patch)
treeebf475793bb17444d3a1e21974617f27e8ff3a4b /drivers/crypto/nx/nx-aes-ctr.c
parentd5b98eb12420ce856caaf57dc5256eedc56a3747 (diff)
parent17649c90ff4c5246bb4babf6260029968a6d119d (diff)
Merge branch 'topic/smbus-block' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-core
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);
}