diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2010-11-22 05:26:54 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-12-02 01:47:16 -0500 |
commit | c920fa6051c1e7eb3733eaefd01e5bcdddb3d4c8 (patch) | |
tree | 6f65fd0889e9aa836bf39c953cae3071628ed2df /crypto/authenc.c | |
parent | 079f2f7485648c1397a35575fae45908a0db5ba6 (diff) |
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>
Diffstat (limited to 'crypto/authenc.c')
-rw-r--r-- | crypto/authenc.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/crypto/authenc.c b/crypto/authenc.c index a5a22cfcd07b..5ef7ba6b6a76 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
@@ -107,20 +107,6 @@ badkey: | |||
107 | goto out; | 107 | goto out; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void authenc_chain(struct scatterlist *head, struct scatterlist *sg, | ||
111 | int chain) | ||
112 | { | ||
113 | if (chain) { | ||
114 | head->length += sg->length; | ||
115 | sg = scatterwalk_sg_next(sg); | ||
116 | } | ||
117 | |||
118 | if (sg) | ||
119 | scatterwalk_sg_chain(head, 2, sg); | ||
120 | else | ||
121 | sg_mark_end(head); | ||
122 | } | ||
123 | |||
124 | static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq, | 110 | static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq, |
125 | int err) | 111 | int err) |
126 | { | 112 | { |
@@ -345,7 +331,7 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv, | |||
345 | if (ivsize) { | 331 | if (ivsize) { |
346 | sg_init_table(cipher, 2); | 332 | sg_init_table(cipher, 2); |
347 | sg_set_buf(cipher, iv, ivsize); | 333 | sg_set_buf(cipher, iv, ivsize); |
348 | authenc_chain(cipher, dst, vdst == iv + ivsize); | 334 | scatterwalk_crypto_chain(cipher, dst, vdst == iv + ivsize, 2); |
349 | dst = cipher; | 335 | dst = cipher; |
350 | cryptlen += ivsize; | 336 | cryptlen += ivsize; |
351 | } | 337 | } |
@@ -354,7 +340,7 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv, | |||
354 | authenc_ahash_fn = crypto_authenc_ahash; | 340 | authenc_ahash_fn = crypto_authenc_ahash; |
355 | sg_init_table(asg, 2); | 341 | sg_init_table(asg, 2); |
356 | sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset); | 342 | sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset); |
357 | authenc_chain(asg, dst, 0); | 343 | scatterwalk_crypto_chain(asg, dst, 0, 2); |
358 | dst = asg; | 344 | dst = asg; |
359 | cryptlen += req->assoclen; | 345 | cryptlen += req->assoclen; |
360 | } | 346 | } |
@@ -499,7 +485,7 @@ static int crypto_authenc_iverify(struct aead_request *req, u8 *iv, | |||
499 | if (ivsize) { | 485 | if (ivsize) { |
500 | sg_init_table(cipher, 2); | 486 | sg_init_table(cipher, 2); |
501 | sg_set_buf(cipher, iv, ivsize); | 487 | sg_set_buf(cipher, iv, ivsize); |
502 | authenc_chain(cipher, src, vsrc == iv + ivsize); | 488 | scatterwalk_crypto_chain(cipher, src, vsrc == iv + ivsize, 2); |
503 | src = cipher; | 489 | src = cipher; |
504 | cryptlen += ivsize; | 490 | cryptlen += ivsize; |
505 | } | 491 | } |
@@ -508,7 +494,7 @@ static int crypto_authenc_iverify(struct aead_request *req, u8 *iv, | |||
508 | authenc_ahash_fn = crypto_authenc_ahash; | 494 | authenc_ahash_fn = crypto_authenc_ahash; |
509 | sg_init_table(asg, 2); | 495 | sg_init_table(asg, 2); |
510 | sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset); | 496 | sg_set_page(asg, sg_page(assoc), assoc->length, assoc->offset); |
511 | authenc_chain(asg, src, 0); | 497 | scatterwalk_crypto_chain(asg, src, 0, 2); |
512 | src = asg; | 498 | src = asg; |
513 | cryptlen += req->assoclen; | 499 | cryptlen += req->assoclen; |
514 | } | 500 | } |