aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/gcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/gcm.c')
-rw-r--r--crypto/gcm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/crypto/gcm.c b/crypto/gcm.c
index 4ff213997fbd..b0d3cb12334d 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -1099,6 +1099,21 @@ static int crypto_rfc4543_setauthsize(struct crypto_aead *parent,
1099 return crypto_aead_setauthsize(ctx->child, authsize); 1099 return crypto_aead_setauthsize(ctx->child, authsize);
1100} 1100}
1101 1101
1102static void crypto_rfc4543_done(struct crypto_async_request *areq, int err)
1103{
1104 struct aead_request *req = areq->data;
1105 struct crypto_aead *aead = crypto_aead_reqtfm(req);
1106 struct crypto_rfc4543_req_ctx *rctx = crypto_rfc4543_reqctx(req);
1107
1108 if (!err) {
1109 scatterwalk_map_and_copy(rctx->auth_tag, req->dst,
1110 req->cryptlen,
1111 crypto_aead_authsize(aead), 1);
1112 }
1113
1114 aead_request_complete(req, err);
1115}
1116
1102static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, 1117static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
1103 bool enc) 1118 bool enc)
1104{ 1119{
@@ -1145,8 +1160,8 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
1145 scatterwalk_crypto_chain(assoc, payload, 0, 2); 1160 scatterwalk_crypto_chain(assoc, payload, 0, 2);
1146 1161
1147 aead_request_set_tfm(subreq, ctx->child); 1162 aead_request_set_tfm(subreq, ctx->child);
1148 aead_request_set_callback(subreq, req->base.flags, req->base.complete, 1163 aead_request_set_callback(subreq, req->base.flags, crypto_rfc4543_done,
1149 req->base.data); 1164 req);
1150 aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv); 1165 aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv);
1151 aead_request_set_assoc(subreq, assoc, assoclen); 1166 aead_request_set_assoc(subreq, assoc, assoclen);
1152 1167