crypto: Use scatterwalk_crypto_chain
Use scatterwalk_crypto_chain in favor of locally defined chaining functions. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:

committed by
Herbert Xu

parent
079f2f7485
commit
c920fa6051
@@ -107,20 +107,6 @@ badkey:
|
||||
goto out;
|
||||
}
|
||||
|
||||
static void authenc_chain(struct scatterlist *head, struct scatterlist *sg,
|
||||
int chain)
|
||||
{
|
||||
if (chain) {
|
||||
head->length += sg->length;
|
||||
sg = scatterwalk_sg_next(sg);
|
||||
}
|
||||
|
||||
if (sg)
|
||||
scatterwalk_sg_chain(head, 2, sg);
|
||||
else
|
||||
sg_mark_end(head);
|
||||
}
|
||||
|
||||
static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq,
|
||||
int err)
|
||||
{
|
||||
@@ -345,7 +331,7 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv,
|
||||
if (ivsize) {
|
||||
sg_init_table(cipher, 2);
|
||||
sg_set_buf(cipher, iv, ivsize);
|
||||
authenc_chain(cipher, dst, vdst == iv + ivsize);
|
||||
scatterwalk_crypto_chain(cipher, dst, vdst == iv + ivsize, 2);
|
||||
dst = cipher;
|
||||
cryptlen += ivsize;
|
||||
}
|
||||
@@ -354,7 +340,7 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv,
|
||||
authenc_ahash_fn = crypto_authenc_ahash;
|
||||
sg_init_table(asg, 2);
|
||||
sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset);
|
||||
authenc_chain(asg, dst, 0);
|
||||
scatterwalk_crypto_chain(asg, dst, 0, 2);
|
||||
dst = asg;
|
||||
cryptlen += req->assoclen;
|
||||
}
|
||||
@@ -499,7 +485,7 @@ static int crypto_authenc_iverify(struct aead_request *req, u8 *iv,
|
||||
if (ivsize) {
|
||||
sg_init_table(cipher, 2);
|
||||
sg_set_buf(cipher, iv, ivsize);
|
||||
authenc_chain(cipher, src, vsrc == iv + ivsize);
|
||||
scatterwalk_crypto_chain(cipher, src, vsrc == iv + ivsize, 2);
|
||||
src = cipher;
|
||||
cryptlen += ivsize;
|
||||
}
|
||||
@@ -508,7 +494,7 @@ static int crypto_authenc_iverify(struct aead_request *req, u8 *iv,
|
||||
authenc_ahash_fn = crypto_authenc_ahash;
|
||||
sg_init_table(asg, 2);
|
||||
sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset);
|
||||
authenc_chain(asg, src, 0);
|
||||
scatterwalk_crypto_chain(asg, src, 0, 2);
|
||||
src = asg;
|
||||
cryptlen += req->assoclen;
|
||||
}
|
||||
|
Reference in New Issue
Block a user