[dpdk-dev] [PATCH v3 2/6] crypto/aesni_gcm: cpu crypto support

Ananyev, Konstantin konstantin.ananyev at intel.com
Tue Jan 21 15:29:24 CET 2020



Hi Pablo,

> > Add support for CPU crypto mode by introducing required handler.
> > Crypto mode (sync/async) is chosen during sym session create if an appropriate
> > flag is set in an xform type number.
> >
> > Authenticated encryption and decryption are supported with tag
> > generation/verification.
> >
> > Signed-off-by: Marcin Smoczynski <marcinx.smoczynski at intel.com>
> > ---
> >  drivers/crypto/aesni_gcm/aesni_gcm_ops.h      |   9 ++
> >  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c      | 149 +++++++++++++++++-
> >  drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c  |   3 +
> >  .../crypto/aesni_gcm/aesni_gcm_pmd_private.h  |  18 ++-
> >  4 files changed, 169 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_ops.h
> > b/drivers/crypto/aesni_gcm/aesni_gcm_ops.h
> > index e272f1067..404c0adff 100644
> 
> ...
> 
> > --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > @@ -25,9 +25,16 @@ aesni_gcm_set_session_parameters(const struct
> > aesni_gcm_ops *gcm_ops,
> >  	const struct rte_crypto_sym_xform *aead_xform;
> >  	uint8_t key_length;
> >  	const uint8_t *key;
> > +	uint32_t xform_type;
> > +
> > +	/* check for CPU-crypto mode */
> > +	xform_type = xform->type;
> > +	sess->mode = xform_type | RTE_CRYPTO_SYM_CPU_CRYPTO ?
> > +		AESNI_GCM_MODE_SYNC : AESNI_GCM_MODE_ASYNC;
> > +	xform_type &= RTE_CRYPTO_SYM_XFORM_TYPE_MASK;
> >
> >  	/* AES-GMAC */
> > -	if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
> > +	if (xform_type == RTE_CRYPTO_SYM_XFORM_AUTH) {
> >  		auth_xform = xform;
> >  		if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_AES_GMAC) {
> 
> Could you add support for AES-GMAC, so all algorithms supported by this PMD support this new API?

Not sure I get you here...
This code is present in current version of the driver too, no addition/deletions as I can see:

/* AES-GMAC */
        if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
                auth_xform = xform;
                if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_AES_GMAC) {
                        AESNI_GCM_LOG(ERR, "Only AES GMAC is supported as an "
                                "authentication only algorithm");
                        return -ENOTSUP;
                }


The only thing is changed: xform type calculation.
Konstantin

> 
> >  			AESNI_GCM_LOG(ERR, "Only AES GMAC is supported as
> > an "
> > @@ -49,7 +56,7 @@ aesni_gcm_set_session_parameters(const struct
> > aesni_gcm_ops *gcm_ops,
> >  		sess->req_digest_length = auth_xform->auth.digest_length;
> 
> ...
> 
> > --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
> > +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
> > @@ -331,9 +331,12 @@ struct rte_cryptodev_ops aesni_gcm_pmd_ops = {
> >  		.queue_pair_release	= aesni_gcm_pmd_qp_release,
> >  		.queue_pair_count	= aesni_gcm_pmd_qp_count,
> >
> > +		.sym_cpu_process        = aesni_gcm_pmd_cpu_crypto_process,
> > +
> >  		.sym_session_get_size	=
> > aesni_gcm_pmd_sym_session_get_size,
> >  		.sym_session_configure	=
> > aesni_gcm_pmd_sym_session_configure,
> >  		.sym_session_clear	= aesni_gcm_pmd_sym_session_clear
> >  };
> >
> >  struct rte_cryptodev_ops *rte_aesni_gcm_pmd_ops = &aesni_gcm_pmd_ops;
> > +
> 
> Remove this extra line.
> 
> Thanks!
> Pablo


More information about the dev mailing list