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

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Tue Jan 21 23:33:47 CET 2020



> -----Original Message-----
> From: Ananyev, Konstantin <konstantin.ananyev at intel.com>
> Sent: Tuesday, January 21, 2020 3:23 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>; Smoczynski,
> MarcinX <marcinx.smoczynski at intel.com>; akhil.goyal at nxp.com; Zhang, Roy
> Fan <roy.fan.zhang at intel.com>; Doherty, Declan <declan.doherty at intel.com>;
> Nicolau, Radu <radu.nicolau at intel.com>
> Cc: dev at dpdk.org; Smoczynski, MarcinX <marcinx.smoczynski at intel.com>
> Subject: RE: [dpdk-dev] [PATCH v3 2/6] crypto/aesni_gcm: cpu crypto support
> 
> 
> 
> > > > > 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
> > > >
> > > > ...
> > > > >
> > > > >  	/* 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.
> >
> > From what I can see, sess->op is not set for AES-GMAC.
> > In aesni_gcm_pmd_cpu_crypto_process(), this value is checked, In the
> > switch that is in line 471.
> 
> Ah, you mean sess->ops.* are not initialized properly for GMAC, right?

Correct. Actually, sess->op is set, but in the switch in line 471, only
AESNI_GCM_OP_AUTHENTICATED_ENCRYPTION and
AESNI_GCM_OP_AUTHENTICATED_DECRYPTION are used,
which I would think that it means that any GMAC operation would fail.

Pablo
> 
> >
> > Looks like in this case, this would return an invalid status.
> >
> > Am I getting this wrong?
> >
> > Thanks!
> > Pablo
> >
> > > Konstantin



More information about the dev mailing list