Skip to content

Commit

Permalink
crypto: authenc - Add EINPROGRESS check
Browse files Browse the repository at this point in the history
When Steffen originally wrote the authenc async hash patch, he
correctly had EINPROGRESS checks in place so that we did not invoke
the original completion handler with it.

Unfortuantely I told him to remove it before the patch was applied.

As only MAY_BACKLOG request completion handlers are required to
handle EINPROGRESS completions, those checks are really needed.

This patch restores them.

Reported-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Apr 26, 2010
1 parent 7478138 commit 180ce7e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crypto/authenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ struct authenc_request_ctx {
char tail[];
};

static void authenc_request_complete(struct aead_request *req, int err)
{
if (err != -EINPROGRESS)
aead_request_complete(req, err);
}

static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
unsigned int keylen)
{
Expand Down Expand Up @@ -142,7 +148,7 @@ static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq,
crypto_aead_authsize(authenc), 1);

out:
aead_request_complete(req, err);
authenc_request_complete(req, err);
}

static void authenc_geniv_ahash_done(struct crypto_async_request *areq, int err)
Expand Down Expand Up @@ -208,7 +214,7 @@ static void authenc_verify_ahash_update_done(struct crypto_async_request *areq,
err = crypto_ablkcipher_decrypt(abreq);

out:
aead_request_complete(req, err);
authenc_request_complete(req, err);
}

static void authenc_verify_ahash_done(struct crypto_async_request *areq,
Expand Down Expand Up @@ -245,7 +251,7 @@ static void authenc_verify_ahash_done(struct crypto_async_request *areq,
err = crypto_ablkcipher_decrypt(abreq);

out:
aead_request_complete(req, err);
authenc_request_complete(req, err);
}

static u8 *crypto_authenc_ahash_fb(struct aead_request *req, unsigned int flags)
Expand Down Expand Up @@ -379,7 +385,7 @@ static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
err = crypto_authenc_genicv(areq, iv, 0);
}

aead_request_complete(areq, err);
authenc_request_complete(areq, err);
}

static int crypto_authenc_encrypt(struct aead_request *req)
Expand Down Expand Up @@ -420,7 +426,7 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req,
err = crypto_authenc_genicv(areq, greq->giv, 0);
}

aead_request_complete(areq, err);
authenc_request_complete(areq, err);
}

static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req)
Expand Down

0 comments on commit 180ce7e

Please sign in to comment.