Skip to content

Commit

Permalink
crypto: authenc - Remove redundant sg_init_table call.
Browse files Browse the repository at this point in the history
Remove redundant sg_init_table call. scatterwalk_ffwd doing the same.

Signed-off-by: Harsh Jain <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Harsh Jain authored and herbertx committed Jun 29, 2016
1 parent 72259de commit c34252f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions crypto/authenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ static int crypto_authenc_encrypt(struct aead_request *req)
struct scatterlist *src, *dst;
int err;

sg_init_table(areq_ctx->src, 2);
src = scatterwalk_ffwd(areq_ctx->src, req->src, req->assoclen);
dst = src;

Expand All @@ -215,7 +214,6 @@ static int crypto_authenc_encrypt(struct aead_request *req)
if (err)
return err;

sg_init_table(areq_ctx->dst, 2);
dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen);
}

Expand Down Expand Up @@ -251,14 +249,11 @@ static int crypto_authenc_decrypt_tail(struct aead_request *req,
if (crypto_memneq(ihash, ahreq->result, authsize))
return -EBADMSG;

sg_init_table(areq_ctx->src, 2);
src = scatterwalk_ffwd(areq_ctx->src, req->src, req->assoclen);
dst = src;

if (req->src != req->dst) {
sg_init_table(areq_ctx->dst, 2);
if (req->src != req->dst)
dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen);
}

ablkcipher_request_set_tfm(abreq, ctx->enc);
ablkcipher_request_set_callback(abreq, aead_request_flags(req),
Expand Down

0 comments on commit c34252f

Please sign in to comment.