From patchwork Tue Jan 3 15:38:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 18807 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 044BA37B3; Tue, 3 Jan 2017 16:38:39 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C89892BB9 for ; Tue, 3 Jan 2017 16:38:37 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 03 Jan 2017 07:38:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,455,1477983600"; d="scan'208";a="209182185" Received: from sivswdev03.ir.intel.com (HELO localhost.localdomain) ([10.237.217.157]) by fmsmga004.fm.intel.com with ESMTP; 03 Jan 2017 07:38:34 -0800 From: Arek Kusztal 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 Date: Tue, 3 Jan 2017 15:38:31 +0000 Message-Id: <1483457911-9635-1-git-send-email-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] app/test: fix aad padding size in SGL operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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;