Skip to content

Commit 0bdd345

Browse files
Gilad Ben-Yossefgregkh
authored andcommitted
crypto: ccree - unmap buffer before copying IV
commit c139c72 upstream. We were copying the last ciphertext block into the IV field for CBC before removing the DMA mapping of the output buffer with the result of the buffer sometime being out-of-sync cache wise and were getting intermittent cases of bad output IV. Fix it by moving the DMA buffer unmapping before the copy. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Fixes: 00904aa ("crypto: ccree - fix iv handling") Cc: <stable@vger.kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 009eeb9 commit 0bdd345

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/crypto/ccree/cc_cipher.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ static void cc_cipher_complete(struct device *dev, void *cc_req, int err)
635635
unsigned int ivsize = crypto_skcipher_ivsize(sk_tfm);
636636
unsigned int len;
637637

638+
cc_unmap_cipher_request(dev, req_ctx, ivsize, src, dst);
639+
638640
switch (ctx_p->cipher_mode) {
639641
case DRV_CIPHER_CBC:
640642
/*
@@ -664,7 +666,6 @@ static void cc_cipher_complete(struct device *dev, void *cc_req, int err)
664666
break;
665667
}
666668

667-
cc_unmap_cipher_request(dev, req_ctx, ivsize, src, dst);
668669
kzfree(req_ctx->iv);
669670

670671
skcipher_request_complete(req, err);

0 commit comments

Comments
 (0)