DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: fiona.trahe@intel.com, pablo.de.lara.guarch@intel.com,
	john.griffin@intel.com, deepak.k.jain@intel.com,
	Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [dpdk-dev] [PATCH] app/test: fix aad padding size in SGL operation
Date: Tue,  3 Jan 2017 15:38:31 +0000	[thread overview]
Message-ID: <1483457911-9635-1-git-send-email-arkadiuszx.kusztal@intel.com> (raw)

This commit fixes unnecessary padding of aad for GCM using
scatter-gather list

Fixes: b71990ffa7e4 ("app/test: add SGL tests to cryptodev QAT suite")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 app/test/test_cryptodev.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index ba6bbb5..3eaf1b7 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -5983,7 +5983,7 @@ create_gcm_operation_SGL(enum rte_crypto_cipher_operation op,
 	const unsigned int iv_len = tdata->iv.len;
 	const unsigned int aad_len = tdata->aad.len;
 
-	unsigned int iv_pad_len = 0, aad_buffer_len = 0;
+	unsigned int iv_pad_len = 0;
 
 	/* Generate Crypto op data structure */
 	ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -6023,17 +6023,15 @@ create_gcm_operation_SGL(enum rte_crypto_cipher_operation op,
 
 	rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, iv_pad_len);
 
-	aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
-
 	sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend(
-			ut_params->ibuf, aad_buffer_len);
+			ut_params->ibuf, aad_len);
 	TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
 			"no room to prepend aad");
 	sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
 			ut_params->ibuf);
 	sym_op->auth.aad.length = aad_len;
 
-	memset(sym_op->auth.aad.data, 0, aad_buffer_len);
+	memset(sym_op->auth.aad.data, 0, aad_len);
 	rte_memcpy(sym_op->auth.aad.data, tdata->aad.data, aad_len);
 
 	TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len);
@@ -6041,9 +6039,9 @@ create_gcm_operation_SGL(enum rte_crypto_cipher_operation op,
 			sym_op->auth.aad.data, aad_len);
 
 	sym_op->cipher.data.length = tdata->plaintext.len;
-	sym_op->cipher.data.offset = aad_buffer_len + iv_pad_len;
+	sym_op->cipher.data.offset = aad_len + iv_pad_len;
 
-	sym_op->auth.data.offset = aad_buffer_len + iv_pad_len;
+	sym_op->auth.data.offset = aad_len + iv_pad_len;
 	sym_op->auth.data.length = tdata->plaintext.len;
 
 	return 0;
-- 
2.1.0

             reply	other threads:[~2017-01-03 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 15:38 Arek Kusztal [this message]
2017-01-09 13:38 ` De Lara Guarch, Pablo
2017-01-09 14:08   ` Kusztal, ArkadiuszX
2017-01-10  8:41     ` 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=1483457911-9635-1-git-send-email-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@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).