summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/atmel-sha.c
diff options
context:
space:
mode:
authorCyrille Pitchen <cyrille.pitchen@atmel.com>2016-01-15 15:49:31 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-01-25 15:42:06 +0100
commit1900c583c8e24df9d07282598166279187dce832 (patch)
tree209725373318a6f72f1b5eac6d5f3e5c18f46809 /drivers/crypto/atmel-sha.c
parentcrypto: ccp - Add hash state import and export support (diff)
downloadlinux-1900c583c8e24df9d07282598166279187dce832.tar.xz
linux-1900c583c8e24df9d07282598166279187dce832.zip
crypto: atmel-sha - fix crash when computing digest on empty message
This patch fixes a crash which occured during the computation of the digest of an empty message. Indeed, when processing an empty message, the atmel_sha_handle_queue() function was never called, hence the dd->req pointer remained uninitialized. Later, when the atmel_sha_final_req() function was called, it used to crash while using this uninitialized dd->req pointer. Hence this patch adds missing initializations of dd->req before calls of the atmel_sha_final_req() function. This bug prevented us from passing the tcrypt test suite on SHA algo. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/atmel-sha.c')
-rw-r--r--drivers/crypto/atmel-sha.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 20de861aa0ea..006b2aefba30 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -939,6 +939,7 @@ static int atmel_sha_final(struct ahash_request *req)
if (err)
goto err1;
+ dd->req = req;
dd->flags |= SHA_FLAGS_BUSY;
err = atmel_sha_final_req(dd);
} else {