From patchwork Tue May 4 13:33:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ji, Kai" X-Patchwork-Id: 92893 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1EE09A0524; Wed, 5 May 2021 11:31:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0945940040; Wed, 5 May 2021 11:31:46 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 9344D40141 for ; Tue, 4 May 2021 15:33:36 +0200 (CEST) IronPort-SDR: 2VqPcgth4nzUZTZw+z9xWvG8f0290yuJcJd3LeodBsSsHFIeNlrP1BeV0FXYzib+m0FLa51HdK FDNfJeD67vyg== X-IronPort-AV: E=McAfee;i="6200,9189,9974"; a="259263185" X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="259263185" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 06:33:34 -0700 IronPort-SDR: fTZvx9Q4GwFpUSZ5s3c2RGDsj4jpUcuiQs5a2Bi9sEupOe5fb4RzwDLlKiAU5rd1Jsd6dgYCTf j3unTVl3mV6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="429044083" Received: from silpixa00400272.ir.intel.com (HELO silpixa00400272.ger.corp.intel.com) ([10.237.223.111]) by fmsmga008.fm.intel.com with ESMTP; 04 May 2021 06:33:33 -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 14:33:30 +0100 Message-Id: <20210504133330.24248-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 05 May 2021 11:31:45 +0200 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(