]> Git Repo - linux.git/commitdiff
crypto: qce - re-initialize context on import
authorSivaprakash Murugesan <[email protected]>
Mon, 22 Jun 2020 06:15:05 +0000 (11:45 +0530)
committerHerbert Xu <[email protected]>
Fri, 3 Jul 2020 04:18:34 +0000 (14:18 +1000)
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
drivers/crypto/qce/sha.c

index ed82520203f94fe6ff9cbafceee93795e2df1eb7..9e54a667d72f2a569855540b895f4dea15242885 100644 (file)
@@ -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;
This page took 0.054349 seconds and 4 git commands to generate.