crypto/octeontx2: support ECPM
authorSunila Sahu <ssahu@marvell.com>
Wed, 15 Jan 2020 12:56:33 +0000 (18:26 +0530)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 15 Jan 2020 14:01:55 +0000 (15:01 +0100)
Add support asymmetric operation EC Point MUltiplication,
in crypto_octeontx2 PMD.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Balakrishna Bhamidipati <bbhamidipati@marvell.com>
Signed-off-by: Sunila Sahu <ssahu@marvell.com>
doc/guides/cryptodevs/features/octeontx2.ini
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
drivers/crypto/octeontx2/otx2_cryptodev_ops.c

index dd6369b..4693458 100644 (file)
@@ -73,3 +73,4 @@ Modular Exponentiation  = Y
 Modular Inversion       =
 Diffie-hellman          =
 ECDSA                   = Y
+ECPM                    = Y
index f2079e2..83f885c 100644 (file)
@@ -639,6 +639,16 @@ rte_cryptodev_capabilities otx2_cpt_capabilities[] = {
                        },
                }
        },
+       {       /* ECPM */
+               .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+               {.asym = {
+                       .xform_capa = {
+                               .xform_type = RTE_CRYPTO_ASYM_XFORM_ECPM,
+                               .op_types = 0
+                               }
+                       },
+               }
+       },
        /* End of asymmetric capabilities */
        RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
index 17c755d..ec0e58d 100644 (file)
@@ -447,6 +447,12 @@ otx2_cpt_enqueue_asym(struct otx2_cpt_qp *qp,
                if (unlikely(ret))
                        goto req_fail;
                break;
+       case RTE_CRYPTO_ASYM_XFORM_ECPM:
+               ret = cpt_ecpm_prep(&asym_op->ecpm, &params,
+                                   sess->ec_ctx.curveid);
+               if (unlikely(ret))
+                       goto req_fail;
+               break;
        default:
                op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
                ret = -EINVAL;
@@ -665,6 +671,19 @@ otx2_cpt_asym_dequeue_ecdsa_op(struct rte_crypto_ecdsa_op_param *ecdsa,
        ecdsa->s.length = prime_len;
 }
 
+static __rte_always_inline void
+otx2_cpt_asym_dequeue_ecpm_op(struct rte_crypto_ecpm_op_param *ecpm,
+                            struct cpt_request_info *req,
+                            struct cpt_asym_ec_ctx *ec)
+{
+       int prime_len = ec_grp[ec->curveid].prime.length;
+
+       memcpy(ecpm->r.x.data, req->rptr, prime_len);
+       memcpy(ecpm->r.y.data, req->rptr + ROUNDUP8(prime_len), prime_len);
+       ecpm->r.x.length = prime_len;
+       ecpm->r.y.length = prime_len;
+}
+
 static void
 otx2_cpt_asym_post_process(struct rte_crypto_op *cop,
                           struct cpt_request_info *req)
@@ -687,6 +706,9 @@ otx2_cpt_asym_post_process(struct rte_crypto_op *cop,
        case RTE_CRYPTO_ASYM_XFORM_ECDSA:
                otx2_cpt_asym_dequeue_ecdsa_op(&op->ecdsa, req, &sess->ec_ctx);
                break;
+       case RTE_CRYPTO_ASYM_XFORM_ECPM:
+               otx2_cpt_asym_dequeue_ecpm_op(&op->ecpm, req, &sess->ec_ctx);
+               break;
        default:
                CPT_LOG_DP_DEBUG("Invalid crypto xform type");
                cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;