• Home
  • Raw
  • Download

Lines Matching refs:req

62 	struct aead_request *req)  in crypto_ccm_reqctx()  argument
64 unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req)); in crypto_ccm_reqctx()
66 return (void *)PTR_ALIGN((u8 *)aead_request_ctx(req), align + 1); in crypto_ccm_reqctx()
127 static int format_input(u8 *info, struct aead_request *req, in format_input() argument
130 struct crypto_aead *aead = crypto_aead_reqtfm(req); in format_input()
131 unsigned int lp = req->iv[0]; in format_input()
137 memcpy(info, req->iv, 16); in format_input()
143 if (req->assoclen) in format_input()
168 static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, in crypto_ccm_auth() argument
171 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_auth()
172 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_ccm_auth()
175 unsigned int assoclen = req->assoclen; in crypto_ccm_auth()
182 err = format_input(odata, req, cryptlen); in crypto_ccm_auth()
193 sg_chain(sg, 3, req->src); in crypto_ccm_auth()
196 sg_chain(sg, 2, req->src); in crypto_ccm_auth()
229 struct aead_request *req = areq->data; in crypto_ccm_encrypt_done() local
230 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_ccm_encrypt_done()
231 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_encrypt_done()
235 scatterwalk_map_and_copy(odata, req->dst, in crypto_ccm_encrypt_done()
236 req->assoclen + req->cryptlen, in crypto_ccm_encrypt_done()
238 aead_request_complete(req, err); in crypto_ccm_encrypt_done()
250 static int crypto_ccm_init_crypt(struct aead_request *req, u8 *tag) in crypto_ccm_init_crypt() argument
252 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_init_crypt()
254 u8 *iv = req->iv; in crypto_ccm_init_crypt()
261 pctx->flags = aead_request_flags(req); in crypto_ccm_init_crypt()
270 sg = scatterwalk_ffwd(pctx->src + 1, req->src, req->assoclen); in crypto_ccm_init_crypt()
274 if (req->src != req->dst) { in crypto_ccm_init_crypt()
277 sg = scatterwalk_ffwd(pctx->dst + 1, req->dst, req->assoclen); in crypto_ccm_init_crypt()
285 static int crypto_ccm_encrypt(struct aead_request *req) in crypto_ccm_encrypt() argument
287 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_ccm_encrypt()
289 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_encrypt()
292 unsigned int cryptlen = req->cryptlen; in crypto_ccm_encrypt()
294 u8 *iv = req->iv; in crypto_ccm_encrypt()
297 err = crypto_ccm_init_crypt(req, odata); in crypto_ccm_encrypt()
301 err = crypto_ccm_auth(req, sg_next(pctx->src), cryptlen); in crypto_ccm_encrypt()
306 if (req->src != req->dst) in crypto_ccm_encrypt()
311 crypto_ccm_encrypt_done, req); in crypto_ccm_encrypt()
326 struct aead_request *req = areq->data; in crypto_ccm_decrypt_done() local
327 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_decrypt_done()
328 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_ccm_decrypt_done()
330 unsigned int cryptlen = req->cryptlen - authsize; in crypto_ccm_decrypt_done()
335 dst = sg_next(req->src == req->dst ? pctx->src : pctx->dst); in crypto_ccm_decrypt_done()
338 err = crypto_ccm_auth(req, dst, cryptlen); in crypto_ccm_decrypt_done()
342 aead_request_complete(req, err); in crypto_ccm_decrypt_done()
345 static int crypto_ccm_decrypt(struct aead_request *req) in crypto_ccm_decrypt() argument
347 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_ccm_decrypt()
349 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_decrypt()
353 unsigned int cryptlen = req->cryptlen; in crypto_ccm_decrypt()
361 err = crypto_ccm_init_crypt(req, authtag); in crypto_ccm_decrypt()
369 if (req->src != req->dst) in crypto_ccm_decrypt()
372 memcpy(iv, req->iv, 16); in crypto_ccm_decrypt()
376 crypto_ccm_decrypt_done, req); in crypto_ccm_decrypt()
382 err = crypto_ccm_auth(req, sg_next(dst), cryptlen); in crypto_ccm_decrypt()
604 static struct aead_request *crypto_rfc4309_crypt(struct aead_request *req) in crypto_rfc4309_crypt() argument
606 struct crypto_rfc4309_req_ctx *rctx = aead_request_ctx(req); in crypto_rfc4309_crypt()
608 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_rfc4309_crypt()
619 memcpy(iv + 4, req->iv, 8); in crypto_rfc4309_crypt()
621 scatterwalk_map_and_copy(iv + 16, req->src, 0, req->assoclen - 8, 0); in crypto_rfc4309_crypt()
624 sg_set_buf(rctx->src, iv + 16, req->assoclen - 8); in crypto_rfc4309_crypt()
625 sg = scatterwalk_ffwd(rctx->src + 1, req->src, req->assoclen); in crypto_rfc4309_crypt()
629 if (req->src != req->dst) { in crypto_rfc4309_crypt()
631 sg_set_buf(rctx->dst, iv + 16, req->assoclen - 8); in crypto_rfc4309_crypt()
632 sg = scatterwalk_ffwd(rctx->dst + 1, req->dst, req->assoclen); in crypto_rfc4309_crypt()
638 aead_request_set_callback(subreq, req->base.flags, req->base.complete, in crypto_rfc4309_crypt()
639 req->base.data); in crypto_rfc4309_crypt()
641 req->src == req->dst ? rctx->src : rctx->dst, in crypto_rfc4309_crypt()
642 req->cryptlen, iv); in crypto_rfc4309_crypt()
643 aead_request_set_ad(subreq, req->assoclen - 8); in crypto_rfc4309_crypt()
648 static int crypto_rfc4309_encrypt(struct aead_request *req) in crypto_rfc4309_encrypt() argument
650 if (req->assoclen != 16 && req->assoclen != 20) in crypto_rfc4309_encrypt()
653 req = crypto_rfc4309_crypt(req); in crypto_rfc4309_encrypt()
655 return crypto_aead_encrypt(req); in crypto_rfc4309_encrypt()
658 static int crypto_rfc4309_decrypt(struct aead_request *req) in crypto_rfc4309_decrypt() argument
660 if (req->assoclen != 16 && req->assoclen != 20) in crypto_rfc4309_decrypt()
663 req = crypto_rfc4309_crypt(req); in crypto_rfc4309_decrypt()
665 return crypto_aead_decrypt(req); in crypto_rfc4309_decrypt()