From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24F90A0576; Fri, 13 Mar 2020 19:08:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 03CEA1C011; Fri, 13 Mar 2020 19:08:10 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CC41E1AFF for ; Fri, 13 Mar 2020 19:08:08 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 11:08:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,549,1574150400"; d="scan'208";a="278317348" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.121.22]) by fmsmga002.fm.intel.com with ESMTP; 13 Mar 2020 11:08:05 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, Arek Kusztal Date: Fri, 13 Mar 2020 19:07:51 +0100 Message-Id: <20200313180751.2068-2-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20200313180751.2068-1-arkadiuszx.kusztal@intel.com> References: <20200313180751.2068-1-arkadiuszx.kusztal@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/2] test: add crypto aes-gcm J0 test case 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 patch adds crypto J0 test case to AES-GCM Signed-off-by: Arek Kusztal --- app/test/test_cryptodev.c | 28 ++++++++++++++-- app/test/test_cryptodev.h | 1 + app/test/test_cryptodev_aead_test_vectors.h | 51 +++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 7b1ef5c..927c3b7 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -6885,9 +6885,15 @@ create_aead_operation(enum rte_crypto_aead_operation op, uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET); - rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len); - debug_hexdump(stdout, "iv:", iv_ptr, - tdata->iv.len); + if (tdata->iv.len == 0) { + rte_memcpy(iv_ptr, tdata->iv.data, AES_GCM_J0_LENGTH); + debug_hexdump(stdout, "iv:", iv_ptr, + AES_GCM_J0_LENGTH); + } else { + rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len); + debug_hexdump(stdout, "iv:", iv_ptr, + tdata->iv.len); + } } /* Append plaintext/ciphertext */ @@ -7713,6 +7719,12 @@ test_AES_GCM_authenticated_encryption_test_case_8(void) } static int +test_AES_GCM_J0_authenticated_encryption_test_case_1(void) +{ + return test_authenticated_encryption(&gcm_J0_test_case_1); +} + +static int test_AES_GCM_auth_encryption_test_case_192_1(void) { return test_authenticated_encryption(&gcm_test_case_192_1); @@ -8046,6 +8058,12 @@ test_AES_GCM_authenticated_decryption_test_case_8(void) } static int +test_AES_GCM_J0_authenticated_decryption_test_case_1(void) +{ + return test_authenticated_decryption(&gcm_J0_test_case_1); +} + +static int test_AES_GCM_auth_decryption_test_case_192_1(void) { return test_authenticated_decryption(&gcm_test_case_192_1); @@ -11755,6 +11773,8 @@ static struct unit_test_suite cryptodev_testsuite = { test_AES_GCM_authenticated_encryption_test_case_7), TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_authenticated_encryption_test_case_8), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_J0_authenticated_encryption_test_case_1), /** AES GCM Authenticated Decryption */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -11773,6 +11793,8 @@ static struct unit_test_suite cryptodev_testsuite = { test_AES_GCM_authenticated_decryption_test_case_7), TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_authenticated_decryption_test_case_8), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_J0_authenticated_decryption_test_case_1), /** AES GCM Authenticated Encryption 192 bits key */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h index def304e..41542e0 100644 --- a/app/test/test_cryptodev.h +++ b/app/test/test_cryptodev.h @@ -44,6 +44,7 @@ #define TRUNCATED_DIGEST_BYTE_LENGTH_SHA512 (32) #define MAXIMUM_IV_LENGTH (16) +#define AES_GCM_J0_LENGTH (16) #define IV_OFFSET (sizeof(struct rte_crypto_op) + \ sizeof(struct rte_crypto_sym_op) + DEFAULT_NUM_XFORMS * \ diff --git a/app/test/test_cryptodev_aead_test_vectors.h b/app/test/test_cryptodev_aead_test_vectors.h index a4a3a25..e62fdb2 100644 --- a/app/test/test_cryptodev_aead_test_vectors.h +++ b/app/test/test_cryptodev_aead_test_vectors.h @@ -982,6 +982,57 @@ static const struct aead_test_data gcm_test_case_8 = { } }; +static const struct aead_test_data gcm_J0_test_case_1 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, + .key = { + .data = { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 }, + .len = 16 + }, + .iv = { + .data = { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88, 0x00, 0x00, 0x00, 0x01 }, + .len = 0 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { + 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, + 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, + 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, + 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, + 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, + 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, + 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55 }, + .len = 64 + }, + .ciphertext = { + .data = { + 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, + 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, + 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, + 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, + 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, + 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, + 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, + 0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85 + }, + .len = 64 + }, + .auth_tag = { + .data = { + 0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6, + 0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4 }, + .len = 16 + } +}; + /** AES-GCM-192 Test Vectors */ static const struct aead_test_data gcm_test_case_192_1 = { .algo = RTE_CRYPTO_AEAD_AES_GCM, -- 2.1.0