Commit 1900c583 authored by Cyrille Pitchen's avatar Cyrille Pitchen Committed by Herbert Xu

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: default avatarCyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 952bce97
...@@ -939,6 +939,7 @@ static int atmel_sha_final(struct ahash_request *req) ...@@ -939,6 +939,7 @@ static int atmel_sha_final(struct ahash_request *req)
if (err) if (err)
goto err1; goto err1;
dd->req = req;
dd->flags |= SHA_FLAGS_BUSY; dd->flags |= SHA_FLAGS_BUSY;
err = atmel_sha_final_req(dd); err = atmel_sha_final_req(dd);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment