DPDK patches and discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: Shally Verma <shally.verma@caviumnetworks.com>
Cc: "Trahe, Fiona" <fiona.trahe@intel.com>,
	"akhil.goyal@nxp.com" <akhil.goyal@nxp.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"pathreya@caviumnetworks.com" <pathreya@caviumnetworks.com>,
	Sunila Sahu <sunila.sahu@caviumnetworks.com>,
	Ashish Gupta <ashish.gupta@caviumnetworks.com>
Subject: Re: [dpdk-dev] [PATCH v3 1/6] lib/cryptodev: add asymmetric algos in cryptodev
Date: Fri, 15 Jun 2018 08:40:28 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D8977F8D5ABF@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1526450713-17299-2-git-send-email-shally.verma@caviumnetworks.com>

Hi Shally,

> -----Original Message-----
> From: Shally Verma [mailto:shally.verma@caviumnetworks.com]
> Sent: Wednesday, May 16, 2018 7:05 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: Trahe, Fiona <fiona.trahe@intel.com>; akhil.goyal@nxp.com;
> dev@dpdk.org; pathreya@caviumnetworks.com; Sunila Sahu
> <sunila.sahu@caviumnetworks.com>; Ashish Gupta
> <ashish.gupta@caviumnetworks.com>
> Subject: [PATCH v3 1/6] lib/cryptodev: add asymmetric algos in cryptodev
> 
> Add rte_crypto_asym.h with supported xfrms and associated op structures and
> APIs
> 
> API currently supports:
> - RSA Encrypt, Decrypt, Sign and Verify
> - Modular Exponentiation and Inversion
> - DSA Sign and Verify
> - Deffie-hellman private key exchange
> - Deffie-hellman public key exchange
> - Deffie-hellman shared secret compute
> - Deffie-hellman public/private key pair generation using xform chain
> 
> Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
> Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>

I have some comments below, but apart from those, could you send a rebased version of this API?

Thanks,
Pablo

> ---
>  lib/librte_cryptodev/Makefile          |   2 +-
>  lib/librte_cryptodev/meson.build       |   3 +-
>  lib/librte_cryptodev/rte_crypto_asym.h | 519
> +++++++++++++++++++++++++++++++++
>  3 files changed, 522 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index
> bba8dee9f..138e627dc 100644
> --- a/lib/librte_cryptodev/Makefile
> +++ b/lib/librte_cryptodev/Makefile
> @@ -23,7 +23,7 @@ SYMLINK-y-include += rte_crypto.h  SYMLINK-y-include +=
> rte_crypto_sym.h  SYMLINK-y-include += rte_cryptodev.h  SYMLINK-y-include +=
> rte_cryptodev_pmd.h
> -
> +SYMLINK-y-include += rte_crypto_asym.h

Leave the blank space that was present before.

>  # versioning export map
>  EXPORT_MAP := rte_cryptodev_version.map
> 

...

> --- /dev/null
> +++ b/lib/librte_cryptodev/rte_crypto_asym.h

...

> +
> +#include <string.h>
> +#include <stdint.h>

Leave a blank space between non-DPDK and DPDK libraries.

> +#include <rte_memory.h>
> +#include <rte_mempool.h>
> +#include <rte_common.h>
> +

...

> +struct rte_crypto_rsa_xform {
> +	rte_crypto_param n;
> +	/**< n - Prime modulus
> +	 * Prime modulus data of RSA operation in Octet-string network
> +	 * byte order format.
> +	 */
> +
> +	rte_crypto_param e;
> +	/**< e - Public key exponent
> +	 * Public key exponent used for RSA public key operations in Octet-
> +	 * string network byte order format.
> +	 */
> +
> +	enum rte_crypto_rsa_priv_key_type key_type;
> +

Needs RTE_STD_C11/extension, before the union.

> +	union {
> +			rte_crypto_param d;
> +			/**< d - Private key exponent
> +			 * Private key exponent used for RSA
> +			 * private key operations in
> +			 * Octet-string  network byte order format.
> +			 */
> +
> +			struct rte_crypto_rsa_priv_key_qt qt;
> +			/**< qt - Private key in quintuple format */
> +	};
> +};

...

> +/**
> + * Asymmetric Cryptographic Operation.
> + *
> + * Structure describing asymmetric crypto operation params.
> + *
> + */
> +struct rte_crypto_asym_op {
> +	struct rte_cryptodev_asym_session *session;
> +	/**< Handle for the initialised session context */
> +

Looking at the xform structure, it looks like a chain of xforms is possible.
Looking at this union, this case wouldn't be possible, as only one item from the union can be set.

> +	__extension__
> +	union {
> +		struct rte_crypto_rsa_op_param rsa;
> +		struct rte_crypto_mod_op_param modex;
> +		struct rte_crypto_mod_op_param modinv;
> +		struct rte_crypto_dh_op_param dh;
> +		struct rte_crypto_dsa_op_param dsa;
> +	};
> +} __rte_cache_aligned;
> +
> +/**
> + * Reset the fields of an asymmetric operation to their default values.
> + *
> + * @param	op	The crypto operation to be reset.
> + */
> +static inline void
> +__rte_crypto_asym_op_reset(struct rte_crypto_asym_op *op) {
> +	memset(op, 0, sizeof(*op));
> +}
> +
> +/**
> + * Attach a session to an asymmetric crypto operation
> + *
> + * @param	asym_op	crypto operation
> + * @param	sess	cryptodev session
> + */
> +static inline int
> +__rte_crypto_op_attach_asym_session(struct rte_crypto_asym_op *asym_op,
> +		struct rte_cryptodev_asym_session *sess) {
> +	asym_op->session = sess;
> +	return 0;
> +}

I think we should get rid of these two functions, as they are just one line, used just once in the code.
I know it is also done in symmetric, I think it can be removed from there too.


> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_CRYPTO_ASYM_H_ */
> --
> 2.14.3

  reply	other threads:[~2018-06-15  8:40 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16  6:05 [dpdk-dev] [PATCH v3 0/6] crypto: add asym crypto support Shally Verma
2018-05-16  6:05 ` [dpdk-dev] [PATCH v3 1/6] lib/cryptodev: add asymmetric algos in cryptodev Shally Verma
2018-06-15  8:40   ` De Lara Guarch, Pablo [this message]
2018-06-22 15:38     ` Verma, Shally
2018-06-25 21:34       ` De Lara Guarch, Pablo
2018-06-26 11:54         ` Verma, Shally
2018-05-16  6:05 ` [dpdk-dev] [PATCH v3 2/6] lib/cryptodev: add asym op support " Shally Verma
2018-06-15  9:05   ` De Lara Guarch, Pablo
2018-06-26  9:20   ` De Lara Guarch, Pablo
2018-06-26 11:21     ` Verma, Shally
2018-05-16  6:05 ` [dpdk-dev] [PATCH v3 3/6] lib/cryptodev: add asymmetric crypto capability " Shally Verma
2018-06-17 12:11   ` De Lara Guarch, Pablo
2018-07-03 14:12   ` Trahe, Fiona
2018-07-03 14:47     ` Verma, Shally
2018-05-16  6:05 ` [dpdk-dev] [PATCH v3 4/6] test/crypto: add unit testcase for asym crypto Shally Verma
2018-06-17 12:52   ` De Lara Guarch, Pablo
2018-06-17 15:01     ` Verma, Shally
2018-06-17 19:31       ` De Lara Guarch, Pablo
2018-06-18  5:40         ` Verma, Shally
2018-06-18  6:39           ` Akhil Goyal
2018-06-18  6:48             ` Verma, Shally
2018-06-18  7:34               ` Akhil Goyal
2018-06-18  8:38                 ` De Lara Guarch, Pablo
2018-06-18 16:22                   ` Verma, Shally
2018-05-16  6:05 ` [dpdk-dev] [PATCH v3 5/6] crypto/openssl: add asym crypto support Shally Verma
2018-06-17 13:25   ` De Lara Guarch, Pablo
2018-06-17 15:48     ` Verma, Shally
2018-06-17 19:38       ` De Lara Guarch, Pablo
2018-06-18  5:30         ` Verma, Shally
2018-06-23 12:41           ` Verma, Shally
2018-06-23 18:16             ` De Lara Guarch, Pablo
2018-06-23 18:26               ` Verma, Shally
2018-06-25 16:35                 ` De Lara Guarch, Pablo
2018-06-26  9:23   ` De Lara Guarch, Pablo
2018-06-26 11:22     ` Verma, Shally
2018-07-03 14:50   ` Trahe, Fiona
2018-07-03 14:59     ` Verma, Shally
2018-07-03 15:11       ` Trahe, Fiona
2018-07-03 15:14         ` Verma, Shally
2018-05-16  6:05 ` [dpdk-dev] [PATCH v3 6/6] doc: add asym crypto in cryptodev programmer guide Shally Verma
2018-06-14 10:43   ` Kovacevic, Marko
2018-06-15  8:06     ` Verma, Shally
2018-06-17 13:33   ` De Lara Guarch, Pablo
2018-06-17 16:59     ` Verma, Shally

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E115CCD9D858EF4F90C690B0DCB4D8977F8D5ABF@IRSMSX108.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=ashish.gupta@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=pathreya@caviumnetworks.com \
    --cc=shally.verma@caviumnetworks.com \
    --cc=sunila.sahu@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).