crypto: ccree - fix AEAD decrypt auth fail
authorGilad Ben-Yossef <gilad@benyossef.com>
Thu, 16 Jan 2020 10:14:38 +0000 (12:14 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 22 Jan 2020 08:21:09 +0000 (16:21 +0800)
On AEAD decryption authentication failure we are suppose to
zero out the output plaintext buffer. However, we've missed
skipping the optional associated data that may prefix the
ciphertext. This commit fixes this issue.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Fixes: e88b27c8eaa8 ("crypto: ccree - use std api sg_zero_buffer")
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccree/cc_aead.c

index d014c8e..754de30 100644 (file)
@@ -237,7 +237,7 @@ static void cc_aead_complete(struct device *dev, void *cc_req, int err)
                         * revealed the decrypted message --> zero its memory.
                         */
                        sg_zero_buffer(areq->dst, sg_nents(areq->dst),
-                                      areq->cryptlen, 0);
+                                      areq->cryptlen, areq->assoclen);
                        err = -EBADMSG;
                }
        /*ENCRYPT*/