diff options
| author | Gilad Ben-Yossef <gilad@benyossef.com> | 2019-01-15 15:43:15 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-23 20:11:12 +0100 |
| commit | 4fc9f0e1c9ffe9ae6dd8591055be95c5fc176996 (patch) | |
| tree | 492e8529cd92d4752b511dd2702430c0a69468dd /drivers/crypto | |
| parent | 37ff06fd9cb5dd7dbf401a321d0cd3658e918a63 (diff) | |
| download | talos-obmc-linux-4fc9f0e1c9ffe9ae6dd8591055be95c5fc176996.tar.gz talos-obmc-linux-4fc9f0e1c9ffe9ae6dd8591055be95c5fc176996.zip | |
crypto: ccree - unmap buffer before copying IV
commit c139c72e2beb3e3db5148910b3962b7322e24374 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: 00904aa0cd59 ("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>
Diffstat (limited to 'drivers/crypto')
| -rw-r--r-- | drivers/crypto/ccree/cc_cipher.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 8948007e0b49..e1fa2e8dbf2d 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -653,6 +653,8 @@ static void cc_cipher_complete(struct device *dev, void *cc_req, int err) unsigned int ivsize = crypto_skcipher_ivsize(sk_tfm); unsigned int len; + cc_unmap_cipher_request(dev, req_ctx, ivsize, src, dst); + switch (ctx_p->cipher_mode) { case DRV_CIPHER_CBC: /* @@ -682,7 +684,6 @@ static void cc_cipher_complete(struct device *dev, void *cc_req, int err) break; } - cc_unmap_cipher_request(dev, req_ctx, ivsize, src, dst); kzfree(req_ctx->iv); skcipher_request_complete(req, err); |

