Lines Matching refs:hpre_req

181 static int hpre_add_req_to_ctx(struct hpre_asym_request *hpre_req)  in hpre_add_req_to_ctx()  argument
187 ctx = hpre_req->ctx; in hpre_add_req_to_ctx()
192 ctx->req_list[id] = hpre_req; in hpre_add_req_to_ctx()
193 hpre_req->req_id = id; in hpre_add_req_to_ctx()
197 ktime_get_ts64(&hpre_req->req_time); in hpre_add_req_to_ctx()
202 static void hpre_rm_req_from_ctx(struct hpre_asym_request *hpre_req) in hpre_rm_req_from_ctx() argument
204 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_rm_req_from_ctx()
205 int id = hpre_req->req_id; in hpre_rm_req_from_ctx()
207 if (hpre_req->req_id >= 0) { in hpre_rm_req_from_ctx()
208 hpre_req->req_id = HPRE_INVLD_REQ_ID; in hpre_rm_req_from_ctx()
235 static int hpre_get_data_dma_addr(struct hpre_asym_request *hpre_req, in hpre_get_data_dma_addr() argument
239 struct device *dev = hpre_req->ctx->dev; in hpre_get_data_dma_addr()
243 hpre_req->src = NULL; in hpre_get_data_dma_addr()
246 hpre_req->dst = NULL; in hpre_get_data_dma_addr()
258 static int hpre_prepare_dma_buf(struct hpre_asym_request *hpre_req, in hpre_prepare_dma_buf() argument
262 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_prepare_dma_buf()
277 hpre_req->src = ptr; in hpre_prepare_dma_buf()
279 hpre_req->dst = ptr; in hpre_prepare_dma_buf()
285 static int hpre_hw_data_init(struct hpre_asym_request *hpre_req, in hpre_hw_data_init() argument
289 struct hpre_sqe *msg = &hpre_req->req; in hpre_hw_data_init()
290 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_hw_data_init()
297 ret = hpre_get_data_dma_addr(hpre_req, data, len, is_src, &tmp); in hpre_hw_data_init()
299 ret = hpre_prepare_dma_buf(hpre_req, data, len, is_src, &tmp); in hpre_hw_data_init()
595 struct hpre_asym_request *hpre_req = PTR_ALIGN(tmp, hpre_align_sz()); in hpre_dh_compute_value() local
596 struct hpre_sqe *msg = &hpre_req->req; in hpre_dh_compute_value()
604 ret = hpre_hw_data_init(hpre_req, req->src, req->src_len, 1, 1); in hpre_dh_compute_value()
611 ret = hpre_hw_data_init(hpre_req, req->dst, req->dst_len, 0, 1); in hpre_dh_compute_value()
626 hpre_rm_req_from_ctx(hpre_req); in hpre_dh_compute_value()
627 hpre_hw_data_clr_all(ctx, hpre_req, req->dst, req->src); in hpre_dh_compute_value()
798 struct hpre_asym_request *hpre_req = PTR_ALIGN(tmp, hpre_align_sz()); in hpre_rsa_enc() local
799 struct hpre_sqe *msg = &hpre_req->req; in hpre_rsa_enc()
821 ret = hpre_hw_data_init(hpre_req, req->src, req->src_len, 1, 0); in hpre_rsa_enc()
825 ret = hpre_hw_data_init(hpre_req, req->dst, req->dst_len, 0, 0); in hpre_rsa_enc()
835 hpre_rm_req_from_ctx(hpre_req); in hpre_rsa_enc()
836 hpre_hw_data_clr_all(ctx, hpre_req, req->dst, req->src); in hpre_rsa_enc()
846 struct hpre_asym_request *hpre_req = PTR_ALIGN(tmp, hpre_align_sz()); in hpre_rsa_dec() local
847 struct hpre_sqe *msg = &hpre_req->req; in hpre_rsa_dec()
876 ret = hpre_hw_data_init(hpre_req, req->src, req->src_len, 1, 0); in hpre_rsa_dec()
880 ret = hpre_hw_data_init(hpre_req, req->dst, req->dst_len, 0, 0); in hpre_rsa_dec()
890 hpre_rm_req_from_ctx(hpre_req); in hpre_rsa_dec()
891 hpre_hw_data_clr_all(ctx, hpre_req, req->dst, req->src); in hpre_rsa_dec()
1530 static int hpre_ecdh_src_data_init(struct hpre_asym_request *hpre_req, in hpre_ecdh_src_data_init() argument
1533 struct hpre_sqe *msg = &hpre_req->req; in hpre_ecdh_src_data_init()
1534 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_ecdh_src_data_init()
1555 hpre_req->src = ptr; in hpre_ecdh_src_data_init()
1560 static int hpre_ecdh_dst_data_init(struct hpre_asym_request *hpre_req, in hpre_ecdh_dst_data_init() argument
1563 struct hpre_sqe *msg = &hpre_req->req; in hpre_ecdh_dst_data_init()
1564 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_ecdh_dst_data_init()
1573 hpre_req->dst = NULL; in hpre_ecdh_dst_data_init()
1590 struct hpre_asym_request *hpre_req = PTR_ALIGN(tmp, hpre_align_sz()); in hpre_ecdh_compute_value() local
1591 struct hpre_sqe *msg = &hpre_req->req; in hpre_ecdh_compute_value()
1601 ret = hpre_ecdh_src_data_init(hpre_req, req->src, req->src_len); in hpre_ecdh_compute_value()
1610 ret = hpre_ecdh_dst_data_init(hpre_req, req->dst, req->dst_len); in hpre_ecdh_compute_value()
1622 hpre_rm_req_from_ctx(hpre_req); in hpre_ecdh_compute_value()
1623 hpre_ecdh_hw_data_clr_all(ctx, hpre_req, req->dst, req->src); in hpre_ecdh_compute_value()
1853 static int hpre_curve25519_src_init(struct hpre_asym_request *hpre_req, in hpre_curve25519_src_init() argument
1856 struct hpre_sqe *msg = &hpre_req->req; in hpre_curve25519_src_init()
1857 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_curve25519_src_init()
1903 hpre_req->src = ptr; in hpre_curve25519_src_init()
1912 static int hpre_curve25519_dst_init(struct hpre_asym_request *hpre_req, in hpre_curve25519_dst_init() argument
1915 struct hpre_sqe *msg = &hpre_req->req; in hpre_curve25519_dst_init()
1916 struct hpre_ctx *ctx = hpre_req->ctx; in hpre_curve25519_dst_init()
1925 hpre_req->dst = NULL; in hpre_curve25519_dst_init()
1942 struct hpre_asym_request *hpre_req = PTR_ALIGN(tmp, hpre_align_sz()); in hpre_curve25519_compute_value() local
1943 struct hpre_sqe *msg = &hpre_req->req; in hpre_curve25519_compute_value()
1953 ret = hpre_curve25519_src_init(hpre_req, req->src, req->src_len); in hpre_curve25519_compute_value()
1963 ret = hpre_curve25519_dst_init(hpre_req, req->dst, req->dst_len); in hpre_curve25519_compute_value()
1975 hpre_rm_req_from_ctx(hpre_req); in hpre_curve25519_compute_value()
1976 hpre_curve25519_hw_data_clr_all(ctx, hpre_req, req->dst, req->src); in hpre_curve25519_compute_value()