From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id EEF3C5A8F for ; Tue, 31 May 2016 11:09:55 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 31 May 2016 02:09:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,395,1459839600"; d="scan'208";a="711471837" Received: from sie-lab-212-071.ir.intel.com (HELO silvfanzhan2.ir.intel.com) ([10.237.212.71]) by FMSMGA003.fm.intel.com with ESMTP; 31 May 2016 02:09:55 -0700 From: Fan Zhang To: dev@dpdk.org Cc: declan.doherty@intel.com Date: Tue, 31 May 2016 10:09:47 +0100 Message-Id: <1464685789-8386-4-git-send-email-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464685789-8386-1-git-send-email-roy.fan.zhang@intel.com> References: <1464685789-8386-1-git-send-email-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH 3/5] app/test: utilize new unified crypto AES test function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2016 09:09:57 -0000 This patch replaces the AES test code with new unified crypto AES test function. Signed-off-by: Fan Zhang --- app/test/test_cryptodev.c | 1613 ++---------------------- app/test/test_cryptodev_aes_ctr_test_vectors.h | 257 ---- 2 files changed, 122 insertions(+), 1748 deletions(-) delete mode 100644 app/test/test_cryptodev_aes_ctr_test_vectors.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 45e6daa..1730022 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -43,7 +43,7 @@ #include "test.h" #include "test_cryptodev.h" -#include "test_cryptodev_aes_ctr_test_vectors.h" +#include "test_cryptodev_aes.h" #include "test_cryptodev_snow3g_test_vectors.h" #include "test_cryptodev_snow3g_hash_test_vectors.h" #include "test_cryptodev_gcm_test_vectors.h" @@ -111,19 +111,6 @@ setup_test_string(struct rte_mempool *mpool, return m; } -static int -setup_oop_test_mbufs(struct rte_mbuf **ibuf, struct rte_mbuf **obuf, - struct rte_mempool *mpool, const char *string, size_t len, - uint8_t blocksize) { - *ibuf = setup_test_string(mpool, string, len, blocksize); - if (*ibuf == NULL) - return -(EFAULT); - *obuf = setup_test_string(mpool, NULL, len, blocksize); - if (*obuf == NULL) - return -(EFAULT); - - return 0; -} #if HEX_DUMP static void @@ -890,1316 +877,80 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - /* Validate obuf */ - uint8_t *ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src, - uint8_t *, CIPHER_IV_LENGTH_AES_CBC); - - TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext, - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, - "ciphertext data not as expected"); - - uint8_t *digest = ciphertext + QUOTE_512_BYTES; - - TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, - gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? - TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 : - DIGEST_BYTE_LENGTH_SHA1, - "Generated digest data not as expected"); - - return TEST_SUCCESS; -} - - -static int -test_AES_CBC_HMAC_SHA1_encrypt_digest_oop(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and space for digest */ - - TEST_ASSERT_EQUAL(setup_oop_test_mbufs(&ut_params->ibuf, - &ut_params->obuf, ts_params->mbuf_pool, catch_22_quote, - QUOTE_512_BYTES, 0), 0, - "Allocation of rte_mbuf failed"); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->obuf, - DIGEST_BYTE_LENGTH_SHA1); - - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = &ut_params->auth_xform; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = NULL; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA1; - ut_params->auth_xform.auth.key.data = hmac_sha1_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; - - ut_params->sess = rte_cryptodev_sym_session_create( - ts_params->valid_devs[0], - &ut_params->cipher_xform); - - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - - - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - sym_op->m_dst = ut_params->obuf; - - sym_op->auth.digest.data = ut_params->digest; - - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->obuf, QUOTE_512_BYTES); - - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1; - sym_op->auth.data.length = QUOTE_512_BYTES; - - /* Set crypto operation cipher parameters */ - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, - CIPHER_IV_LENGTH_AES_CBC); - - TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, - "Failed to prepend place for iv input"); - - TEST_ASSERT_NOT_NULL(rte_pktmbuf_prepend(ut_params->obuf, - CIPHER_IV_LENGTH_AES_CBC), - "Failed to prepend place for iv output"); - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - /* Validate obuf */ - uint8_t *ciphertext; - - ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_dst, - uint8_t *, CIPHER_IV_LENGTH_AES_CBC); - - TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext, - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, - "ciphertext data not as expected"); - - uint8_t *digest = ciphertext + QUOTE_512_BYTES; - - TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, - gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? - TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 : - DIGEST_BYTE_LENGTH_SHA1, - "Generated digest data not as expected"); - - - return TEST_SUCCESS; -} - - -static int -test_AES_CBC_HMAC_SHA1_decrypt_digest_oop_ver(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and digest */ - - TEST_ASSERT_EQUAL(setup_oop_test_mbufs(&ut_params->ibuf, - &ut_params->obuf, ts_params->mbuf_pool, - (const char *) - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, 0), 0, - "Allocation of rte_mbuf failed"); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA1); - - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - rte_memcpy(ut_params->digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, - DIGEST_BYTE_LENGTH_SHA1); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = NULL; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = &ut_params->cipher_xform; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA1; - ut_params->auth_xform.auth.key.data = hmac_sha1_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; - - /* Create Crypto session*/ - ut_params->sess = - rte_cryptodev_sym_session_create(ts_params->valid_devs[0], - &ut_params->auth_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - /* attach symmetric crypto session to crypto operations */ - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - sym_op->m_dst = ut_params->obuf; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1; - - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, - CIPHER_IV_LENGTH_AES_CBC); - - TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, - "Failed to prepend place for iv input"); - - TEST_ASSERT_NOT_NULL(rte_pktmbuf_prepend(ut_params->obuf, - CIPHER_IV_LENGTH_AES_CBC), - "Failed to prepend place for iv output"); - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "Digest verification failed"); - - ut_params->obuf = ut_params->op->sym->m_dst; - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, - catch_22_quote, - QUOTE_512_BYTES, - "Ciphertext data not as expected"); - - - return TEST_SUCCESS; -} - - -static int -test_AES_CBC_HMAC_SHA1_encrypt_digest_sessionless(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and space for digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - catch_22_quote, QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA1); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - TEST_ASSERT_NOT_NULL(rte_crypto_op_sym_xforms_alloc(ut_params->op, 2), - "failed to allocate space for crypto transforms"); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - /* Set crypto operation data parameters */ - sym_op->xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER; - - /* cipher parameters */ - sym_op->xform->cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - sym_op->xform->cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - sym_op->xform->cipher.key.data = aes_cbc_key; - sym_op->xform->cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* hash parameters */ - sym_op->xform->next->type = RTE_CRYPTO_SYM_XFORM_AUTH; - - sym_op->xform->next->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - sym_op->xform->next->auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC; - sym_op->xform->next->auth.key.length = HMAC_KEY_LENGTH_SHA1; - sym_op->xform->next->auth.key.data = hmac_sha1_key; - sym_op->xform->next->auth.digest_length = - DIGEST_BYTE_LENGTH_SHA1; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1; - - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, - CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - ut_params->obuf = ut_params->op->sym->m_src; - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, - "Ciphertext data not as expected"); - - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC + QUOTE_512_BYTES, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, - gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? - TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 : - DIGEST_BYTE_LENGTH_SHA1, - "Generated digest data not as expected"); - - - return TEST_SUCCESS; -} - -static int -test_AES_CBC_HMAC_SHA1_decrypt_digest_verify(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *) - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA1); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - rte_memcpy(ut_params->digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, - DIGEST_BYTE_LENGTH_SHA1); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = NULL; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = &ut_params->cipher_xform; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA1; - ut_params->auth_xform.auth.key.data = hmac_sha1_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; - - /* Create Crypto session*/ - ut_params->sess = - rte_cryptodev_sym_session_create(ts_params->valid_devs[0], - &ut_params->auth_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - /* attach symmetric crypto session to crypto operations */ - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1; - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, - CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - ut_params->obuf = ut_params->op->sym->m_src; - - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, - catch_22_quote, - QUOTE_512_BYTES, - "Ciphertext data not as expected"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "Digest verification failed"); - - - return TEST_SUCCESS; -} - - /* **** AES counter mode tests **** */ - -static int -test_AES_CTR_encrypt_digest(const struct aes_ctr_test_data *tdata) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - struct rte_crypto_sym_op *sym_op; - - uint8_t hash_key[tdata->auth_key.len]; - uint8_t cipher_key[tdata->key.len]; - - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *)tdata->plaintext.data, - tdata->plaintext.len, 0); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = &ut_params->auth_xform; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CTR; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - - rte_memcpy(cipher_key, tdata->key.data, tdata->key.len); - ut_params->cipher_xform.cipher.key.data = cipher_key; - ut_params->cipher_xform.cipher.key.length = - tdata->key.len; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = NULL; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - ut_params->auth_xform.auth.algo = tdata->auth_key.algo; - ut_params->auth_xform.auth.key.length = - tdata->auth_key.len; - rte_memcpy(hash_key, tdata->auth_key.data, tdata->auth_key.len); - ut_params->auth_xform.auth.key.data = hash_key; - ut_params->auth_xform.auth.digest_length = tdata->digest.len; - - /* Create Crypto session*/ - ut_params->sess = rte_cryptodev_sym_session_create( - ts_params->valid_devs[0], - &ut_params->cipher_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - /* Set operation cipher parameters */ - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( - sym_op->m_src, tdata->iv.len); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(sym_op->m_src); - sym_op->cipher.iv.length = tdata->iv.len; - - rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, - tdata->iv.len); - - sym_op->cipher.data.offset = tdata->iv.len; - sym_op->cipher.data.length = tdata->plaintext.len; - - /* Set operation authentication parameters */ - sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( - sym_op->m_src, tdata->digest.len); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - sym_op->m_src, - tdata->iv.len + tdata->ciphertext.len); - sym_op->auth.digest.length = tdata->digest.len; - - memset(sym_op->auth.digest.data, 0, tdata->digest.len); - - sym_op->auth.data.offset = tdata->iv.len; - sym_op->auth.data.length = tdata->plaintext.len; - - /* Process crypto operation */ - ut_params->op = process_crypto_request(ts_params->valid_devs[0], - ut_params->op); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - uint8_t *ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src, - uint8_t *, tdata->iv.len); - - TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext, - tdata->ciphertext.data, - tdata->ciphertext.len, - "ciphertext data not as expected"); - - uint8_t *digest = ciphertext + tdata->ciphertext.len; - - TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, - tdata->digest.data, tdata->digest.len, - "Generated digest data not as expected"); - - return TEST_SUCCESS; -} - -static int -test_AES_CTR_encrypt_digest_case_1(void) -{ - return test_AES_CTR_encrypt_digest(&aes_ctr_test_case_1); -} -static int -test_AES_CTR_encrypt_digest_case_2(void) -{ - return test_AES_CTR_encrypt_digest(&aes_ctr_test_case_2); -} -static int -test_AES_CTR_encrypt_digest_case_3(void) -{ - return test_AES_CTR_encrypt_digest(&aes_ctr_test_case_3); -} - -static int -test_AES_CTR_digest_verify_decrypt(const struct aes_ctr_test_data *tdata) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - struct rte_crypto_sym_op *sym_op; - - uint8_t hash_key[tdata->auth_key.len]; - uint8_t cipher_key[tdata->key.len]; - - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *)tdata->ciphertext.data, - tdata->ciphertext.len, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - tdata->digest.len); - - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - rte_memcpy(ut_params->digest, - tdata->digest.data, - tdata->digest.len); - - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = &ut_params->cipher_xform; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = tdata->auth_key.algo; - ut_params->auth_xform.auth.key.length = tdata->auth_key.len; - rte_memcpy(hash_key, tdata->auth_key.data, tdata->auth_key.len); - ut_params->auth_xform.auth.key.data = - hash_key; - ut_params->auth_xform.auth.digest_length = tdata->digest.len; - - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = NULL; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CTR; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - - rte_memcpy(cipher_key, tdata->key.data, tdata->key.len); - ut_params->cipher_xform.cipher.key.data = - cipher_key; - ut_params->cipher_xform.cipher.key.length = tdata->key.len; - - ut_params->sess = rte_cryptodev_sym_session_create( - ts_params->valid_devs[0], - &ut_params->auth_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - sym_op = ut_params->op->sym; - - sym_op->m_src = ut_params->ibuf; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( - sym_op->m_src, tdata->iv.len); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(sym_op->m_src); - sym_op->cipher.iv.length = tdata->iv.len; - - rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, - tdata->iv.len); - - sym_op->cipher.data.offset = tdata->iv.len; - sym_op->cipher.data.length = tdata->ciphertext.len; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - sym_op->m_src, - tdata->iv.len + tdata->ciphertext.len); - sym_op->auth.digest.length = tdata->digest.len; - - sym_op->auth.data.offset = tdata->iv.len; - sym_op->auth.data.length = tdata->ciphertext.len; - - ut_params->op = process_crypto_request(ts_params->valid_devs[0], - ut_params->op); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - uint8_t *plaintext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src, - uint8_t *, tdata->iv.len); - - TEST_ASSERT_BUFFERS_ARE_EQUAL(plaintext, - tdata->plaintext.data, - tdata->plaintext.len, - "plaintext data not as expected"); - - - return TEST_SUCCESS; -} - -static int -test_AES_CTR_digest_verify_decrypt_case_1(void) -{ - return test_AES_CTR_digest_verify_decrypt(&aes_ctr_test_case_1); -} -static int -test_AES_CTR_digest_verify_decrypt_case_2(void) -{ - return test_AES_CTR_digest_verify_decrypt(&aes_ctr_test_case_2); -} -static int -test_AES_CTR_digest_verify_decrypt_case_3(void) -{ - return test_AES_CTR_digest_verify_decrypt(&aes_ctr_test_case_3); -} - - -/* ***** AES-CBC / HMAC-SHA256 Hash Tests ***** */ - -#define HMAC_KEY_LENGTH_SHA256 (DIGEST_BYTE_LENGTH_SHA256) - -static uint8_t hmac_sha256_key[] = { - 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1, - 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA, - 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76, - 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60 }; - -static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA256_digest[] = { - 0xc8, 0x57, 0x57, 0x31, 0x03, 0xe0, 0x03, 0x55, - 0x07, 0xc8, 0x9e, 0x7f, 0x48, 0x9a, 0x61, 0x9a, - 0x68, 0xee, 0x03, 0x0e, 0x71, 0x75, 0xc7, 0xf4, - 0x2e, 0x45, 0x26, 0x32, 0x7c, 0x12, 0x15, 0x15 }; - -static int -test_AES_CBC_HMAC_SHA256_encrypt_digest(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and space for digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - catch_22_quote, QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA256); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = &ut_params->auth_xform; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = NULL; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA256_HMAC; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA256; - ut_params->auth_xform.auth.key.data = hmac_sha256_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256; - - /* Create Crypto session*/ - ut_params->sess = rte_cryptodev_sym_session_create( - ts_params->valid_devs[0], - &ut_params->cipher_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA256; - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, - CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - ut_params->obuf = ut_params->op->sym->m_src; - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, - "Ciphertext data not as expected"); - - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC + QUOTE_512_BYTES, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA256_digest, - gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? - TRUNCATED_DIGEST_BYTE_LENGTH_SHA256 : - DIGEST_BYTE_LENGTH_SHA256, - "Generated digest data not as expected"); - - - return TEST_SUCCESS; -} - -static int -test_AES_CBC_HMAC_SHA256_decrypt_digest_verify(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *) - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA256); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - rte_memcpy(ut_params->digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA256_digest, - DIGEST_BYTE_LENGTH_SHA256); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = NULL; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = &ut_params->cipher_xform; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA256_HMAC; - ut_params->auth_xform.auth.key.data = hmac_sha256_key; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA256; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256; - - /* Create Crypto session*/ - ut_params->sess = - rte_cryptodev_sym_session_create(ts_params->valid_devs[0], - &ut_params->auth_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - - /* Set crypto operation data parameters */ - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA256; - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( - ut_params->ibuf, CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - ut_params->obuf = ut_params->op->sym->m_src; - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, catch_22_quote, - QUOTE_512_BYTES, - "Plaintext data not as expected"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "Digest verification failed"); - - return TEST_SUCCESS; -} - -/* ***** AES-CBC / HMAC-SHA512 Hash Tests ***** */ - -#define HMAC_KEY_LENGTH_SHA512 (DIGEST_BYTE_LENGTH_SHA512) - -static uint8_t hmac_sha512_key[] = { - 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1, - 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA, - 0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76, - 0x9a, 0xaf, 0x88, 0x1b, 0xb6, 0x8f, 0xf8, 0x60, - 0xa2, 0x5a, 0x7f, 0x3f, 0xf4, 0x72, 0x70, 0xf1, - 0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0, - 0x47, 0x3a, 0x75, 0x61, 0x5C, 0xa2, 0x10, 0x76, - 0x9a, 0xaf, 0x77, 0x5b, 0xb6, 0x7f, 0xf7, 0x60 }; - -static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest[] = { - 0x5D, 0x54, 0x66, 0xC1, 0x6E, 0xBC, 0x04, 0xB8, - 0x46, 0xB8, 0x08, 0x6E, 0xE0, 0xF0, 0x43, 0x48, - 0x37, 0x96, 0x9C, 0xC6, 0x9C, 0xC2, 0x1E, 0xE8, - 0xF2, 0x0C, 0x0B, 0xEF, 0x86, 0xA2, 0xE3, 0x70, - 0x95, 0xC8, 0xB3, 0x06, 0x47, 0xA9, 0x90, 0xE8, - 0xA0, 0xC6, 0x72, 0x69, 0x05, 0xC0, 0x0D, 0x0E, - 0x21, 0x96, 0x65, 0x93, 0x74, 0x43, 0x2A, 0x1D, - 0x2E, 0xBF, 0xC2, 0xC2, 0xEE, 0xCC, 0x2F, 0x0A }; - -static int -test_AES_CBC_HMAC_SHA512_encrypt_digest(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and space for digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - catch_22_quote, QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA512); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = &ut_params->auth_xform; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = NULL; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA512_HMAC; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA512; - ut_params->auth_xform.auth.key.data = hmac_sha512_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA512; - - /* Create Crypto session*/ - ut_params->sess = - rte_cryptodev_sym_session_create(ts_params->valid_devs[0], - &ut_params->cipher_xform); - - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA512; - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, - CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - ut_params->obuf = ut_params->op->sym->m_src; - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, - "Ciphertext data not as expected"); - - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC + QUOTE_512_BYTES, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest, - gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? - TRUNCATED_DIGEST_BYTE_LENGTH_SHA512 : - DIGEST_BYTE_LENGTH_SHA512, - "Generated digest data not as expected"); - - return TEST_SUCCESS; -} - - -static int -test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params); - -static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, - struct crypto_unittest_params *ut_params, - struct crypto_testsuite_params *ts_params); - -static int -test_AES_CBC_HMAC_SHA512_decrypt_digest_verify(void) -{ - struct crypto_unittest_params *ut_params = &unittest_params; - struct crypto_testsuite_params *ts_params = &testsuite_params; - - TEST_ASSERT(test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - ut_params) == TEST_SUCCESS, - "Failed to create session params"); - - /* Create Crypto session*/ - ut_params->sess = - rte_cryptodev_sym_session_create(ts_params->valid_devs[0], - &ut_params->auth_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - return test_AES_CBC_HMAC_SHA512_decrypt_perform(ut_params->sess, - ut_params, ts_params); -} - -static int -test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params) -{ - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = NULL; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = &ut_params->cipher_xform; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA512_HMAC; - ut_params->auth_xform.auth.key.data = hmac_sha512_key; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA512; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA512; - - return TEST_SUCCESS; -} - - -static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, - struct crypto_unittest_params *ut_params, - struct crypto_testsuite_params *ts_params) -{ - /* Generate test mbuf data and digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *) - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA512); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - rte_memcpy(ut_params->digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest, - DIGEST_BYTE_LENGTH_SHA512); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA512; - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( - ut_params->ibuf, CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, 0); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], - ut_params->op), "failed to process sym crypto op"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto op processing failed"); - - ut_params->obuf = ut_params->op->sym->m_src; - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + - CIPHER_IV_LENGTH_AES_CBC, catch_22_quote, - QUOTE_512_BYTES, - "Plaintext data not as expected"); - - /* Validate obuf */ - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "Digest verification failed"); - - return TEST_SUCCESS; -} - -/* ***** AES-CBC / HMAC-AES_XCBC Chain Tests ***** */ - -static uint8_t aes_cbc_hmac_aes_xcbc_key[] = { - 0x87, 0x61, 0x54, 0x53, 0xC4, 0x6D, 0xDD, 0x51, - 0xE1, 0x9F, 0x86, 0x64, 0x39, 0x0A, 0xE6, 0x59 - }; - -static const uint8_t catch_22_quote_2_512_bytes_HMAC_AES_XCBC_digest[] = { - 0xE0, 0xAC, 0x9A, 0xC4, 0x22, 0x64, 0x35, 0x89, - 0x77, 0x1D, 0x8B, 0x75 - }; - -static int -test_AES_CBC_HMAC_AES_XCBC_encrypt_digest(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Generate test mbuf data and space for digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - catch_22_quote, QUOTE_512_BYTES, 0); - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = &ut_params->auth_xform; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = NULL; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC; - ut_params->auth_xform.auth.key.length = AES_XCBC_MAC_KEY_SZ; - ut_params->auth_xform.auth.key.data = aes_cbc_hmac_aes_xcbc_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_AES_XCBC; - - /* Create Crypto session*/ - ut_params->sess = rte_cryptodev_sym_session_create( - ts_params->valid_devs[0], - &ut_params->cipher_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - - /* Set operation cipher parameters */ - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( - sym_op->m_src, CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(sym_op->m_src); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Set operation authentication parameters */ - sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( - sym_op->m_src, DIGEST_BYTE_LENGTH_AES_XCBC); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - sym_op->m_src, - CIPHER_IV_LENGTH_AES_CBC + QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_AES_XCBC; - - memset(sym_op->auth.digest.data, 0, DIGEST_BYTE_LENGTH_AES_XCBC); - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; + rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, + CIPHER_IV_LENGTH_AES_CBC); + sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; + sym_op->cipher.data.length = QUOTE_512_BYTES; /* Process crypto operation */ - ut_params->op = process_crypto_request(ts_params->valid_devs[0], - ut_params->op); - TEST_ASSERT_NOT_NULL(ut_params->op, "failed to process sym crypto op"); + TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], + ut_params->op), "failed to process sym crypto op"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "crypto op processing failed"); /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src, - uint8_t *, CIPHER_IV_LENGTH_AES_CBC), + uint8_t *ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src, + uint8_t *, CIPHER_IV_LENGTH_AES_CBC); + + TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext, catch_22_quote_2_512_bytes_AES_CBC_ciphertext, QUOTE_512_BYTES, - "Ciphertext data not as expected"); + "ciphertext data not as expected"); - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod_offset( - ut_params->op->sym->m_src, uint8_t *, - CIPHER_IV_LENGTH_AES_CBC + - QUOTE_512_BYTES), - catch_22_quote_2_512_bytes_HMAC_AES_XCBC_digest, - DIGEST_BYTE_LENGTH_AES_XCBC, + uint8_t *digest = ciphertext + QUOTE_512_BYTES; + + TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, + catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, + gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD ? + TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 : + DIGEST_BYTE_LENGTH_SHA1, "Generated digest data not as expected"); return TEST_SUCCESS; } +/* ***** AES-CBC / HMAC-SHA512 Hash Tests ***** */ + +#define HMAC_KEY_LENGTH_SHA512 (DIGEST_BYTE_LENGTH_SHA512) + +static uint8_t hmac_sha512_key[] = { + 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1, + 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA, + 0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76, + 0x9a, 0xaf, 0x88, 0x1b, 0xb6, 0x8f, 0xf8, 0x60, + 0xa2, 0x5a, 0x7f, 0x3f, 0xf4, 0x72, 0x70, 0xf1, + 0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0, + 0x47, 0x3a, 0x75, 0x61, 0x5C, 0xa2, 0x10, 0x76, + 0x9a, 0xaf, 0x77, 0x5b, 0xb6, 0x7f, 0xf7, 0x60 }; + +static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest[] = { + 0x5D, 0x54, 0x66, 0xC1, 0x6E, 0xBC, 0x04, 0xB8, + 0x46, 0xB8, 0x08, 0x6E, 0xE0, 0xF0, 0x43, 0x48, + 0x37, 0x96, 0x9C, 0xC6, 0x9C, 0xC2, 0x1E, 0xE8, + 0xF2, 0x0C, 0x0B, 0xEF, 0x86, 0xA2, 0xE3, 0x70, + 0x95, 0xC8, 0xB3, 0x06, 0x47, 0xA9, 0x90, 0xE8, + 0xA0, 0xC6, 0x72, 0x69, 0x05, 0xC0, 0x0D, 0x0E, + 0x21, 0x96, 0x65, 0x93, 0x74, 0x43, 0x2A, 0x1D, + 0x2E, 0xBF, 0xC2, 0xC2, 0xEE, 0xCC, 0x2F, 0x0A }; + + + static int -test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; +test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( + struct crypto_unittest_params *ut_params); - /* Generate test mbuf data and space for digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *)catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, 0); +static int +test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, + struct crypto_unittest_params *ut_params, + struct crypto_testsuite_params *ts_params); + + +static int +test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( + struct crypto_unittest_params *ut_params) +{ /* Setup Cipher Parameters */ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; @@ -2215,16 +966,33 @@ test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify(void) ut_params->auth_xform.next = &ut_params->cipher_xform; ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC; - ut_params->auth_xform.auth.key.length = AES_XCBC_MAC_KEY_SZ; - ut_params->auth_xform.auth.key.data = aes_cbc_hmac_aes_xcbc_key; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_AES_XCBC; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA512_HMAC; + ut_params->auth_xform.auth.key.data = hmac_sha512_key; + ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA512; + ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA512; - /* Create Crypto session*/ - ut_params->sess = - rte_cryptodev_sym_session_create(ts_params->valid_devs[0], - &ut_params->auth_xform); - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); + return TEST_SUCCESS; +} + + +static int +test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, + struct crypto_unittest_params *ut_params, + struct crypto_testsuite_params *ts_params) +{ + /* Generate test mbuf data and digest */ + ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, + (const char *) + catch_22_quote_2_512_bytes_AES_CBC_ciphertext, + QUOTE_512_BYTES, 0); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + DIGEST_BYTE_LENGTH_SHA512); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + rte_memcpy(ut_params->digest, + catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest, + DIGEST_BYTE_LENGTH_SHA512); /* Generate Crypto op data structure */ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, @@ -2232,34 +1000,25 @@ test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify(void) TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate symmetric crypto operation struct"); - /* Set crypto operation data parameters */ - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); + rte_crypto_op_attach_sym_session(ut_params->op, sess); struct rte_crypto_sym_op *sym_op = ut_params->op->sym; /* set crypto operation source mbuf */ sym_op->m_src = ut_params->ibuf; - - sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( - ut_params->ibuf, DIGEST_BYTE_LENGTH_AES_XCBC); - TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, - "no room to append digest"); - + sym_op->auth.digest.data = ut_params->digest; sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_AES_XCBC; - - rte_memcpy(sym_op->auth.digest.data, - catch_22_quote_2_512_bytes_HMAC_AES_XCBC_digest, - DIGEST_BYTE_LENGTH_AES_XCBC); + sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA512; sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; sym_op->auth.data.length = QUOTE_512_BYTES; sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( ut_params->ibuf, CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->ibuf, 0); sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, @@ -2282,14 +1041,45 @@ test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify(void) rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + CIPHER_IV_LENGTH_AES_CBC, catch_22_quote, QUOTE_512_BYTES, - "Ciphertext data not as expected"); + "Plaintext data not as expected"); + /* Validate obuf */ TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "Digest verification failed"); return TEST_SUCCESS; } +static int +test_AES_mb_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_AES_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, ts_params->valid_devs[0], + RTE_CRYPTODEV_AESNI_MB_PMD); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_AES_qat_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_AES_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, ts_params->valid_devs[0], + RTE_CRYPTODEV_QAT_SYM_PMD); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + /* ***** Snow3G Tests ***** */ static int create_snow3g_hash_session(uint8_t dev_id, @@ -4046,92 +2836,6 @@ test_multi_session(void) } static int -test_not_in_place_crypto(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - struct rte_mbuf *dst_m = rte_pktmbuf_alloc(ts_params->mbuf_pool); - - test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(ut_params); - - /* Create multiple crypto sessions*/ - - ut_params->sess = rte_cryptodev_sym_session_create( - ts_params->valid_devs[0], &ut_params->auth_xform); - - TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); - - - /* Generate test mbuf data and digest */ - ut_params->ibuf = setup_test_string(ts_params->mbuf_pool, - (const char *) - catch_22_quote_2_512_bytes_AES_CBC_ciphertext, - QUOTE_512_BYTES, 0); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - DIGEST_BYTE_LENGTH_SHA512); - TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - - rte_memcpy(ut_params->digest, - catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest, - DIGEST_BYTE_LENGTH_SHA512); - - /* Generate Crypto op data structure */ - ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(ut_params->op, - "Failed to allocate symmetric crypto operation struct"); - - - /* Set crypto operation data parameters */ - rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); - - struct rte_crypto_sym_op *sym_op = ut_params->op->sym; - - /* set crypto operation source mbuf */ - sym_op->m_src = ut_params->ibuf; - sym_op->m_dst = dst_m; - - sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, QUOTE_512_BYTES); - sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA512; - - sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->auth.data.length = QUOTE_512_BYTES; - - - sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( - ut_params->ibuf, CIPHER_IV_LENGTH_AES_CBC); - sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, 0); - sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, - CIPHER_IV_LENGTH_AES_CBC); - - sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; - sym_op->cipher.data.length = QUOTE_512_BYTES; - - /* Process crypto operation */ - ut_params->op = process_crypto_request(ts_params->valid_devs[0], - ut_params->op); - TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned"); - - TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "crypto operation processing failed"); - - /* Validate obuf */ - TEST_ASSERT_BUFFERS_ARE_EQUAL( - rte_pktmbuf_mtod(ut_params->op->sym->m_dst, char *), - catch_22_quote, - QUOTE_512_BYTES, - "Plaintext data not as expected"); - - return TEST_SUCCESS; -} - -static int test_null_cipher_only_operation(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -4501,43 +3205,7 @@ static struct unit_test_suite cryptodev_qat_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_encrypt_digest_oop), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_decrypt_digest_oop_ver), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA256_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA256_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA512_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA512_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_encrypt_digest_case_1), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_encrypt_digest_case_2), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_encrypt_digest_case_3), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_digest_verify_decrypt_case_1), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_digest_verify_decrypt_case_2), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_digest_verify_decrypt_case_3), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_AES_XCBC_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify), + TEST_CASE_ST(ut_setup, ut_teardown, test_AES_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_stats), /** AES GCM Authenticated Encryption */ @@ -4625,44 +3293,7 @@ static struct unit_test_suite cryptodev_aesni_mb_testsuite = { .setup = testsuite_setup, .teardown = testsuite_teardown, .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA256_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA256_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA512_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA512_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_AES_XCBC_encrypt_digest), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CBC_HMAC_SHA1_encrypt_digest_sessionless), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_encrypt_digest_case_1), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_encrypt_digest_case_2), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_encrypt_digest_case_3), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_digest_verify_decrypt_case_1), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_digest_verify_decrypt_case_2), - TEST_CASE_ST(ut_setup, ut_teardown, - test_AES_CTR_digest_verify_decrypt_case_3), - - TEST_CASE_ST(ut_setup, ut_teardown, - test_not_in_place_crypto), + TEST_CASE_ST(ut_setup, ut_teardown, test_AES_mb_all), TEST_CASES_END() /**< NULL terminate unit test array */ } diff --git a/app/test/test_cryptodev_aes_ctr_test_vectors.h b/app/test/test_cryptodev_aes_ctr_test_vectors.h deleted file mode 100644 index 9ec5fbc..0000000 --- a/app/test/test_cryptodev_aes_ctr_test_vectors.h +++ /dev/null @@ -1,257 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TEST_CRYPTODEV_AES_CTR_TEST_VECTORS_H_ -#define TEST_CRYPTODEV_AES_CTR_TEST_VECTORS_H_ - -struct aes_ctr_test_data { - - struct { - uint8_t data[64]; - unsigned len; - } key; - - struct { - uint8_t data[64] __rte_aligned(16); - unsigned len; - } iv; - - struct { - uint8_t data[1024]; - unsigned len; - } plaintext; - - struct { - uint8_t data[1024]; - unsigned len; - } ciphertext; - - struct { - enum rte_crypto_auth_algorithm algo; - uint8_t data[64]; - unsigned len; - } auth_key; - - struct { - uint8_t data[1024]; - unsigned len; - } digest; -}; - -/* CTR-AES128-Encrypt-SHA1 test vector */ - -static const struct aes_ctr_test_data aes_ctr_test_case_1 = { - .key = { - .data = { - 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, - 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C - }, - .len = 16 - }, - .iv = { - .data = { - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF - }, - .len = 16 - }, - .plaintext = { - .data = { - 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, - 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A, - 0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C, - 0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51, - 0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11, - 0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF, - 0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17, - 0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10 - }, - .len = 64 - }, - .ciphertext = { - .data = { - 0x87, 0x4D, 0x61, 0x91, 0xB6, 0x20, 0xE3, 0x26, - 0x1B, 0xEF, 0x68, 0x64, 0x99, 0x0D, 0xB6, 0xCE, - 0x98, 0x06, 0xF6, 0x6B, 0x79, 0x70, 0xFD, 0xFF, - 0x86, 0x17, 0x18, 0x7B, 0xB9, 0xFF, 0xFD, 0xFF, - 0x5A, 0xE4, 0xDF, 0x3E, 0xDB, 0xD5, 0xD3, 0x5E, - 0x5B, 0x4F, 0x09, 0x02, 0x0D, 0xB0, 0x3E, 0xAB, - 0x1E, 0x03, 0x1D, 0xDA, 0x2F, 0xBE, 0x03, 0xD1, - 0x79, 0x21, 0x70, 0xA0, 0xF3, 0x00, 0x9C, 0xEE - }, - .len = 64 - }, - .auth_key = { - .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, - .data = { - 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, - 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, - 0xDE, 0xF4, 0xDE, 0xAD - }, - .len = 20 - }, - .digest = { - .data = { - 0x9B, 0x6F, 0x0C, 0x43, 0xF5, 0xC1, 0x3E, 0xB0, - 0xB1, 0x70, 0xB8, 0x2B, 0x33, 0x09, 0xD2, 0xB2, - 0x56, 0x20, 0xFB, 0xFE - }, - /* Limitation of Multi-buffer library */ - .len = TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 - } -}; - -/** AES-192-XCBC Encrypt test vector */ - -static const struct aes_ctr_test_data aes_ctr_test_case_2 = { - .key = { - .data = { - 0xCB, 0xC5, 0xED, 0x5B, 0xE7, 0x7C, 0xBD, 0x8C, - 0x50, 0xD9, 0x30, 0xF2, 0xB5, 0x6A, 0x0E, 0x5F, - 0xAA, 0xAE, 0xAD, 0xA2, 0x1F, 0x49, 0x52, 0xD4 - }, - .len = 24 - }, - .iv = { - .data = { - 0x3F, 0x69, 0xA8, 0xCD, 0xE8, 0xF0, 0xEF, 0x40, - 0xB8, 0x7A, 0x4B, 0xED, 0x2B, 0xAF, 0xBF, 0x57 - }, - .len = 16 - }, - .plaintext = { - .data = { - 0x01, 0x0F, 0x10, 0x1F, 0x20, 0x1C, 0x0E, 0xB8, - 0xFB, 0x5C, 0xCD, 0xCC, 0x1F, 0xF9, 0xAF, 0x0B, - 0x95, 0x03, 0x74, 0x99, 0x49, 0xE7, 0x62, 0x55, - 0xDA, 0xEA, 0x13, 0x20, 0x1D, 0xC6, 0xCC, 0xCC, - 0xD1, 0x70, 0x75, 0x47, 0x02, 0x2F, 0xFB, 0x86, - 0xBB, 0x6B, 0x23, 0xD2, 0xC9, 0x74, 0xD7, 0x7B, - 0x08, 0x03, 0x3B, 0x79, 0x39, 0xBB, 0x91, 0x29, - 0xDA, 0x14, 0x39, 0x8D, 0xFF, 0x81, 0x50, 0x96, - }, - .len = 64 - }, - .ciphertext = { - .data = { - 0x4A, 0x6C, 0xC8, 0xCC, 0x96, 0x2A, 0x13, 0x84, - 0x1C, 0x36, 0x88, 0xE9, 0xE5, 0x94, 0x70, 0xB2, - 0x14, 0x5B, 0x13, 0x80, 0xEA, 0xD8, 0x8D, 0x37, - 0xFD, 0x70, 0xA8, 0x83, 0xE8, 0x2B, 0x88, 0x1E, - 0xBA, 0x94, 0x3F, 0xF6, 0xB3, 0x1F, 0xDE, 0x34, - 0xF3, 0x5B, 0x80, 0xE9, 0xAB, 0xF5, 0x1C, 0x29, - 0xB6, 0xD9, 0x76, 0x2B, 0x06, 0xC6, 0x74, 0xF1, - 0x59, 0x5E, 0x9E, 0xA5, 0x7B, 0x2D, 0xD7, 0xF0 - }, - .len = 64 - }, - .auth_key = { - .algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC, - .data = { - 0x87, 0x61, 0x54, 0x53, 0xC4, 0x6D, 0xDD, 0x51, - 0xE1, 0x9F, 0x86, 0x64, 0x39, 0x0A, 0xE6, 0x59 - }, - .len = 16 - }, - .digest = { - .data = { - 0xCA, 0x33, 0xB3, 0x3B, 0x16, 0x94, 0xAA, 0x55, - 0x36, 0x6B, 0x45, 0x46 - }, - .len = TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 - } -}; - -/* CTR-AES256-Encrypt-SHA1 test vector */ - -static const struct aes_ctr_test_data aes_ctr_test_case_3 = { - .key = { - .data = { - 0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE, - 0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81, - 0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7, - 0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4 - }, - .len = 32 - }, - .iv = { - .data = { - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF - }, - .len = 16 - }, - .plaintext = { - .data = { - 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, - 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A, - 0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C, - 0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51, - 0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11, - 0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF, - 0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17, - 0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10 - }, - .len = 64 - }, - .ciphertext = { - .data = { - 0x60, 0x1E, 0xC3, 0x13, 0x77, 0x57, 0x89, 0xA5, - 0xB7, 0xA7, 0xF5, 0x04, 0xBB, 0xF3, 0xD2, 0x28, - 0xF4, 0x43, 0xE3, 0xCA, 0x4D, 0x62, 0xB5, 0x9A, - 0xCA, 0x84, 0xE9, 0x90, 0xCA, 0xCA, 0xF5, 0xC5, - 0x2B, 0x09, 0x30, 0xDA, 0xA2, 0x3D, 0xE9, 0x4C, - 0xE8, 0x70, 0x17, 0xBA, 0x2D, 0x84, 0x98, 0x8D, - 0xDF, 0xC9, 0xC5, 0x8D, 0xB6, 0x7A, 0xAD, 0xA6, - 0x13, 0xC2, 0xDD, 0x08, 0x45, 0x79, 0x41, 0xA6 - }, - .len = 64 - }, - .auth_key = { - .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, - .data = { - 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, - 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, - 0xDE, 0xF4, 0xDE, 0xAD - }, - .len = 20 - }, - .digest = { - .data = { - 0x3B, 0x1A, 0x9D, 0x82, 0x35, 0xD5, 0xDD, 0x64, - 0xCC, 0x1B, 0xA9, 0xC0, 0xEB, 0xE9, 0x42, 0x16, - 0xE7, 0x87, 0xA3, 0xEF - }, - .len = TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 - } -}; -#endif /* TEST_CRYPTODEV_AES_CTR_TEST_VECTORS_H_ */ -- 2.5.5