Lines Matching refs:reqctx
134 static inline void chcr_init_hctx_per_wr(struct chcr_ahash_req_ctx *reqctx) in chcr_init_hctx_per_wr() argument
136 memset(&reqctx->hctx_wr, 0, sizeof(struct chcr_hctx_per_wr)); in chcr_init_hctx_per_wr()
218 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_handle_aead_resp() local
223 if (reqctx->verify == VERIFY_SW) { in chcr_handle_aead_resp()
225 reqctx->verify = VERIFY_HW; in chcr_handle_aead_resp()
766 struct chcr_blkcipher_req_ctx *reqctx = in create_cipher_wr() local
776 nents = sg_nents_xlen(reqctx->dstsg, wrparam->bytes, CHCR_DST_SG_SIZE, in create_cipher_wr()
777 reqctx->dst_ofst); in create_cipher_wr()
781 nents = sg_nents_xlen(reqctx->srcsg, wrparam->bytes, in create_cipher_wr()
782 CHCR_SRC_SG_SIZE, reqctx->src_ofst); in create_cipher_wr()
783 temp = reqctx->imm ? roundup(wrparam->bytes, 16) : in create_cipher_wr()
802 chcr_req->sec_cpl.seqno_numivs = FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, 0, in create_cipher_wr()
809 if ((reqctx->op == CHCR_DECRYPT_OP) && in create_cipher_wr()
837 + (reqctx->imm ? (wrparam->bytes) : 0); in create_cipher_wr()
838 create_wreq(c_ctx(tfm), chcr_req, &(wrparam->req->base), reqctx->imm, 0, in create_cipher_wr()
841 reqctx->skb = skb; in create_cipher_wr()
843 if (reqctx->op && (ablkctx->ciph_mode == in create_cipher_wr()
847 reqctx->processed + wrparam->bytes - AES_BLOCK_SIZE); in create_cipher_wr()
1025 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in chcr_update_tweak() local
1030 int round = reqctx->last_req_len / AES_BLOCK_SIZE; in chcr_update_tweak()
1033 memcpy(iv, reqctx->iv, AES_BLOCK_SIZE); in chcr_update_tweak()
1058 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in chcr_update_cipher_iv() local
1063 ctr_add_iv(iv, req->info, (reqctx->processed / in chcr_update_cipher_iv()
1066 *(__be32 *)(reqctx->iv + CTR_RFC3686_NONCE_SIZE + in chcr_update_cipher_iv()
1067 CTR_RFC3686_IV_SIZE) = cpu_to_be32((reqctx->processed / in chcr_update_cipher_iv()
1072 if (reqctx->op) in chcr_update_cipher_iv()
1092 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in chcr_final_cipher_iv() local
1097 ctr_add_iv(iv, req->info, DIV_ROUND_UP(reqctx->processed, in chcr_final_cipher_iv()
1103 if (!reqctx->op) in chcr_final_cipher_iv()
1119 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in chcr_handle_cipher_resp() local
1126 if (req->nbytes == reqctx->processed) { in chcr_handle_cipher_resp()
1133 if (!reqctx->imm) { in chcr_handle_cipher_resp()
1134 bytes = chcr_sg_ent_in_wr(reqctx->srcsg, reqctx->dstsg, 0, in chcr_handle_cipher_resp()
1136 reqctx->src_ofst, reqctx->dst_ofst); in chcr_handle_cipher_resp()
1137 if ((bytes + reqctx->processed) >= req->nbytes) in chcr_handle_cipher_resp()
1138 bytes = req->nbytes - reqctx->processed; in chcr_handle_cipher_resp()
1143 bytes = req->nbytes - reqctx->processed; in chcr_handle_cipher_resp()
1145 err = chcr_update_cipher_iv(req, fw6_pld, reqctx->iv); in chcr_handle_cipher_resp()
1158 reqctx->op); in chcr_handle_cipher_resp()
1164 bytes = adjust_ctr_overflow(reqctx->iv, bytes); in chcr_handle_cipher_resp()
1177 reqctx->last_req_len = bytes; in chcr_handle_cipher_resp()
1178 reqctx->processed += bytes; in chcr_handle_cipher_resp()
1195 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in process_cipher() local
1200 reqctx->processed = 0; in process_cipher()
1227 reqctx->imm = (transhdr_len + IV + req->nbytes) <= in process_cipher()
1232 reqctx->imm = 0; in process_cipher()
1235 if (!reqctx->imm) { in process_cipher()
1239 if ((bytes + reqctx->processed) >= req->nbytes) in process_cipher()
1240 bytes = req->nbytes - reqctx->processed; in process_cipher()
1252 memcpy(reqctx->iv, ablkctx->nonce, CTR_RFC3686_NONCE_SIZE); in process_cipher()
1253 memcpy(reqctx->iv + CTR_RFC3686_NONCE_SIZE, req->info, in process_cipher()
1257 *(__be32 *)(reqctx->iv + CTR_RFC3686_NONCE_SIZE + in process_cipher()
1262 memcpy(reqctx->iv, req->info, IV); in process_cipher()
1272 reqctx->iv, in process_cipher()
1276 reqctx->op = op_type; in process_cipher()
1277 reqctx->srcsg = req->src; in process_cipher()
1278 reqctx->dstsg = req->dst; in process_cipher()
1279 reqctx->src_ofst = 0; in process_cipher()
1280 reqctx->dst_ofst = 0; in process_cipher()
1289 reqctx->processed = bytes; in process_cipher()
1290 reqctx->last_req_len = bytes; in process_cipher()
1930 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req); in chcr_ahash_continue() local
1931 struct chcr_hctx_per_wr *hctx_wr = &reqctx->hctx_wr; in chcr_ahash_continue()
1969 params.scmd1 = reqctx->data_len + params.sg_len; in chcr_ahash_continue()
1972 reqctx->data_len += params.sg_len; in chcr_ahash_continue()
1991 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req); in chcr_handle_ahash_resp() local
1992 struct chcr_hctx_per_wr *hctx_wr = &reqctx->hctx_wr; in chcr_handle_ahash_resp()
2012 if (hctx_wr->isfinal || ((hctx_wr->processed + reqctx->reqlen) == in chcr_handle_ahash_resp()
2019 memcpy(reqctx->partial_hash, in chcr_handle_ahash_resp()
2026 memcpy(reqctx->partial_hash, input + sizeof(struct cpl_fw6_pld), in chcr_handle_ahash_resp()
2255 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_common_exit() local
2259 chcr_aead_dma_unmap(&u_ctx->lldi.pdev->dev, req, reqctx->op); in chcr_aead_common_exit()
2266 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_common_init() local
2273 if (reqctx->op && req->cryptlen < authsize) in chcr_aead_common_init()
2275 if (reqctx->b0_len) in chcr_aead_common_init()
2276 reqctx->scratch_pad = reqctx->iv + IV; in chcr_aead_common_init()
2278 reqctx->scratch_pad = NULL; in chcr_aead_common_init()
2281 reqctx->op); in chcr_aead_common_init()
2329 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in create_authenc_wr() local
2348 reqctx->b0_len = 0; in create_authenc_wr()
2358 (reqctx->op ? -authsize : authsize), CHCR_DST_SG_SIZE, 0); in create_authenc_wr()
2366 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen) < in create_authenc_wr()
2368 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen, 16) in create_authenc_wr()
2374 transhdr_len, reqctx->op)) { in create_authenc_wr()
2377 return ERR_PTR(chcr_aead_fallback(req, reqctx->op)); in create_authenc_wr()
2387 temp = (reqctx->op == CHCR_ENCRYPT_OP) ? 0 : authsize; in create_authenc_wr()
2411 chcr_req->sec_cpl.seqno_numivs = FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, in create_authenc_wr()
2412 (reqctx->op == CHCR_ENCRYPT_OP) ? 1 : 0, in create_authenc_wr()
2420 if (reqctx->op == CHCR_ENCRYPT_OP || in create_authenc_wr()
2448 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen) : 0); in create_authenc_wr()
2449 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, size, in create_authenc_wr()
2451 reqctx->skb = skb; in create_authenc_wr()
2465 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_dma_map() local
2474 reqctx->iv_dma = dma_map_single(dev, reqctx->iv, (IV + reqctx->b0_len), in chcr_aead_dma_map()
2476 if (dma_mapping_error(dev, reqctx->iv_dma)) in chcr_aead_dma_map()
2478 if (reqctx->b0_len) in chcr_aead_dma_map()
2479 reqctx->b0_dma = reqctx->iv_dma + IV; in chcr_aead_dma_map()
2481 reqctx->b0_dma = 0; in chcr_aead_dma_map()
2503 dma_unmap_single(dev, reqctx->iv_dma, IV, DMA_BIDIRECTIONAL); in chcr_aead_dma_map()
2511 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_dma_unmap() local
2521 dma_unmap_single(dev, reqctx->iv_dma, (IV + reqctx->b0_len), in chcr_aead_dma_unmap()
2538 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_add_aead_src_ent() local
2540 if (reqctx->imm) { in chcr_add_aead_src_ent()
2543 if (reqctx->b0_len) { in chcr_add_aead_src_ent()
2544 memcpy(buf, reqctx->scratch_pad, reqctx->b0_len); in chcr_add_aead_src_ent()
2545 buf += reqctx->b0_len; in chcr_add_aead_src_ent()
2551 if (reqctx->b0_len) in chcr_add_aead_src_ent()
2552 ulptx_walk_add_page(&ulp_walk, reqctx->b0_len, in chcr_add_aead_src_ent()
2553 reqctx->b0_dma); in chcr_add_aead_src_ent()
2564 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_add_aead_dst_ent() local
2572 dsgl_walk_add_page(&dsgl_walk, IV + reqctx->b0_len, reqctx->iv_dma); in chcr_add_aead_dst_ent()
2574 (reqctx->op ? -authsize : authsize); in chcr_add_aead_dst_ent()
2584 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in chcr_add_cipher_src_ent() local
2587 memcpy(buf, reqctx->iv, IV); in chcr_add_cipher_src_ent()
2589 if (reqctx->imm) { in chcr_add_cipher_src_ent()
2591 buf, wrparam->bytes, reqctx->processed); in chcr_add_cipher_src_ent()
2594 ulptx_walk_add_sg(&ulp_walk, reqctx->srcsg, wrparam->bytes, in chcr_add_cipher_src_ent()
2595 reqctx->src_ofst); in chcr_add_cipher_src_ent()
2596 reqctx->srcsg = ulp_walk.last_sg; in chcr_add_cipher_src_ent()
2597 reqctx->src_ofst = ulp_walk.last_sg_len; in chcr_add_cipher_src_ent()
2607 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); in chcr_add_cipher_dst_ent() local
2613 dsgl_walk_add_sg(&dsgl_walk, reqctx->dstsg, wrparam->bytes, in chcr_add_cipher_dst_ent()
2614 reqctx->dst_ofst); in chcr_add_cipher_dst_ent()
2615 reqctx->dstsg = dsgl_walk.last_sg; in chcr_add_cipher_dst_ent()
2616 reqctx->dst_ofst = dsgl_walk.last_sg_len; in chcr_add_cipher_dst_ent()
2626 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req); in chcr_add_hash_src_ent() local
2628 if (reqctx->hctx_wr.imm) { in chcr_add_hash_src_ent()
2632 memcpy(buf, reqctx->reqbfr, param->bfr_len); in chcr_add_hash_src_ent()
2636 sg_pcopy_to_buffer(reqctx->hctx_wr.srcsg, in chcr_add_hash_src_ent()
2637 sg_nents(reqctx->hctx_wr.srcsg), buf, in chcr_add_hash_src_ent()
2643 reqctx->hctx_wr.dma_addr); in chcr_add_hash_src_ent()
2644 ulptx_walk_add_sg(&ulp_walk, reqctx->hctx_wr.srcsg, in chcr_add_hash_src_ent()
2645 param->sg_len, reqctx->hctx_wr.src_ofst); in chcr_add_hash_src_ent()
2646 reqctx->hctx_wr.srcsg = ulp_walk.last_sg; in chcr_add_hash_src_ent()
2647 reqctx->hctx_wr.src_ofst = ulp_walk.last_sg_len; in chcr_add_hash_src_ent()
2749 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in generate_b0() local
2750 u8 *b0 = reqctx->scratch_pad; in generate_b0()
2787 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in ccm_format_packet() local
2801 *((unsigned short *)(reqctx->scratch_pad + 16)) = in ccm_format_packet()
2889 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in create_aead_ccm_wr() local
2907 reqctx->b0_len = CCM_B0_SIZE + (assoclen ? CCM_AAD_FIELD_SIZE : 0); in create_aead_ccm_wr()
2912 error = aead_ccm_validate_input(reqctx->op, req, aeadctx, sub_type); in create_aead_ccm_wr()
2916 + (reqctx->op ? -authsize : authsize), in create_aead_ccm_wr()
2925 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen + in create_aead_ccm_wr()
2926 reqctx->b0_len) <= SGE_MAX_WR_LEN; in create_aead_ccm_wr()
2927 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen + in create_aead_ccm_wr()
2928 reqctx->b0_len, 16) : in create_aead_ccm_wr()
2934 reqctx->b0_len, transhdr_len, reqctx->op)) { in create_aead_ccm_wr()
2937 return ERR_PTR(chcr_aead_fallback(req, reqctx->op)); in create_aead_ccm_wr()
2948 fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, reqctx->op); in create_aead_ccm_wr()
2958 error = ccm_format_packet(req, ivptr, sub_type, reqctx->op, assoclen); in create_aead_ccm_wr()
2966 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen + in create_aead_ccm_wr()
2967 reqctx->b0_len) : 0); in create_aead_ccm_wr()
2968 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, 0, in create_aead_ccm_wr()
2970 reqctx->skb = skb; in create_aead_ccm_wr()
2986 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in create_gcm_wr() local
3003 reqctx->b0_len = 0; in create_gcm_wr()
3008 (reqctx->op ? -authsize : authsize), in create_gcm_wr()
3016 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen) <= in create_gcm_wr()
3018 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen, 16) : in create_gcm_wr()
3023 transhdr_len, reqctx->op)) { in create_gcm_wr()
3027 return ERR_PTR(chcr_aead_fallback(req, reqctx->op)); in create_gcm_wr()
3038 temp = (reqctx->op == CHCR_ENCRYPT_OP) ? 0 : authsize; in create_gcm_wr()
3051 FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, (reqctx->op == in create_gcm_wr()
3082 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen) : 0); in create_gcm_wr()
3083 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, size, in create_gcm_wr()
3084 transhdr_len, temp, reqctx->verify); in create_gcm_wr()
3085 reqctx->skb = skb; in create_gcm_wr()
3618 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_op() local
3634 return chcr_aead_fallback(req, reqctx->op); in chcr_aead_op()
3664 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_encrypt() local
3666 reqctx->verify = VERIFY_HW; in chcr_aead_encrypt()
3667 reqctx->op = CHCR_ENCRYPT_OP; in chcr_aead_encrypt()
3687 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); in chcr_aead_decrypt() local
3692 reqctx->verify = VERIFY_SW; in chcr_aead_decrypt()
3695 reqctx->verify = VERIFY_HW; in chcr_aead_decrypt()
3697 reqctx->op = CHCR_DECRYPT_OP; in chcr_aead_decrypt()