[1/4] lib/crypto: add support for EC Point Multiplication

Message ID 1575560280-3261-2-git-send-email-anoobj@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: akhil goyal
Headers
Series add ECPM support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Anoob Joseph Dec. 5, 2019, 3:37 p.m. UTC
  From: Balakrishna Bhamidipati <bbhamidipati@marvell.com>

Elliptic Curve Point Multiplication xform type and op
parameters are added.

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/default.ini |  1 +
 lib/librte_cryptodev/rte_crypto_asym.h     | 17 +++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev.c       |  1 +
 3 files changed, 19 insertions(+)
  

Comments

Akhil Goyal Jan. 13, 2020, 12:43 p.m. UTC | #1
> 
> From: Balakrishna Bhamidipati <bbhamidipati@marvell.com>
> 
> Elliptic Curve Point Multiplication xform type and op
> parameters are added.

Description should convey that it is an asymmetric crypto feature.

> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> Signed-off-by: Balakrishna Bhamidipati <bbhamidipati@marvell.com>
> Signed-off-by: Sunila Sahu <ssahu@marvell.com>

Title should be cryptodev: support ECPM

> ---
>  doc/guides/cryptodevs/features/default.ini |  1 +
>  lib/librte_cryptodev/rte_crypto_asym.h     | 17 +++++++++++++++++
>  lib/librte_cryptodev/rte_cryptodev.c       |  1 +
>  3 files changed, 19 insertions(+)
> 
> diff --git a/doc/guides/cryptodevs/features/default.ini
> b/doc/guides/cryptodevs/features/default.ini
> index 2f6c785..3a54b07 100644
> --- a/doc/guides/cryptodevs/features/default.ini
> +++ b/doc/guides/cryptodevs/features/default.ini
> @@ -109,3 +109,4 @@ Modular Exponentiation  =
>  Modular Inversion       =
>  Diffie-hellman          =
>  ECDSA                   =
> +EC Point Multiplication =

I think it is better to have ECPM instead of EC Point Multiplication as it is the case with ECDSA.


> diff --git a/lib/librte_cryptodev/rte_crypto_asym.h
> b/lib/librte_cryptodev/rte_crypto_asym.h
> index dd5e6e3..b98ce6c 100644
> --- a/lib/librte_cryptodev/rte_crypto_asym.h
> +++ b/lib/librte_cryptodev/rte_crypto_asym.h
> @@ -85,6 +85,8 @@ enum rte_crypto_asym_xform_type {
>  	/**< Elliptic Curve Digital Signature Algorithm
>  	 * Perform Signature Generation and Verification.
>  	 */
> +	RTE_CRYPTO_ASYM_XFORM_EC_POINT_MUL,
Should be RTE_CRYPTO_ASYM_XFORM_ECPM

> +	/**< Elliptic Curve Point Multiplication */
>  	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
>  	/**< End of list */
>  };
> @@ -598,6 +600,20 @@ struct rte_crypto_ecdsa_op_param {
>  };
> 
>  /**
> + * Structure for EC point operation param
> + */
> +struct rte_crypto_ec_point_mul_param {

Better to have rte_crypto_ecpm_param

> +	struct rte_crypto_ec_point p;
> +	/**< x and y coordinates of input point */
> +
> +	struct rte_crypto_ec_point r;
> +	/**< x and y coordinates of resultant point */
> +
> +	rte_crypto_param scalar;
> +	/**< Scalar to multiply the input point */
> +};
> +
> +/**
>   * Asymmetric Cryptographic Operation.
>   *
>   * Structure describing asymmetric crypto operation params.
> @@ -620,6 +636,7 @@ struct rte_crypto_asym_op {
>  		struct rte_crypto_dh_op_param dh;
>  		struct rte_crypto_dsa_op_param dsa;
>  		struct rte_crypto_ecdsa_op_param ecdsa;
> +		struct rte_crypto_ec_point_mul_param ecpm;
>  	};
>  };
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> b/lib/librte_cryptodev/rte_cryptodev.c
> index 0d6babb..eea57c6 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -174,6 +174,7 @@ const char *rte_crypto_asym_xform_strings[] = {
>  	[RTE_CRYPTO_ASYM_XFORM_DH]	= "dh",
>  	[RTE_CRYPTO_ASYM_XFORM_DSA]	= "dsa",
>  	[RTE_CRYPTO_ASYM_XFORM_ECDSA]	= "ecdsa",
> +	[RTE_CRYPTO_ASYM_XFORM_EC_POINT_MUL]	= "ecpm",
>  };
> 
>  /**
> --
> 2.7.4
  
Anoob Joseph Jan. 14, 2020, 6:44 a.m. UTC | #2
Hi Akhil,

Please see inline.

Thanks,
Anoob

> -----Original Message-----
> From: Akhil Goyal <akhil.goyal@nxp.com>
> Sent: Monday, January 13, 2020 6:14 PM
> To: Anoob Joseph <anoobj@marvell.com>; Declan Doherty
> <declan.doherty@intel.com>; Pablo de Lara
> <pablo.de.lara.guarch@intel.com>
> Cc: Balakrishna Bhamidipati <bbhamidipati@marvell.com>; Fiona Trahe
> <fiona.trahe@intel.com>; Arek Kusztal <arkadiuszx.kusztal@intel.com>;
> Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Narayana Prasad Raju
> Athreya <pathreya@marvell.com>; Shally Verma <shallyv@marvell.com>;
> Ankur Dwivedi <adwivedi@marvell.com>; Sunila Sahu
> <ssahu@marvell.com>; dev@dpdk.org
> Subject: [EXT] RE: [PATCH 1/4] lib/crypto: add support for EC Point
> Multiplication
> 
> External Email
> 
> ----------------------------------------------------------------------
> 
> >
> > From: Balakrishna Bhamidipati <bbhamidipati@marvell.com>
> >
> > Elliptic Curve Point Multiplication xform type and op parameters are
> > added.
> 
> Description should convey that it is an asymmetric crypto feature.

[Anoob] Will update in v2.
 
> 
> >
> > Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> > Signed-off-by: Balakrishna Bhamidipati <bbhamidipati@marvell.com>
> > Signed-off-by: Sunila Sahu <ssahu@marvell.com>
> 
> Title should be cryptodev: support ECPM

[Anoob] Will update in v2. 

> 
> > ---
> >  doc/guides/cryptodevs/features/default.ini |  1 +
> >  lib/librte_cryptodev/rte_crypto_asym.h     | 17 +++++++++++++++++
> >  lib/librte_cryptodev/rte_cryptodev.c       |  1 +
> >  3 files changed, 19 insertions(+)
> >
> > diff --git a/doc/guides/cryptodevs/features/default.ini
> > b/doc/guides/cryptodevs/features/default.ini
> > index 2f6c785..3a54b07 100644
> > --- a/doc/guides/cryptodevs/features/default.ini
> > +++ b/doc/guides/cryptodevs/features/default.ini
> > @@ -109,3 +109,4 @@ Modular Exponentiation  =
> >  Modular Inversion       =
> >  Diffie-hellman          =
> >  ECDSA                   =
> > +EC Point Multiplication =
> 
> I think it is better to have ECPM instead of EC Point Multiplication as it is the
> case with ECDSA.

[Anoob] Agreed. Will update in v2.
 
> 
> 
> > diff --git a/lib/librte_cryptodev/rte_crypto_asym.h
> > b/lib/librte_cryptodev/rte_crypto_asym.h
> > index dd5e6e3..b98ce6c 100644
> > --- a/lib/librte_cryptodev/rte_crypto_asym.h
> > +++ b/lib/librte_cryptodev/rte_crypto_asym.h
> > @@ -85,6 +85,8 @@ enum rte_crypto_asym_xform_type {
> >  	/**< Elliptic Curve Digital Signature Algorithm
> >  	 * Perform Signature Generation and Verification.
> >  	 */
> > +	RTE_CRYPTO_ASYM_XFORM_EC_POINT_MUL,
> Should be RTE_CRYPTO_ASYM_XFORM_ECPM
> 
> > +	/**< Elliptic Curve Point Multiplication */
> >  	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
> >  	/**< End of list */
> >  };
> > @@ -598,6 +600,20 @@ struct rte_crypto_ecdsa_op_param {  };
> >
> >  /**
> > + * Structure for EC point operation param  */ struct
> > +rte_crypto_ec_point_mul_param {
> 
> Better to have rte_crypto_ecpm_param

[Anoob] Agreed. Will update in v2.
 
> 
> > +	struct rte_crypto_ec_point p;
> > +	/**< x and y coordinates of input point */
> > +
> > +	struct rte_crypto_ec_point r;
> > +	/**< x and y coordinates of resultant point */
> > +
> > +	rte_crypto_param scalar;
> > +	/**< Scalar to multiply the input point */ };
> > +
> > +/**
> >   * Asymmetric Cryptographic Operation.
> >   *
> >   * Structure describing asymmetric crypto operation params.
> > @@ -620,6 +636,7 @@ struct rte_crypto_asym_op {
> >  		struct rte_crypto_dh_op_param dh;
> >  		struct rte_crypto_dsa_op_param dsa;
> >  		struct rte_crypto_ecdsa_op_param ecdsa;
> > +		struct rte_crypto_ec_point_mul_param ecpm;
> >  	};
> >  };
> >
> > diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> > b/lib/librte_cryptodev/rte_cryptodev.c
> > index 0d6babb..eea57c6 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.c
> > +++ b/lib/librte_cryptodev/rte_cryptodev.c
> > @@ -174,6 +174,7 @@ const char *rte_crypto_asym_xform_strings[] = {
> >  	[RTE_CRYPTO_ASYM_XFORM_DH]	= "dh",
> >  	[RTE_CRYPTO_ASYM_XFORM_DSA]	= "dsa",
> >  	[RTE_CRYPTO_ASYM_XFORM_ECDSA]	= "ecdsa",
> > +	[RTE_CRYPTO_ASYM_XFORM_EC_POINT_MUL]	= "ecpm",
> >  };
> >
> >  /**
> > --
> > 2.7.4
  

Patch

diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini
index 2f6c785..3a54b07 100644
--- a/doc/guides/cryptodevs/features/default.ini
+++ b/doc/guides/cryptodevs/features/default.ini
@@ -109,3 +109,4 @@  Modular Exponentiation  =
 Modular Inversion       =
 Diffie-hellman          =
 ECDSA                   =
+EC Point Multiplication =
diff --git a/lib/librte_cryptodev/rte_crypto_asym.h b/lib/librte_cryptodev/rte_crypto_asym.h
index dd5e6e3..b98ce6c 100644
--- a/lib/librte_cryptodev/rte_crypto_asym.h
+++ b/lib/librte_cryptodev/rte_crypto_asym.h
@@ -85,6 +85,8 @@  enum rte_crypto_asym_xform_type {
 	/**< Elliptic Curve Digital Signature Algorithm
 	 * Perform Signature Generation and Verification.
 	 */
+	RTE_CRYPTO_ASYM_XFORM_EC_POINT_MUL,
+	/**< Elliptic Curve Point Multiplication */
 	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
 	/**< End of list */
 };
@@ -598,6 +600,20 @@  struct rte_crypto_ecdsa_op_param {
 };
 
 /**
+ * Structure for EC point operation param
+ */
+struct rte_crypto_ec_point_mul_param {
+	struct rte_crypto_ec_point p;
+	/**< x and y coordinates of input point */
+
+	struct rte_crypto_ec_point r;
+	/**< x and y coordinates of resultant point */
+
+	rte_crypto_param scalar;
+	/**< Scalar to multiply the input point */
+};
+
+/**
  * Asymmetric Cryptographic Operation.
  *
  * Structure describing asymmetric crypto operation params.
@@ -620,6 +636,7 @@  struct rte_crypto_asym_op {
 		struct rte_crypto_dh_op_param dh;
 		struct rte_crypto_dsa_op_param dsa;
 		struct rte_crypto_ecdsa_op_param ecdsa;
+		struct rte_crypto_ec_point_mul_param ecpm;
 	};
 };
 
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 0d6babb..eea57c6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -174,6 +174,7 @@  const char *rte_crypto_asym_xform_strings[] = {
 	[RTE_CRYPTO_ASYM_XFORM_DH]	= "dh",
 	[RTE_CRYPTO_ASYM_XFORM_DSA]	= "dsa",
 	[RTE_CRYPTO_ASYM_XFORM_ECDSA]	= "ecdsa",
+	[RTE_CRYPTO_ASYM_XFORM_EC_POINT_MUL]	= "ecpm",
 };
 
 /**