Lines Matching refs:req
45 static void authenc_request_complete(struct aead_request *req, int err) in authenc_request_complete() argument
48 aead_request_complete(req, err); in authenc_request_complete()
120 struct aead_request *req = areq->data; in authenc_geniv_ahash_done() local
121 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in authenc_geniv_ahash_done()
124 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in authenc_geniv_ahash_done()
130 scatterwalk_map_and_copy(ahreq->result, req->dst, in authenc_geniv_ahash_done()
131 req->assoclen + req->cryptlen, in authenc_geniv_ahash_done()
135 aead_request_complete(req, err); in authenc_geniv_ahash_done()
138 static int crypto_authenc_genicv(struct aead_request *req, unsigned int flags) in crypto_authenc_genicv() argument
140 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_genicv()
145 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_genicv()
154 ahash_request_set_crypt(ahreq, req->dst, hash, in crypto_authenc_genicv()
155 req->assoclen + req->cryptlen); in crypto_authenc_genicv()
157 authenc_geniv_ahash_done, req); in crypto_authenc_genicv()
163 scatterwalk_map_and_copy(hash, req->dst, req->assoclen + req->cryptlen, in crypto_authenc_genicv()
169 static void crypto_authenc_encrypt_done(struct crypto_async_request *req, in crypto_authenc_encrypt_done() argument
172 struct aead_request *areq = req->data; in crypto_authenc_encrypt_done()
183 static int crypto_authenc_copy_assoc(struct aead_request *req) in crypto_authenc_copy_assoc() argument
185 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_copy_assoc()
191 return crypto_blkcipher_encrypt(&desc, req->dst, req->src, in crypto_authenc_copy_assoc()
192 req->assoclen); in crypto_authenc_copy_assoc()
195 static int crypto_authenc_encrypt(struct aead_request *req) in crypto_authenc_encrypt() argument
197 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_encrypt()
201 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_encrypt()
203 unsigned int cryptlen = req->cryptlen; in crypto_authenc_encrypt()
210 src = scatterwalk_ffwd(areq_ctx->src, req->src, req->assoclen); in crypto_authenc_encrypt()
213 if (req->src != req->dst) { in crypto_authenc_encrypt()
214 err = crypto_authenc_copy_assoc(req); in crypto_authenc_encrypt()
219 dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen); in crypto_authenc_encrypt()
223 ablkcipher_request_set_callback(abreq, aead_request_flags(req), in crypto_authenc_encrypt()
224 crypto_authenc_encrypt_done, req); in crypto_authenc_encrypt()
225 ablkcipher_request_set_crypt(abreq, src, dst, cryptlen, req->iv); in crypto_authenc_encrypt()
231 return crypto_authenc_genicv(req, aead_request_flags(req)); in crypto_authenc_encrypt()
234 static int crypto_authenc_decrypt_tail(struct aead_request *req, in crypto_authenc_decrypt_tail() argument
237 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_decrypt_tail()
241 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_decrypt_tail()
249 scatterwalk_map_and_copy(ihash, req->src, ahreq->nbytes, authsize, 0); in crypto_authenc_decrypt_tail()
255 src = scatterwalk_ffwd(areq_ctx->src, req->src, req->assoclen); in crypto_authenc_decrypt_tail()
258 if (req->src != req->dst) { in crypto_authenc_decrypt_tail()
260 dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen); in crypto_authenc_decrypt_tail()
264 ablkcipher_request_set_callback(abreq, aead_request_flags(req), in crypto_authenc_decrypt_tail()
265 req->base.complete, req->base.data); in crypto_authenc_decrypt_tail()
267 req->cryptlen - authsize, req->iv); in crypto_authenc_decrypt_tail()
275 struct aead_request *req = areq->data; in authenc_verify_ahash_done() local
280 err = crypto_authenc_decrypt_tail(req, 0); in authenc_verify_ahash_done()
283 authenc_request_complete(req, err); in authenc_verify_ahash_done()
286 static int crypto_authenc_decrypt(struct aead_request *req) in crypto_authenc_decrypt() argument
288 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_decrypt()
294 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_decrypt()
303 ahash_request_set_crypt(ahreq, req->src, hash, in crypto_authenc_decrypt()
304 req->assoclen + req->cryptlen - authsize); in crypto_authenc_decrypt()
305 ahash_request_set_callback(ahreq, aead_request_flags(req), in crypto_authenc_decrypt()
306 authenc_verify_ahash_done, req); in crypto_authenc_decrypt()
312 return crypto_authenc_decrypt_tail(req, aead_request_flags(req)); in crypto_authenc_decrypt()