Code may need rebase, otherwise 

Acked-by: Kai Ji <kai...@intel.com>

> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusz...@intel.com>
> Sent: Thursday, October 20, 2022 4:10 PM
> To: dev@dpdk.org
> Cc: gak...@marvell.com; Ji, Kai <kai...@intel.com>; Kusztal, ArkadiuszX
> <arkadiuszx.kusz...@intel.com>
> Subject: [PATCH v2 4/4] crypto/qat: add ecdh public key verification
> 
> This commit adds verification option for elliptic curve points when used along
> ECDH algorithm.
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusz...@intel.com>
> ---
<snip>
> +
> +     cookie->alg_bytesize = curve[curve_id].bytesize;
> +     cookie->qat_func_alignsize = qat_func_alignsize;
> +     qat_req->pke_hdr.cd_pars.func_id = func_id;
> +     qat_req->input_param_count =
> +                     5;
[KJ] do we need new line here ?
> +     qat_req->output_param_count =
> +                     0;
> +
> +     HEXDUMP("x", cookie->input_array[0], qat_func_alignsize);
> +     HEXDUMP("y", cookie->input_array[1], qat_func_alignsize);
> +     HEXDUMP("p", cookie->input_array[2], qat_func_alignsize);
> +     HEXDUMP("a", cookie->input_array[3], qat_func_alignsize);
> +     HEXDUMP("b", cookie->input_array[4], qat_func_alignsize);
> +
> +     return 0;
> +}
> +
>  static uint8_t
>  ecdh_collect(struct rte_crypto_asym_op *asym_op,
>               const struct qat_asym_op_cookie *cookie) @@ -830,6 +877,9
> @@ ecdh_collect(struct rte_crypto_asym_op *asym_op,
>       uint32_t qat_func_alignsize = cookie->qat_func_alignsize;
>       uint32_t ltrim = qat_func_alignsize - alg_bytesize;
> 
> +     if (asym_op->ecdh.ke_type ==
> RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY)
> +             return RTE_CRYPTO_OP_STATUS_SUCCESS;
> +
>       if (asym_op->ecdh.ke_type ==
> RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE) {
>               asym_op->ecdh.pub_key.x.length = alg_bytesize;
>               asym_op->ecdh.pub_key.y.length = alg_bytesize; @@ -870,8
> +920,14 @@ asym_set_input(struct icp_qat_fw_pke_request *qat_req,
>       case RTE_CRYPTO_ASYM_XFORM_ECPM:
>               return ecpm_set_input(qat_req, cookie, asym_op, xform);
>       case RTE_CRYPTO_ASYM_XFORM_ECDH:
> -             return ecdh_set_input(qat_req, cookie,
> +             if (asym_op->ecdh.ke_type ==
> +                     RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) {
> +                     return ecdh_verify_set_input(qat_req, cookie,
>                               asym_op, xform);
> +             } else {
> +                     return ecdh_set_input(qat_req, cookie,
> +                             asym_op, xform);
> +             }
>       default:
>               QAT_LOG(ERR, "Invalid/unsupported asymmetric crypto
> xform");
>               return -EINVAL;
> --
> 2.13.6

Reply via email to