summaryrefslogtreecommitdiff
path: root/drivers/crypto/atmel-aes.c
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@microchip.com>2019-12-13 09:54:56 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2019-12-20 14:58:35 +0800
commit27f4adf724e16c0cb49dd015a089d8bdcb18353b (patch)
tree2a8ce71e7d7f9ea9cdf19de859979a8d6fa4ef61 /drivers/crypto/atmel-aes.c
parente9ce6aee1d4d0ae61bf9e1666d790394c4f4d1a8 (diff)
crypto: atmel-{aes,tdes} - Update the IV only when the op succeeds
Do not update the IV in case of errors. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/atmel-aes.c')
-rw-r--r--drivers/crypto/atmel-aes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 855f0ccc9368..245d45f93b61 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -546,7 +546,7 @@ static inline int atmel_aes_complete(struct atmel_aes_dev *dd, int err)
clk_disable(dd->iclk);
dd->flags &= ~AES_FLAGS_BUSY;
- if (!dd->ctx->is_aead &&
+ if (!err && !dd->ctx->is_aead &&
(rctx->mode & AES_FLAGS_OPMODE_MASK) != AES_FLAGS_ECB) {
if ((rctx->mode & AES_FLAGS_OPMODE_MASK) != AES_FLAGS_CTR)
atmel_aes_set_iv_as_last_ciphertext_block(dd);