Lines Matching refs:pctx
171 struct crypto_ccm_req_priv_ctx *pctx) in compute_mac() argument
174 u8 *odata = pctx->odata; in compute_mac()
175 u8 *idata = pctx->idata; in compute_mac()
181 getlen = bs - pctx->ilen; in compute_mac()
183 memcpy(idata + pctx->ilen, data, getlen); in compute_mac()
188 pctx->ilen = 0; in compute_mac()
204 memcpy(idata + pctx->ilen, data, datalen); in compute_mac()
205 pctx->ilen += datalen; in compute_mac()
210 struct crypto_ccm_req_priv_ctx *pctx, in get_data_to_compute() argument
227 compute_mac(tfm, data_src, n, pctx); in get_data_to_compute()
234 crypto_yield(pctx->flags); in get_data_to_compute()
238 if (pctx->ilen) { in get_data_to_compute()
240 u8 *odata = pctx->odata; in get_data_to_compute()
241 u8 *idata = pctx->idata; in get_data_to_compute()
243 padlen = 16 - pctx->ilen; in get_data_to_compute()
244 memset(idata + pctx->ilen, 0, padlen); in get_data_to_compute()
247 pctx->ilen = 0; in get_data_to_compute()
256 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_auth() local
259 u8 *odata = pctx->odata; in crypto_ccm_auth()
260 u8 *idata = pctx->idata; in crypto_ccm_auth()
273 pctx->ilen = format_adata(idata, assoclen); in crypto_ccm_auth()
274 get_data_to_compute(cipher, pctx, req->src, req->assoclen); in crypto_ccm_auth()
276 pctx->ilen = 0; in crypto_ccm_auth()
281 get_data_to_compute(cipher, pctx, plain, cryptlen); in crypto_ccm_auth()
291 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_encrypt_done() local
292 u8 *odata = pctx->odata; in crypto_ccm_encrypt_done()
312 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_init_crypt() local
321 pctx->flags = aead_request_flags(req); in crypto_ccm_init_crypt()
328 sg_init_table(pctx->src, 3); in crypto_ccm_init_crypt()
329 sg_set_buf(pctx->src, tag, 16); in crypto_ccm_init_crypt()
330 sg = scatterwalk_ffwd(pctx->src + 1, req->src, req->assoclen); in crypto_ccm_init_crypt()
331 if (sg != pctx->src + 1) in crypto_ccm_init_crypt()
332 sg_chain(pctx->src, 2, sg); in crypto_ccm_init_crypt()
335 sg_init_table(pctx->dst, 3); in crypto_ccm_init_crypt()
336 sg_set_buf(pctx->dst, tag, 16); in crypto_ccm_init_crypt()
337 sg = scatterwalk_ffwd(pctx->dst + 1, req->dst, req->assoclen); in crypto_ccm_init_crypt()
338 if (sg != pctx->dst + 1) in crypto_ccm_init_crypt()
339 sg_chain(pctx->dst, 2, sg); in crypto_ccm_init_crypt()
349 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_encrypt() local
350 struct ablkcipher_request *abreq = &pctx->abreq; in crypto_ccm_encrypt()
353 u8 *odata = pctx->odata; in crypto_ccm_encrypt()
361 err = crypto_ccm_auth(req, sg_next(pctx->src), cryptlen); in crypto_ccm_encrypt()
365 dst = pctx->src; in crypto_ccm_encrypt()
367 dst = pctx->dst; in crypto_ccm_encrypt()
370 ablkcipher_request_set_callback(abreq, pctx->flags, in crypto_ccm_encrypt()
372 ablkcipher_request_set_crypt(abreq, pctx->src, dst, cryptlen + 16, iv); in crypto_ccm_encrypt()
387 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_decrypt_done() local
393 pctx->flags = 0; in crypto_ccm_decrypt_done()
395 dst = sg_next(req->src == req->dst ? pctx->src : pctx->dst); in crypto_ccm_decrypt_done()
399 if (!err && crypto_memneq(pctx->auth_tag, pctx->odata, authsize)) in crypto_ccm_decrypt_done()
409 struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); in crypto_ccm_decrypt() local
410 struct ablkcipher_request *abreq = &pctx->abreq; in crypto_ccm_decrypt()
414 u8 *authtag = pctx->auth_tag; in crypto_ccm_decrypt()
415 u8 *odata = pctx->odata; in crypto_ccm_decrypt()
425 scatterwalk_map_and_copy(authtag, sg_next(pctx->src), cryptlen, in crypto_ccm_decrypt()
428 dst = pctx->src; in crypto_ccm_decrypt()
430 dst = pctx->dst; in crypto_ccm_decrypt()
433 ablkcipher_request_set_callback(abreq, pctx->flags, in crypto_ccm_decrypt()
435 ablkcipher_request_set_crypt(abreq, pctx->src, dst, cryptlen + 16, iv); in crypto_ccm_decrypt()