aboutsummaryrefslogtreecommitdiff
path: root/drivers/crypto/nx/nx-aes-ctr.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-09-14 14:22:30 -0700
committerKevin Hilman <khilman@linaro.org>2015-09-14 14:22:30 -0700
commita143f427f3e7c6d80bc1d288334706a1f8237f5f (patch)
tree59e96413cf2013afb70bfaaca5f89937d9d7ac20 /drivers/crypto/nx/nx-aes-ctr.c
parentd9e292d3ea94ab21f028108527a908e415e856ef (diff)
parentf249a14dd1b6b341e7b5e29b64c0edae6e13b7f5 (diff)
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-rtlsk-v4.1-15.11-rtlsk-v4.1-15.10-rtlsk-v4.1-15.09-rt
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);
}