[dpdk-dev] [PATCH 1/8] crypto/aesni_gcm: do not append digest

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Tue Sep 5 10:49:47 CEST 2017


Hi Fan,

> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Monday, September 4, 2017 11:08 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Cc: dev at dpdk.org; Zhang, Roy Fan <roy.fan.zhang at intel.com>
> Subject: RE: [dpdk-dev] [PATCH 1/8] crypto/aesni_gcm: do not append
> digest
> 
> Hi Pablo,
> 
> Thanks for the patch. It is very good idea of allocating only necessary buffer
> for digests in the operation.
> Comments inline:
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pablo de Lara
> > Sent: Friday, August 18, 2017 8:21 AM
> > To: Doherty, Declan <declan.doherty at intel.com>;
> > jerin.jacob at caviumnetworks.com
> > Cc: dev at dpdk.org; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch at intel.com>
> > Subject: [dpdk-dev] [PATCH 1/8] crypto/aesni_gcm: do not append digest
> >
> > When performing an authentication verification, the PMD was using
> > memory at the end of the input buffer, to store temporarily the digest.
> > This operation requires the buffer to have enough tailroom unnecessarily.
> > Instead, memory is allocated for each queue pair, to store temporarily
> > the digest generated by the driver, so it can be compared with the one
> > provided in the crypto operation, without needing to touch the input
> buffer.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> > ---
> >  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c         | 31 +++++----------------
> ---
> >  drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h |  7 ++++++
> >  2 files changed, 13 insertions(+), 25 deletions(-)
> >
> > diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > index d9c91d0..ae670a7 100644
> > --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
> > @@ -298,14 +298,7 @@ process_gcm_crypto_op(struct aesni_gcm_qp
> *qp,
> > struct rte_crypto_op *op,
> >  				sym_op->aead.digest.data,
> >  				(uint64_t)session->digest_length);
> >  	} else if (session->op ==
> > AESNI_GCM_OP_AUTHENTICATED_DECRYPTION) {
> > -		uint8_t *auth_tag = (uint8_t
> > *)rte_pktmbuf_append(sym_op->m_dst ?
> > -				sym_op->m_dst : sym_op->m_src,
> > -				session->digest_length);
> > -
> > -		if (!auth_tag) {
> > -			GCM_LOG_ERR("auth_tag");
> > -			return -1;
> > -		}
> 
> qp->tmp_digest has already the data type of uint8_t*, the casting is not
> necessary here. Although the "&" here seems to be wrong. auth_tag didn't
> point to qp->tmp_digest but a buffer with the address as &qp->tmp_digest.

Thanks for spotting this! Will send a v2 soon.

Pablo


More information about the dev mailing list