+ } else {
+ QAT_LOG(ERR, "Invalid asymmetric crypto xform");
+ return -(EINVAL);
+ }
+ return 0;
+}
+
+int
+qat_asym_build_request(void *in_op,
+ uint8_t *out_msg,
+ void *op_cookie,
+ __rte_unused enum qat_device_gen qat_dev_gen)
+{
+ struct qat_asym_session *ctx;
+ struct rte_crypto_op *op = (struct rte_crypto_op *)in_op;
+ struct rte_crypto_asym_op *asym_op = op->asym;
+ struct icp_qat_fw_pke_request *qat_req =
+ (struct icp_qat_fw_pke_request *)out_msg;
+ struct qat_asym_op_cookie *cookie =
+ (struct qat_asym_op_cookie *)op_cookie;
+ int err = 0;
+
+ op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
+ if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
+ ctx = (struct qat_asym_session *)
+ get_asym_session_private_data(
+ op->asym->session, cryptodev_qat_asym_driver_id);
+ if (unlikely(ctx == NULL)) {
+ QAT_LOG(ERR, "Session has not been created for this device");
+ goto error;
+ }
+ rte_mov64((uint8_t *)qat_req, (const uint8_t *)&(ctx->req_tmpl));
+ err = qat_asym_fill_arrays(asym_op, qat_req, cookie, ctx->xform);
+ if (err) {
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+ goto error;
+ }
+ } else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
+ qat_fill_req_tmpl(qat_req);
+ err = qat_asym_fill_arrays(asym_op, qat_req, cookie,
+ op->asym->xform);
+ if (err) {
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+ goto error;
+ }
+ } else {
+ QAT_DP_LOG(ERR, "Invalid session/xform settings");
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ goto error;