DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: "Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: Anoob Joseph <anoobj@marvell.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Fan Zhang <fanzhang.oss@gmail.com>, "Ji, Kai" <kai.ji@intel.com>
Subject: RE: [v1 3/6] cryptodev: add hash support in asymmetric capability
Date: Wed, 27 Sep 2023 05:55:07 +0000	[thread overview]
Message-ID: <CO1PR18MB4714C88868568B12E236D27CCBC2A@CO1PR18MB4714.namprd18.prod.outlook.com> (raw)
In-Reply-To: <PH0PR11MB50135D883A76D141A58DF0279FC3A@PH0PR11MB5013.namprd11.prod.outlook.com>

Hi Arek,
> > rte_crypto_ec_xform {
> >  	enum rte_crypto_curve_id curve_id;
> >  	/**< Pre-defined ec groups */
> > +
> > +	enum rte_crypto_auth_algorithm hash;
> [Arek] I think that session should only contain information that are constant
> across its lifetime. Here we decided to have a curve id, but this could be
> curve + key. But hash may be different for any op, additionally this xform is
> used for key exchange; multiplication or potentially encryption/decryption.,
> which usually does not need any hash. I would have it in the op.

Ack. I will send next version of this series with this modification.
Reason we had in xform is to stop app not to process enq if session creation itself
would fail (without required capability).

In the next version of patch, you would see (2/7), you keys moved into session.

Thanks,
Gowrishankar
> > +	/**< Hash algorithm used in EC op. */
> >  };
> >
> >  /**
> > diff --git a/lib/cryptodev/rte_cryptodev.c
> > b/lib/cryptodev/rte_cryptodev.c index c49d342b17..041d3074db 100644
> > --- a/lib/cryptodev/rte_cryptodev.c
> > +++ b/lib/cryptodev/rte_cryptodev.c
> > @@ -718,6 +718,22 @@
> rte_cryptodev_asym_xform_capability_check_modlen(
> >  	return ret;
> >  }
> >
> > +bool
> > +rte_cryptodev_asym_xform_capability_check_hash(
> > +	const struct rte_cryptodev_asymmetric_xform_capability
> *capability,
> > +	enum rte_crypto_auth_algorithm hash) {
> > +	bool ret = false;
> > +
> > +	if (capability->hash_algos & (1 << hash))
> > +		ret = true;
> > +
> > +	rte_cryptodev_trace_asym_xform_capability_check_hash(
> > +		capability->hash_algos, hash, ret);
> > +
> > +	return ret;
> > +}
> > +
> >  /* spinlock for crypto device enq callbacks */  static rte_spinlock_t
> > rte_cryptodev_callback_lock = RTE_SPINLOCK_INITIALIZER;
> >
> > diff --git a/lib/cryptodev/rte_cryptodev.h
> > b/lib/cryptodev/rte_cryptodev.h index
> > 64810c9ec4..536e082244 100644
> > --- a/lib/cryptodev/rte_cryptodev.h
> > +++ b/lib/cryptodev/rte_cryptodev.h
> > @@ -189,6 +189,9 @@ struct rte_cryptodev_asymmetric_xform_capability
> {
> >  		 * random value. Otherwise, PMD would internally compute
> the random
> > number.
> >  		 */
> >  	};
> > +
> > +	uint64_t hash_algos;
> > +	/**< Bitmask of hash algorithms supported for op_type. */
> >  };
> >
> >  /**
> > @@ -348,6 +351,22 @@
> rte_cryptodev_asym_xform_capability_check_modlen(
> >  	const struct rte_cryptodev_asymmetric_xform_capability
> *capability,
> >  		uint16_t modlen);
> >
> > +/**
> > + * Check if hash algorithm is supported.
> > + *
> > + * @param	capability	Asymmetric crypto capability.
> > + * @param	hash		Hash algorithm.
> > + *
> > + * @return
> > + *   - Return true if the hash algorithm is supported.
> > + *   - Return false if the hash algorithm is not supported.
> > + */
> > +__rte_experimental
> > +bool
> > +rte_cryptodev_asym_xform_capability_check_hash(
> > +	const struct rte_cryptodev_asymmetric_xform_capability
> *capability,
> > +	enum rte_crypto_auth_algorithm hash);
> > +
> >  /**
> >   * Provide the cipher algorithm enum, given an algorithm string
> >   *
> > diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
> > index
> > ae8d9327b4..3c2d1780e0 100644
> > --- a/lib/cryptodev/version.map
> > +++ b/lib/cryptodev/version.map
> > @@ -54,6 +54,7 @@ EXPERIMENTAL {
> >  	rte_cryptodev_asym_get_xform_enum;
> >  	rte_cryptodev_asym_session_create;
> >  	rte_cryptodev_asym_session_free;
> > +	rte_cryptodev_asym_xform_capability_check_hash;
> >  	rte_cryptodev_asym_xform_capability_check_modlen;
> >  	rte_cryptodev_asym_xform_capability_check_optype;
> >  	rte_cryptodev_sym_cpu_crypto_process;
> > --
> > 2.25.1


  reply	other threads:[~2023-09-27  5:55 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  9:35 [v1 0/6] cryptodev: support digest message in SM2 Gowrishankar Muthukrishnan
2023-08-10  9:35 ` [v1 1/6] crypto/openssl: include SM2 in asymmetric capabilities Gowrishankar Muthukrishnan
2023-09-26 19:53   ` Kusztal, ArkadiuszX
2023-08-10  9:35 ` [v1 2/6] cryptodev: add RNG capability in EC based xform Gowrishankar Muthukrishnan
2023-09-26 19:53   ` Kusztal, ArkadiuszX
2023-08-10  9:35 ` [v1 3/6] cryptodev: add hash support in asymmetric capability Gowrishankar Muthukrishnan
2023-09-26 20:03   ` Kusztal, ArkadiuszX
2023-09-27  5:55     ` Gowrishankar Muthukrishnan [this message]
2023-08-10  9:35 ` [v1 4/6] cryptodev: use generic EC xform params for SM2 Gowrishankar Muthukrishnan
2023-09-26 20:05   ` Kusztal, ArkadiuszX
2023-08-10  9:35 ` [v1 5/6] app/test: check asymmetric capabilities in SM2 test Gowrishankar Muthukrishnan
2023-09-26 20:05   ` Kusztal, ArkadiuszX
2023-08-10  9:35 ` [v1 6/6] crypto/cnxk: add SM2 support Gowrishankar Muthukrishnan
2023-09-14  7:21 ` [v1 0/6] cryptodev: support digest message in SM2 Gowrishankar Muthukrishnan
2023-09-27 11:37 ` [PATCH v2 0/7] " Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 1/7] crypto/openssl: include SM2 in asymmetric capabilities Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 2/7] cryptodev: set private and public keys in EC session Gowrishankar Muthukrishnan
2023-09-28 12:44     ` Power, Ciara
2023-09-28 13:12       ` Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 3/7] cryptodev: add RNG capability in EC based xform Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 4/7] cryptodev: add hash algorithms in asymmetric capability Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 5/7] cryptodev: use generic EC xform params for SM2 Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 6/7] app/test: check asymmetric capabilities in SM2 test Gowrishankar Muthukrishnan
2023-09-27 11:37   ` [PATCH v2 7/7] crypto/cnxk: add SM2 support Gowrishankar Muthukrishnan
2023-09-28 17:09   ` [PATCH v3 0/7] cryptodev: support digest message in SM2 Gowrishankar Muthukrishnan
2023-09-28 17:09     ` [PATCH v3 1/7] crypto/openssl: include SM2 in asymmetric capabilities Gowrishankar Muthukrishnan
2023-09-28 17:09     ` [PATCH v3 2/7] cryptodev: add hash algorithms in asymmetric capability Gowrishankar Muthukrishnan
2023-09-28 17:09     ` [PATCH v3 3/7] cryptodev: use generic EC xform params for SM2 Gowrishankar Muthukrishnan
2023-09-28 17:09     ` [PATCH v3 4/7] cryptodev: set private and public keys in EC session Gowrishankar Muthukrishnan
2023-09-29 12:47       ` Power, Ciara
2023-09-28 17:09     ` [PATCH v3 5/7] cryptodev: add RNG capability in EC based xform Gowrishankar Muthukrishnan
2023-09-28 17:09     ` [PATCH v3 6/7] crypto/cnxk: add SM2 support Gowrishankar Muthukrishnan
2023-09-28 17:09     ` [PATCH v3 7/7] app/test: check asymmetric capabilities in SM2 test Gowrishankar Muthukrishnan
2023-10-09 13:54     ` [PATCH v4 0/7] cryptodev: support digest message in SM2 Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 1/7] crypto/openssl: include SM2 in asymmetric capabilities Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 2/7] cryptodev: add hash algorithms in asymmetric capability Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 3/7] cryptodev: use generic EC xform params for SM2 Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 4/7] cryptodev: set private and public keys in EC session Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 5/7] cryptodev: add RNG capability in EC based xform Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 6/7] crypto/cnxk: add SM2 support Gowrishankar Muthukrishnan
2023-10-09 13:54       ` [PATCH v4 7/7] app/test: check asymmetric capabilities in SM2 test Gowrishankar Muthukrishnan
2023-10-09 19:07       ` [PATCH v4 0/7] cryptodev: support digest message in SM2 Akhil Goyal

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=CO1PR18MB4714C88868568B12E236D27CCBC2A@CO1PR18MB4714.namprd18.prod.outlook.com \
    --to=gmuthukrishn@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@intel.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).