From: Sivaprakash Murugesan <sivaprak@codeaurora.org>
To: herbert@gondor.apana.org.au, davem@davemloft.net,
stanimir.varbanov@linaro.org, ardb@kernel.org,
sivaprak@codeaurora.org, cotequeiroz@gmail.com,
ebiggers@google.com, horia.geanta@nxp.com,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] crypto: qce: re-initialize context on import
Date: Mon, 22 Jun 2020 11:45:05 +0530 [thread overview]
Message-ID: <1592806506-23978-3-git-send-email-sivaprak@codeaurora.org> (raw)
In-Reply-To: <1592806506-23978-1-git-send-email-sivaprak@codeaurora.org>
crypto testmgr deliberately corrupts the request context while passing
vectors to the import. This is to make sure that drivers do not rely on
request but they take all the necessary input from io vec passed to it.
qce casts the request context from request parameter, since it is corrupted
the sub squent hash request fails and qce hangs.
To avoid this re-initialize request context on import. The qce import
API alreasy takes care of taking the input vectors from passed io vec.
Signed-off-by: Sivaprakash Murugesan <sivaprak@codeaurora.org>
---
drivers/crypto/qce/sha.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c
index ed82520203f9..9e54a667d72f 100644
--- a/drivers/crypto/qce/sha.c
+++ b/drivers/crypto/qce/sha.c
@@ -203,10 +203,18 @@ static int qce_import_common(struct ahash_request *req, u64 in_count,
static int qce_ahash_import(struct ahash_request *req, const void *in)
{
- struct qce_sha_reqctx *rctx = ahash_request_ctx(req);
- unsigned long flags = rctx->flags;
- bool hmac = IS_SHA_HMAC(flags);
- int ret = -EINVAL;
+ struct qce_sha_reqctx *rctx;
+ unsigned long flags;
+ bool hmac;
+ int ret;
+
+ ret = qce_ahash_init(req);
+ if (ret)
+ return ret;
+
+ rctx = ahash_request_ctx(req);
+ flags = rctx->flags;
+ hmac = IS_SHA_HMAC(flags);
if (IS_SHA1(flags) || IS_SHA1_HMAC(flags)) {
const struct sha1_state *state = in;
--
2.7.4
next prev parent reply other threads:[~2020-06-22 6:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 6:15 [PATCH 0/3] qce crypto fixes for tcrypto failures Sivaprakash Murugesan
2020-06-22 6:15 ` [PATCH 1/3] crypto: qce: support zero length test vectors Sivaprakash Murugesan
2020-06-22 6:15 ` Sivaprakash Murugesan [this message]
2020-06-22 6:15 ` [PATCH 3/3] crypto: qce: sha: Do not modify scatterlist passed along with request Sivaprakash Murugesan
2020-07-03 4:48 ` [PATCH 0/3] qce crypto fixes for tcrypto failures Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1592806506-23978-3-git-send-email-sivaprak@codeaurora.org \
--to=sivaprak@codeaurora.org \
--cc=ardb@kernel.org \
--cc=cotequeiroz@gmail.com \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stanimir.varbanov@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox