summaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2023-12-01 19:06:21 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2023-12-08 11:59:45 +0800
commitafffcf3db98b9495114b79d5381f8cc3f69476fb (patch)
tree04ade7105e27d17074aaa65dadbfe04d8ea62de2 /drivers/crypto
parent9f10bc28c0fb676ae58aa3bfa358db8f5de124bb (diff)
downloadlinux-stable-afffcf3db98b9495114b79d5381f8cc3f69476fb.tar.gz
linux-stable-afffcf3db98b9495114b79d5381f8cc3f69476fb.tar.bz2
linux-stable-afffcf3db98b9495114b79d5381f8cc3f69476fb.zip
crypto: sahara - fix ahash selftest failure
update() calls should not modify the result buffer, so add an additional check for "rctx->last" to make sure that only the final hash value is copied into the buffer. Fixes the following selftest failure: alg: ahash: sahara-sha256 update() used result buffer on test vector 3, cfg="init+update+final aligned buffer" Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256") Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/sahara.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 888e5e5157bb..863171b44cda 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -1047,7 +1047,7 @@ static int sahara_sha_process(struct ahash_request *req)
memcpy(rctx->context, dev->context_base, rctx->context_size);
- if (req->result)
+ if (req->result && rctx->last)
memcpy(req->result, rctx->context, rctx->digest_size);
return 0;