From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42E59A0562; Tue, 4 May 2021 16:19:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0A6940147; Tue, 4 May 2021 16:19:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 8A0E640141 for ; Tue, 4 May 2021 16:19:49 +0200 (CEST) IronPort-SDR: oqjg+5kr7gfe3VTYrbpO6wh+po/rYt+lbNdxyph1ZVsST8Omc+kWexndVGDWNmE+lDnFg7+zy2 kSI229arfmBQ== X-IronPort-AV: E=McAfee;i="6200,9189,9974"; a="195938995" X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="195938995" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 07:19:48 -0700 IronPort-SDR: 2yJKPGqJ1KzkCyHIZepxd7N7TkMCZhJXj9CgAtbtTjeZyIdsxAxkhLcXfOR+LEdMEoe1Y1EEUG eUzyKl1e2Kyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="433300453" Received: from silpixa00400272.ir.intel.com (HELO silpixa00400272.ger.corp.intel.com) ([10.237.223.111]) by orsmga008.jf.intel.com with ESMTP; 04 May 2021 07:19:44 -0700 From: Kai Ji To: dev@dpdk.org Cc: damianx.nowak@intel.com, roy.fan.zhang@intel.com, Kai Ji Date: Tue, 4 May 2021 15:19:41 +0100 Message-Id: <20210504141941.25098-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] test/crypto: fix auth-cipher compare length in oop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" For out-of-place operations, comparing expected ciphertext with the operation result should skip cipher_offset bytes, as those will not be copied from source to the destination buffer, making the tests fail. Fixes: 02ed7b3871d6 ("test/crypto: add SNOW3G test cases for auth-cipher") Cc: damianx.nowak@intel.com Signed-off-by: Kai Ji Signed-off-by: Damian Nowak --- app/test/test_cryptodev.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 70bf6fe2c..d6956f9c2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -4200,16 +4200,20 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata, /* Validate obuf */ if (verify) { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( plaintext, tdata->plaintext.data, - tdata->plaintext.len >> 3, + (tdata->plaintext.len - tdata->cipher.offset_bits - + (tdata->digest.len << 3)), + tdata->cipher.offset_bits, "SNOW 3G Plaintext data not as expected"); } else { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( ciphertext, tdata->ciphertext.data, - tdata->validDataLenInBits.len, + (tdata->validDataLenInBits.len - + tdata->cipher.offset_bits), + tdata->cipher.offset_bits, "SNOW 3G Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -4397,16 +4401,20 @@ test_snow3g_auth_cipher_sgl(const struct snow3g_test_data *tdata, /* Validate obuf */ if (verify) { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( plaintext, tdata->plaintext.data, - tdata->plaintext.len >> 3, + (tdata->plaintext.len - tdata->cipher.offset_bits - + (tdata->digest.len << 3)), + tdata->cipher.offset_bits, "SNOW 3G Plaintext data not as expected"); } else { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( ciphertext, tdata->ciphertext.data, - tdata->validDataLenInBits.len, + (tdata->validDataLenInBits.len - + tdata->cipher.offset_bits), + tdata->cipher.offset_bits, "SNOW 3G Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( -- 2.17.1 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.