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/gcm.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/gcm.c')
-rw-r--r-- | crypto/gcm.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/crypto/gcm.c b/crypto/gcm.c index 2f5fbba6576c..1a252639ef91 100644 --- a/crypto/gcm.c +++ b/crypto/gcm.c | |||
@@ -1102,21 +1102,6 @@ static int crypto_rfc4543_setauthsize(struct crypto_aead *parent, | |||
1102 | return crypto_aead_setauthsize(ctx->child, authsize); | 1102 | return crypto_aead_setauthsize(ctx->child, authsize); |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | /* this is the same as crypto_authenc_chain */ | ||
1106 | static void crypto_rfc4543_chain(struct scatterlist *head, | ||
1107 | struct scatterlist *sg, int chain) | ||
1108 | { | ||
1109 | if (chain) { | ||
1110 | head->length += sg->length; | ||
1111 | sg = scatterwalk_sg_next(sg); | ||
1112 | } | ||
1113 | |||
1114 | if (sg) | ||
1115 | scatterwalk_sg_chain(head, 2, sg); | ||
1116 | else | ||
1117 | sg_mark_end(head); | ||
1118 | } | ||
1119 | |||
1120 | static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, | 1105 | static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, |
1121 | int enc) | 1106 | int enc) |
1122 | { | 1107 | { |
@@ -1154,13 +1139,13 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, | |||
1154 | 1139 | ||
1155 | sg_init_table(payload, 2); | 1140 | sg_init_table(payload, 2); |
1156 | sg_set_buf(payload, req->iv, 8); | 1141 | sg_set_buf(payload, req->iv, 8); |
1157 | crypto_rfc4543_chain(payload, dst, vdst == req->iv + 8); | 1142 | scatterwalk_crypto_chain(payload, dst, vdst == req->iv + 8, 2); |
1158 | assoclen += 8 + req->cryptlen - (enc ? 0 : authsize); | 1143 | assoclen += 8 + req->cryptlen - (enc ? 0 : authsize); |
1159 | 1144 | ||
1160 | sg_init_table(assoc, 2); | 1145 | sg_init_table(assoc, 2); |
1161 | sg_set_page(assoc, sg_page(req->assoc), req->assoc->length, | 1146 | sg_set_page(assoc, sg_page(req->assoc), req->assoc->length, |
1162 | req->assoc->offset); | 1147 | req->assoc->offset); |
1163 | crypto_rfc4543_chain(assoc, payload, 0); | 1148 | scatterwalk_crypto_chain(assoc, payload, 0, 2); |
1164 | 1149 | ||
1165 | aead_request_set_tfm(subreq, ctx->child); | 1150 | aead_request_set_tfm(subreq, ctx->child); |
1166 | aead_request_set_callback(subreq, req->base.flags, req->base.complete, | 1151 | aead_request_set_callback(subreq, req->base.flags, req->base.complete, |