DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Azarewicz, PiotrX T" <piotrx.t.azarewicz@intel.com>
To: "Azarewicz, PiotrX T" <piotrx.t.azarewicz@intel.com>,
	"Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Trahe, Fiona" <fiona.trahe@intel.com>,
	"De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>,
	"Griffin, John" <john.griffin@intel.com>,
	"Jain, Deepak K" <deepak.k.jain@intel.com>,
	"Doherty, Declan" <declan.doherty@intel.com>,
	"Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: fix J0 padding bytes	for GCM
Date: Mon, 2 Jan 2017 08:50:37 +0000	[thread overview]
Message-ID: <4837007523CC9A4B9414D20C13DE6E6413758F5E@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <4837007523CC9A4B9414D20C13DE6E6413756B1A@IRSMSX102.ger.corp.intel.com>

Hi Arek,

> > Subject: [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: fix J0 padding
> > bytes for GCM
> >
> > This commit fixes pre-counter block (J0) padding by clearing four most
> > significant bytes before setting initial counter value.
> >
> > Fixes: b2bb3597470c ("crypto/aesni_gcm: move pre-counter block to
> > driver")
> >
> > Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> > ---
> >  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > index dba5e15..af3d60f 100644
> > --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > @@ -40,6 +40,7 @@
> >  #include <rte_vdev.h>
> >  #include <rte_malloc.h>
> >  #include <rte_cpuflags.h>
> > +#include <rte_byteorder.h>
> >
> >  #include "aesni_gcm_pmd_private.h"
> >
> > @@ -241,7 +242,8 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp,
> > struct rte_crypto_sym_op *op,
> >  	 * to set BE LSB to 1, driver expects that 16B is allocated
> 
> I think that 16B expected by driver while only 12B IV is supported is not clear
> from user perspective.
> I think that we should expect 12B only and allocate 16B locally.

I didn't notice that this exception is also described in rte_crypto_sym.h, so this is fine.

> 
> >  	 */
> >  	if (op->cipher.iv.length == 12) {
> > -		op->cipher.iv.data[15] = 1;
> > +		uint32_t *iv_padd = (uint32_t *)&op->cipher.iv.data[12];
> > +		*iv_padd = rte_bswap32(1);
> 
> Should not be that the last byte (number 15) always be set to 1?

I didn't notice that this code will always run in little-endian machine, so this is fine too.

> 
> >  	}
> >
> >  	if (op->auth.aad.length != 12 && op->auth.aad.length != 8 &&
> > --
> > 2.1.0

Acked-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>

  reply	other threads:[~2017-01-02  8:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23  8:24 [dpdk-dev] [PATCH v2 0/3] Fix iv sizes in crypto drivers capabilities Arek Kusztal
2016-12-23  8:24 ` [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: fix J0 padding bytes for GCM Arek Kusztal
2016-12-29 13:08   ` Azarewicz, PiotrX T
2017-01-02  8:50     ` Azarewicz, PiotrX T [this message]
2017-01-06 10:17       ` De Lara Guarch, Pablo
2017-01-06 10:27   ` De Lara Guarch, Pablo
2016-12-23  8:24 ` [dpdk-dev] [PATCH v2 2/3] crypto/aesni_gcm: fix iv size in PMD capabilities Arek Kusztal
2016-12-29 13:17   ` Azarewicz, PiotrX T
2017-01-02  9:08     ` Azarewicz, PiotrX T
2017-01-06 10:31   ` De Lara Guarch, Pablo
2016-12-23  8:24 ` [dpdk-dev] [PATCH v2 3/3] crypto/qat: " Arek Kusztal
2016-12-23 11:03   ` Trahe, Fiona
2017-01-06 10:31   ` De Lara Guarch, Pablo
2017-01-06 10:35 ` [dpdk-dev] [PATCH v2 0/3] Fix iv sizes in crypto drivers capabilities De Lara Guarch, Pablo

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=4837007523CC9A4B9414D20C13DE6E6413758F5E@IRSMSX102.ger.corp.intel.com \
    --to=piotrx.t.azarewicz@intel.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=john.griffin@intel.com \
    --cc=pablo.de.lara.guarch@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).