Lines Matching refs:req
26 typedef u8 *(*authenc_ahash_t)(struct aead_request *req, unsigned int flags);
49 static void authenc_request_complete(struct aead_request *req, int err) in authenc_request_complete() argument
52 aead_request_complete(req, err); in authenc_request_complete()
125 struct aead_request *req = areq->data; in authenc_geniv_ahash_update_done() local
126 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in authenc_geniv_ahash_update_done()
128 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in authenc_geniv_ahash_update_done()
136 ahash_request_set_callback(ahreq, aead_request_flags(req) & in authenc_geniv_ahash_update_done()
138 areq_ctx->complete, req); in authenc_geniv_ahash_update_done()
149 authenc_request_complete(req, err); in authenc_geniv_ahash_update_done()
154 struct aead_request *req = areq->data; in authenc_geniv_ahash_done() local
155 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in authenc_geniv_ahash_done()
157 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in authenc_geniv_ahash_done()
168 aead_request_complete(req, err); in authenc_geniv_ahash_done()
177 struct aead_request *req = areq->data; in authenc_verify_ahash_update_done() local
178 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in authenc_verify_ahash_update_done()
180 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in authenc_verify_ahash_update_done()
182 unsigned int cryptlen = req->cryptlen; in authenc_verify_ahash_update_done()
189 ahash_request_set_callback(ahreq, aead_request_flags(req) & in authenc_verify_ahash_update_done()
191 areq_ctx->complete, req); in authenc_verify_ahash_update_done()
207 abreq = aead_request_ctx(req); in authenc_verify_ahash_update_done()
209 ablkcipher_request_set_callback(abreq, aead_request_flags(req), in authenc_verify_ahash_update_done()
210 req->base.complete, req->base.data); in authenc_verify_ahash_update_done()
211 ablkcipher_request_set_crypt(abreq, req->src, req->dst, in authenc_verify_ahash_update_done()
212 cryptlen, req->iv); in authenc_verify_ahash_update_done()
217 authenc_request_complete(req, err); in authenc_verify_ahash_update_done()
226 struct aead_request *req = areq->data; in authenc_verify_ahash_done() local
227 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in authenc_verify_ahash_done()
229 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in authenc_verify_ahash_done()
231 unsigned int cryptlen = req->cryptlen; in authenc_verify_ahash_done()
246 abreq = aead_request_ctx(req); in authenc_verify_ahash_done()
248 ablkcipher_request_set_callback(abreq, aead_request_flags(req), in authenc_verify_ahash_done()
249 req->base.complete, req->base.data); in authenc_verify_ahash_done()
250 ablkcipher_request_set_crypt(abreq, req->src, req->dst, in authenc_verify_ahash_done()
251 cryptlen, req->iv); in authenc_verify_ahash_done()
256 authenc_request_complete(req, err); in authenc_verify_ahash_done()
259 static u8 *crypto_authenc_ahash_fb(struct aead_request *req, unsigned int flags) in crypto_authenc_ahash_fb() argument
261 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_ahash_fb()
264 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_ahash_fb()
278 ahash_request_set_crypt(ahreq, req->assoc, hash, req->assoclen); in crypto_authenc_ahash_fb()
279 ahash_request_set_callback(ahreq, aead_request_flags(req) & flags, in crypto_authenc_ahash_fb()
280 areq_ctx->update_complete, req); in crypto_authenc_ahash_fb()
288 ahash_request_set_callback(ahreq, aead_request_flags(req) & flags, in crypto_authenc_ahash_fb()
289 areq_ctx->complete, req); in crypto_authenc_ahash_fb()
298 static u8 *crypto_authenc_ahash(struct aead_request *req, unsigned int flags) in crypto_authenc_ahash() argument
300 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_ahash()
303 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_ahash()
314 ahash_request_set_callback(ahreq, aead_request_flags(req) & flags, in crypto_authenc_ahash()
315 areq_ctx->complete, req); in crypto_authenc_ahash()
324 static int crypto_authenc_genicv(struct aead_request *req, u8 *iv, in crypto_authenc_genicv() argument
327 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_genicv()
328 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_genicv()
329 struct scatterlist *dst = req->dst; in crypto_authenc_genicv()
330 struct scatterlist *assoc = req->assoc; in crypto_authenc_genicv()
334 unsigned int cryptlen = req->cryptlen; in crypto_authenc_genicv()
351 if (req->assoclen && sg_is_last(assoc)) { in crypto_authenc_genicv()
357 cryptlen += req->assoclen; in crypto_authenc_genicv()
366 hash = authenc_ahash_fn(req, flags); in crypto_authenc_genicv()
375 static void crypto_authenc_encrypt_done(struct crypto_async_request *req, in crypto_authenc_encrypt_done() argument
378 struct aead_request *areq = req->data; in crypto_authenc_encrypt_done()
394 static int crypto_authenc_encrypt(struct aead_request *req) in crypto_authenc_encrypt() argument
396 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_encrypt()
398 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_encrypt()
400 struct scatterlist *dst = req->dst; in crypto_authenc_encrypt()
401 unsigned int cryptlen = req->cryptlen; in crypto_authenc_encrypt()
408 ablkcipher_request_set_callback(abreq, aead_request_flags(req), in crypto_authenc_encrypt()
409 crypto_authenc_encrypt_done, req); in crypto_authenc_encrypt()
410 ablkcipher_request_set_crypt(abreq, req->src, dst, cryptlen, req->iv); in crypto_authenc_encrypt()
412 memcpy(iv, req->iv, crypto_aead_ivsize(authenc)); in crypto_authenc_encrypt()
418 return crypto_authenc_genicv(req, iv, CRYPTO_TFM_REQ_MAY_SLEEP); in crypto_authenc_encrypt()
421 static void crypto_authenc_givencrypt_done(struct crypto_async_request *req, in crypto_authenc_givencrypt_done() argument
424 struct aead_request *areq = req->data; in crypto_authenc_givencrypt_done()
435 static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req) in crypto_authenc_givencrypt() argument
437 struct crypto_aead *authenc = aead_givcrypt_reqtfm(req); in crypto_authenc_givencrypt()
439 struct aead_request *areq = &req->areq; in crypto_authenc_givencrypt()
441 u8 *iv = req->giv; in crypto_authenc_givencrypt()
449 skcipher_givcrypt_set_giv(greq, iv, req->seq); in crypto_authenc_givencrypt()
458 static int crypto_authenc_verify(struct aead_request *req, in crypto_authenc_verify() argument
461 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_verify()
462 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_verify()
470 ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP); in crypto_authenc_verify()
481 static int crypto_authenc_iverify(struct aead_request *req, u8 *iv, in crypto_authenc_iverify() argument
484 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_iverify()
485 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_iverify()
486 struct scatterlist *src = req->src; in crypto_authenc_iverify()
487 struct scatterlist *assoc = req->assoc; in crypto_authenc_iverify()
506 if (req->assoclen && sg_is_last(assoc)) { in crypto_authenc_iverify()
512 cryptlen += req->assoclen; in crypto_authenc_iverify()
518 return crypto_authenc_verify(req, authenc_ahash_fn); in crypto_authenc_iverify()
521 static int crypto_authenc_decrypt(struct aead_request *req) in crypto_authenc_decrypt() argument
523 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_decrypt()
525 struct ablkcipher_request *abreq = aead_request_ctx(req); in crypto_authenc_decrypt()
526 unsigned int cryptlen = req->cryptlen; in crypto_authenc_decrypt()
528 u8 *iv = req->iv; in crypto_authenc_decrypt()
535 err = crypto_authenc_iverify(req, iv, cryptlen); in crypto_authenc_decrypt()
540 ablkcipher_request_set_callback(abreq, aead_request_flags(req), in crypto_authenc_decrypt()
541 req->base.complete, req->base.data); in crypto_authenc_decrypt()
542 ablkcipher_request_set_crypt(abreq, req->src, req->dst, cryptlen, iv); in crypto_authenc_decrypt()