From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 039518E94 for ; Sat, 3 Oct 2015 00:54:26 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 02 Oct 2015 15:54:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,625,1437462000"; d="scan'208";a="783186152" Received: from unknown (HELO dwdohert-dpdk-fedora-20.ir.intel.com) ([163.33.213.96]) by orsmga001.jf.intel.com with ESMTP; 02 Oct 2015 15:54:24 -0700 From: Declan Doherty To: dev@dpdk.org Date: Sat, 3 Oct 2015 00:01:06 +0100 Message-Id: <1443826867-21004-6-git-send-email-declan.doherty@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443826867-21004-1-git-send-email-declan.doherty@intel.com> References: <1443826867-21004-1-git-send-email-declan.doherty@intel.com> Subject: [dpdk-dev] [PATCH 5/6] app/test: add cryptodev unit and performance tests 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: Fri, 02 Oct 2015 22:54:38 -0000 Co-authored-by: Des O Dea Co-authored-by: John Griffin Co-authored-by: Fiona Trahe unit tests are run by using cryptodev_qat_autotest or cryptodev_aesni_autotest from the test apps interactive console. performance tests are run by using the cryptodev_qat_perftest or cryptodev_aesni_mb_perftest command from the test apps interactive console. If you which to run the tests on a QAT device there must be one bound to igb_uio kernel driver. Signed-off-by: Declan Doherty --- app/test/Makefile | 3 + app/test/test.c | 92 +- app/test/test.h | 34 +- app/test/test_cryptodev.c | 1993 ++++++++++++++++++++++++++++++++++++ app/test/test_cryptodev.h | 68 ++ app/test/test_cryptodev_perf.c | 1415 +++++++++++++++++++++++++ app/test/test_link_bonding.c | 6 +- app/test/test_link_bonding_mode4.c | 7 +- 8 files changed, 3573 insertions(+), 45 deletions(-) create mode 100644 app/test/test_cryptodev.c create mode 100644 app/test/test_cryptodev.h create mode 100644 app/test/test_cryptodev_perf.c diff --git a/app/test/Makefile b/app/test/Makefile index 294618f..b7de576 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -140,6 +140,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_mode4.c endif +SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c +SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c + SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c diff --git a/app/test/test.c b/app/test/test.c index e8992f4..e58f266 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -159,51 +159,81 @@ main(int argc, char **argv) int unit_test_suite_runner(struct unit_test_suite *suite) { - int retval, i = 0; + int test_success; + unsigned total = 0, executed = 0, skipped = 0, succeeded = 0, failed = 0; if (suite->suite_name) - printf("Test Suite : %s\n", suite->suite_name); + printf(" + ------------------------------------------------------- +\n"); + printf(" + Test Suite : %s\n", suite->suite_name); if (suite->setup) if (suite->setup() != 0) - return -1; - - while (suite->unit_test_cases[i].testcase) { - /* Run test case setup */ - if (suite->unit_test_cases[i].setup) { - retval = suite->unit_test_cases[i].setup(); - if (retval != 0) - return retval; - } + goto suite_summary; - /* Run test case */ - if (suite->unit_test_cases[i].testcase() == 0) { - printf("TestCase %2d: %s\n", i, - suite->unit_test_cases[i].success_msg ? - suite->unit_test_cases[i].success_msg : - "passed"); - } - else { - printf("TestCase %2d: %s\n", i, suite->unit_test_cases[i].fail_msg ? - suite->unit_test_cases[i].fail_msg : - "failed"); - return -1; + printf(" + ------------------------------------------------------- +\n"); + + while (suite->unit_test_cases[total].testcase) { + if (!suite->unit_test_cases[total].enabled) { + skipped++; + total++; + continue; + } else { + executed++; } - /* Run test case teardown */ - if (suite->unit_test_cases[i].teardown) { - retval = suite->unit_test_cases[i].teardown(); - if (retval != 0) - return retval; + /* run test case setup */ + if (suite->unit_test_cases[total].setup) + test_success = suite->unit_test_cases[total].setup(); + else + test_success = TEST_SUCCESS; + + if (test_success == TEST_SUCCESS) { + /* run the test case */ + test_success = suite->unit_test_cases[total].testcase(); + if (test_success == TEST_SUCCESS) + succeeded++; + else + failed++; + } else { + failed++; } - i++; + /* run the test case teardown */ + if (suite->unit_test_cases[total].teardown) + suite->unit_test_cases[total].teardown(); + + if (test_success == TEST_SUCCESS) + printf(" + TestCase [%2d] : %s\n", total, + suite->unit_test_cases[total].success_msg ? + suite->unit_test_cases[total].success_msg : + "passed"); + else + printf(" + TestCase [%2d] : %s\n", total, + suite->unit_test_cases[total].fail_msg ? + suite->unit_test_cases[total].fail_msg : + "failed"); + + total++; } /* Run test suite teardown */ if (suite->teardown) - if (suite->teardown() != 0) - return -1; + suite->teardown(); + + goto suite_summary; + +suite_summary: + printf(" + ------------------------------------------------------- +\n"); + printf(" + Test Suite Summary \n"); + printf(" + Tests Total : %2d\n", total); + printf(" + Tests Skipped : %2d\n", skipped); + printf(" + Tests Executed : %2d\n", executed); + printf(" + Tests Passed : %2d\n", succeeded); + printf(" + Tests Failed : %2d\n", failed); + printf(" + ------------------------------------------------------- +\n"); + + if (failed) + return -1; return 0; } diff --git a/app/test/test.h b/app/test/test.h index 62eb51d..a2fba60 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -33,7 +33,7 @@ #ifndef _TEST_H_ #define _TEST_H_ - +#include #include #define TEST_SUCCESS (0) @@ -64,6 +64,17 @@ } \ } while (0) + +#define TEST_ASSERT_BUFFERS_ARE_EQUAL(a, b, len, msg, ...) do { \ + if (memcmp(a, b, len)) { \ + printf("TestCase %s() line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ + return TEST_FAILED; \ + } \ +} while (0) + + #define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ if (!(a != b)) { \ printf("TestCase %s() line %d failed: " \ @@ -113,27 +124,36 @@ struct unit_test_case { int (*setup)(void); - int (*teardown)(void); + void (*teardown)(void); int (*testcase)(void); const char *success_msg; const char *fail_msg; + unsigned enabled; }; -#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed"} +#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed", 1 } #define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name " succeeded", \ - name " failed"} + name " failed", 1 } #define TEST_CASE_ST(setup, teardown, testcase) \ { setup, teardown, testcase, #testcase " succeeded", \ - #testcase " failed "} + #testcase " failed ", 1 } + + +#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, #fn " succeeded", \ + #fn " failed", 0 } + +#define TEST_CASE_ST_DISABLED(setup, teardown, testcase) \ + { setup, teardown, testcase, #testcase " succeeded", \ + #testcase " failed ", 0 } -#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL } +#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0 } struct unit_test_suite { const char *suite_name; int (*setup)(void); - int (*teardown)(void); + void (*teardown)(void); struct unit_test_case unit_test_cases[]; }; diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c new file mode 100644 index 0000000..7a181d0 --- /dev/null +++ b/app/test/test_cryptodev.c @@ -0,0 +1,1993 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2015 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. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "test.h" +#include "test_cryptodev.h" + +static enum rte_cryptodev_type gbl_cryptodev_type; + +struct crypto_testsuite_params { + struct rte_mempool *mbuf_pool; + struct rte_mempool *crypto_op_pool; + struct rte_cryptodev_config conf; + struct rte_cryptodev_qp_conf qp_conf; + + uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS]; + uint8_t valid_dev_count; +}; + +struct crypto_unittest_params { + struct rte_crypto_xform cipher_xform; + struct rte_crypto_xform auth_xform; + + struct rte_cryptodev_session *sess; + + struct rte_crypto_op_data *op; + + struct rte_mbuf *obuf, *ibuf; + + uint8_t *digest; +}; + +/* + * Forward declarations. + */ +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_session *sess, + struct crypto_unittest_params *ut_params, + struct crypto_testsuite_params *ts_param); + +static struct rte_mbuf * +setup_test_string(struct rte_mempool *mpool, + const char *string, size_t len, uint8_t blocksize) +{ + struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); + size_t t_len = len - (blocksize ? (len % blocksize) : 0); + + if (m) { + char *dst = rte_pktmbuf_append(m, t_len); + + if (!dst) { + rte_pktmbuf_free(m); + return NULL; + } + + rte_memcpy(dst, string, t_len); + } + + return m; +} + +#if HEX_DUMP +static void +hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) +{ + rte_hexdump(f, title, rte_pktmbuf_mtod(m, const void *), m->data_len); +} +#endif + +static struct rte_mbuf * +process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) +{ + struct rte_mbuf *obuf = NULL; +#if HEX_DUMP + hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); +#endif + + if (rte_cryptodev_enqueue_burst(dev_id, 0, &ibuf, 1) != 1) { + printf("Error sending packet for encryption"); + return NULL; + } + while (rte_cryptodev_dequeue_burst(dev_id, 0, &obuf, 1) == 0) + rte_pause(); + +#if HEX_DUMP + if (obuf) + hexdump_mbuf_data(stdout, "Dequeued Packet", obuf); +#endif + + return obuf; +} + +static struct crypto_testsuite_params testsuite_params = { NULL }; +static struct crypto_unittest_params unittest_params; + +static void +free_testsuite_mbufs(void) +{ + struct crypto_unittest_params *ut_params = &unittest_params; + /* free mbuf - both obuf and ibuf are usually the same, + * but rte copes even if we call free twice */ + if (ut_params->obuf) { + rte_pktmbuf_free(ut_params->obuf); + ut_params->obuf = 0; + } + if (ut_params->ibuf) { + rte_pktmbuf_free(ut_params->ibuf); + ut_params->ibuf = 0; + } +} + +static int +testsuite_setup(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_info info; + unsigned i, nb_devs, dev_id = 0; + uint16_t qp_id; + + memset(ts_params, 0, sizeof(*ts_params)); + + ts_params->mbuf_pool = rte_mempool_lookup("CRYPTO_MBUFPOOL"); + if (ts_params->mbuf_pool == NULL) { + /* Not already created so create */ + ts_params->mbuf_pool = rte_pktmbuf_pool_create("CRYPTO_MBUFPOOL", + NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, + rte_socket_id()); + if (ts_params->mbuf_pool == NULL) { + RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n"); + return TEST_FAILED; + } + } + + ts_params->crypto_op_pool = rte_crypto_op_pool_create("CRYPTO_OP_POOL", + NUM_MBUFS, MBUF_CACHE_SIZE, DEFAULT_NUM_XFORMS, rte_socket_id()); + if (ts_params->crypto_op_pool == NULL) { + RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); + return TEST_FAILED; + } + + /* Create 2 AESNI MB devices if required */ + if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD) { + nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD); + if (nb_devs < 2) { + for (i = nb_devs; i < 2; i++) { + int dev_id = rte_eal_vdev_init( + CRYPTODEV_NAME_AESNI_MB_PMD, NULL); + + TEST_ASSERT(dev_id >= 0, + "Failed to create instance %u of pmd : %s", + i, CRYPTODEV_NAME_AESNI_MB_PMD); + } + } + } + + nb_devs = rte_cryptodev_count(); + if (nb_devs < 1) { + RTE_LOG(ERR, USER1, "No crypto devices found?"); + return TEST_FAILED; + } + + /* Create list of valid crypto devs */ + for (i = 0; i < nb_devs; i++) { + rte_cryptodev_info_get(i, &info); + if (info.dev_type == gbl_cryptodev_type) { + ts_params->valid_devs[ts_params->valid_dev_count++] = i; + } + } + + if (ts_params->valid_dev_count < 1) + return TEST_FAILED; + + /* Set up all the qps on the first of the valid devices found */ + for (i = 0; i < 1; i++) { + dev_id = ts_params->valid_devs[i]; + + /* Since we can't free and re-allocate queue memory always set the + * queues on this device up to max size first so enough memory is + * allocated for any later re-configures needed by other tests */ + + ts_params->conf.nb_queue_pairs = MAX_NUM_QPS_PER_QAT_DEVICE; + ts_params->conf.socket_id = SOCKET_ID_ANY; + ts_params->conf.session_mp.nb_objs = + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + RTE_LIBRTE_PMD_QAT_MAX_SESSIONS : + RTE_LIBRTE_PMD_AESNI_MB_MAX_SESSIONS; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, + &ts_params->conf), + "Failed to configure cryptodev %u with %u qps", + dev_id, ts_params->conf.nb_queue_pairs); + + ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; + + for (qp_id = 0; qp_id < MAX_NUM_QPS_PER_QAT_DEVICE; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + dev_id, qp_id, &ts_params->qp_conf, + rte_cryptodev_socket_id(dev_id)), + "Failed to setup queue pair %u on cryptodev %u", + qp_id, dev_id); + } + } + + return TEST_SUCCESS; +} + +static void +testsuite_teardown(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + + if (ts_params->mbuf_pool != NULL) { + RTE_LOG(DEBUG, USER1, "CRYPTO_MBUFPOOL count %u\n", + rte_mempool_count(ts_params->mbuf_pool)); + } + + + if (ts_params->crypto_op_pool != NULL) { + RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n", + rte_mempool_count(ts_params->crypto_op_pool)); + } + +} + +static int +ut_setup(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + + uint16_t qp_id; + + /* Clear unit test parameters before running test */ + memset(ut_params, 0, sizeof(*ut_params)); + + /* Reconfigure device to default parameters */ + ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; + ts_params->conf.socket_id = SOCKET_ID_ANY; + ts_params->conf.session_mp.nb_objs = + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + DEFAULT_NUM_OPS_INFLIGHT : + DEFAULT_NUM_OPS_INFLIGHT; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], + &ts_params->conf), + "Failed to configure cryptodev %u", + ts_params->valid_devs[0]); + + /* Now reconfigure queues to size we actually want to use in this + * test suite. */ + ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, + &ts_params->qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed to setup queue pair %u on cryptodev %u", + qp_id, ts_params->valid_devs[0]); + } + + + rte_cryptodev_stats_reset(ts_params->valid_devs[0]); + + return TEST_SUCCESS; +} + +static void +ut_teardown(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + struct rte_cryptodev_stats stats; + + /* free crypto session structure */ + if (ut_params->sess) { + rte_cryptodev_session_free(ts_params->valid_devs[0], + ut_params->sess); + ut_params->sess = NULL; + } + + /* free crypto operation structure */ + if (ut_params->op) + rte_crypto_op_free(ut_params->op); + + /* just in case test didn't free mbufs */ + free_testsuite_mbufs(); + + if (ts_params->mbuf_pool != NULL) + RTE_LOG(DEBUG, USER1, "CRYPTO_MBUFPOOL count %u\n", + rte_mempool_count(ts_params->mbuf_pool)); + + rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats); + +} + +static int +test_device_configure_invalid_dev_id(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + uint16_t dev_id, num_devs = 0; + + TEST_ASSERT((num_devs = rte_cryptodev_count()) >= 1, + "Need at least %d devices for test", 1); + + /* valid dev_id values */ + dev_id = ts_params->valid_devs[ts_params->valid_dev_count -1]; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf), + "Failed test for rte_cryptodev_configure: " + "invalid dev_num %u", dev_id); + + /* invalid dev_id values */ + dev_id = num_devs; + + TEST_ASSERT_FAIL(rte_cryptodev_configure(dev_id, &ts_params->conf), + "Failed test for rte_cryptodev_configure: " + "invalid dev_num %u", dev_id); + + dev_id = 0xff; + + TEST_ASSERT_FAIL(rte_cryptodev_configure(dev_id, &ts_params->conf), + "Failed test for rte_cryptodev_configure:" + "invalid dev_num %u", dev_id); + + return TEST_SUCCESS; +} + +static int +test_device_configure_invalid_queue_pair_ids(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + + + /* valid - one queue pairs */ + ts_params->conf.nb_queue_pairs = 1; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], &ts_params->conf), + "Failed to configure cryptodev: dev_id %u, qp_id %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + + /* valid - max value queue pairs */ + ts_params->conf.nb_queue_pairs = MAX_NUM_QPS_PER_QAT_DEVICE; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], &ts_params->conf), + "Failed to configure cryptodev: dev_id %u, qp_id %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + + /* invalid - zero queue pairs */ + ts_params->conf.nb_queue_pairs = 0; + + TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0], &ts_params->conf), + "Failed test for rte_cryptodev_configure, dev_id %u, invalid qps: %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + + /* invalid - max value supported by field queue pairs */ + ts_params->conf.nb_queue_pairs = UINT16_MAX; + + TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0], &ts_params->conf), + "Failed test for rte_cryptodev_configure, dev_id %u, invalid qps: %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + + /* invalid - max value + 1 queue pairs */ + ts_params->conf.nb_queue_pairs = MAX_NUM_QPS_PER_QAT_DEVICE + 1; + + TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0], &ts_params->conf), + "Failed test for rte_cryptodev_configure, dev_id %u, invalid qps: %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + return TEST_SUCCESS; +} + +static int +test_queue_pair_descriptor_setup(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_qp_conf qp_conf = { + .nb_descriptors = MAX_NUM_OPS_INFLIGHT + }; + + uint16_t qp_id; + + ts_params->conf.session_mp.nb_objs = RTE_LIBRTE_PMD_QAT_MAX_SESSIONS; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], + &ts_params->conf), "Failed to configure cryptodev %u", + ts_params->valid_devs[0]); + + + /* Test various ring sizes on this device. memzones can't be + * freed so are re-used if ring is released and re-created. */ + qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/ + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed test for rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + qp_conf.nb_descriptors = (uint32_t)(MAX_NUM_OPS_INFLIGHT / 2); /* valid */ + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed test for rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; /* valid */ + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed test for rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + /* invalid number of descriptors - max supported + 2 */ + qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT + 2; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Unexpectedly passed test for " + "rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + /* invalid number of descriptors - max value of parameter */ + qp_conf.nb_descriptors = UINT32_MAX-1; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Unexpectedly passed test for " + "rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed test for rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + /* invalid number of descriptors - max supported + 1 */ + qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT + 1; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Unexpectedly passed test for " + "rte_cryptodev_queue_pair_setup:" + "num_inflights %u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + } + + /* test invalid queue pair id */ + qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; /*valid */ + + qp_id = DEFAULT_NUM_QPS_PER_QAT_DEVICE; /*invalid */ + + TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(ts_params->valid_devs[0], + qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed test for rte_cryptodev_queue_pair_setup:" + "invalid qp %u on cryptodev %u", + qp_id, ts_params->valid_devs[0]); + + qp_id = 0xffff; /*invalid*/ + + TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(ts_params->valid_devs[0], + qp_id, &qp_conf, + rte_cryptodev_socket_id(ts_params->valid_devs[0])), + "Failed test for rte_cryptodev_queue_pair_setup:" + "invalid qp %u on cryptodev %u", + qp_id, ts_params->valid_devs[0]); + + return TEST_SUCCESS; +} + +/* ***** Plaintext data for tests ***** */ + +const char catch_22_quote_1[] = + "There was only one catch and that was Catch-22, which " + "specified that a concern for one's safety in the face of " + "dangers that were real and immediate was the process of a " + "rational mind. Orr was crazy and could be grounded. All he " + "had to do was ask; and as soon as he did, he would no longer " + "be crazy and would have to fly more missions. Orr would be " + "crazy to fly more missions and sane if he didn't, but if he " + "was sane he had to fly them. If he flew them he was crazy " + "and didn't have to; but if he didn't want to he was sane and " + "had to. Yossarian was moved very deeply by the absolute " + "simplicity of this clause of Catch-22 and let out a " + "respectful whistle. \"That's some catch, that Catch-22\", he " + "observed. \"It's the best there is,\" Doc Daneeka agreed."; + +const char catch_22_quote[] = + "What a lousy earth! He wondered how many people were " + "destitute that same night even in his own prosperous country, " + "how many homes were shanties, how many husbands were drunk " + "and wives socked, and how many children were bullied, abused, " + "or abandoned. How many families hungered for food they could " + "not afford to buy? How many hearts were broken? How many " + "suicides would take place that same night, how many people " + "would go insane? How many cockroaches and landlords would " + "triumph? How many winners were losers, successes failures, " + "and rich men poor men? How many wise guys were stupid? How " + "many happy endings were unhappy endings? How many honest men " + "were liars, brave men cowards, loyal men traitors, how many " + "sainted men were corrupt, how many people in positions of " + "trust had sold their souls to bodyguards, how many had never " + "had souls? How many straight-and-narrow paths were crooked " + "paths? How many best families were worst families and how " + "many good people were bad people? When you added them all up " + "and then subtracted, you might be left with only the children, " + "and perhaps with Albert Einstein and an old violinist or " + "sculptor somewhere."; + +#define QUOTE_480_BYTES (480) +#define QUOTE_512_BYTES (512) +#define QUOTE_768_BYTES (768) +#define QUOTE_1024_BYTES (1024) + + + +/* ***** SHA1 Hash Tests ***** */ + +#define HMAC_KEY_LENGTH_SHA1 (DIGEST_BYTE_LENGTH_SHA1) + +static uint8_t hmac_sha1_key[] = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD }; + +static const uint8_t catch_22_480_bytes_SHA1_digest[] = { + 0xae, 0xd5, 0x60, 0x7e, 0xf5, 0x37, 0xe2, 0xf6, + 0x28, 0x68, 0x71, 0x91, 0xab, 0x3d, 0x34, 0xba, + 0x20, 0xb4, 0x57, 0x05 }; + +static const uint8_t catch_22_512_bytes_HMAC_SHA1_digest[] = { + 0xc5, 0x1a, 0x08, 0x57, 0x3e, 0x52, 0x59, 0x75, + 0xa5, 0x2b, 0xb9, 0xef, 0x66, 0xfc, 0xc3, 0x3b, + 0xf0, 0xa8, 0x46, 0xbd }; + +/* ***** SHA224 Hash Tests ***** */ + +#define HMAC_KEY_LENGTH_SHA224 (DIGEST_BYTE_LENGTH_SHA224) + +static const uint8_t catch_22_512_bytes_SHA244_digest[] = { + 0x35, 0x86, 0x49, 0x1e, 0xdb, 0xaa, 0x9b, 0x6e, + 0xab, 0x45, 0x19, 0xe0, 0x71, 0xae, 0xa6, 0x6b, + 0x62, 0x46, 0x72, 0x7b, 0x3d, 0x40, 0x78, 0x25, + 0x58, 0xde, 0xdf, 0xd0 }; + +static const uint8_t catch_22_512_bytes_HMAC_SHA244_digest[] = { + 0x5d, 0x4c, 0xba, 0xcc, 0x1f, 0x6e, 0x94, 0x19, + 0xb7, 0xe4, 0x2b, 0x5f, 0x20, 0x80, 0xc7, 0xb8, + 0x14, 0x8c, 0x6d, 0x66, 0xaa, 0xc7, 0x3d, 0x48, + 0x68, 0x0b, 0xe4, 0x85 }; + + +/* ***** AES-CBC Cipher Tests ***** */ + +#define CIPHER_KEY_LENGTH_AES_CBC (16) +#define CIPHER_IV_LENGTH_AES_CBC (CIPHER_KEY_LENGTH_AES_CBC) + +static uint8_t aes_cbc_key[] = { + 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2, + 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A }; + +static uint8_t aes_cbc_iv[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; + +static const uint8_t catch_22_quote_2_1Kb_AES_CBC_ciphertext[] = { + 0x8B, 0X4D, 0XDA, 0X1B, 0XCF, 0X04, 0XA0, 0X31, 0XB4, 0XBF, 0XBD, 0X68, 0X43, 0X20, 0X7E, 0X76, + 0XB1, 0X96, 0X8B, 0XA2, 0X7C, 0XA2, 0X83, 0X9E, 0X39, 0X5A, 0X2F, 0X7E, 0X92, 0XB4, 0X48, 0X1A, + 0X3F, 0X6B, 0X5D, 0XDF, 0X52, 0X85, 0X5F, 0X8E, 0X42, 0X3C, 0XFB, 0XE9,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 0X1F, 0XFE, 0X42, 0X0E, 0XE1, 0X58, 0X2B, 0X04, 0X11, 0XEB, 0X83, 0X74, 0X06, 0XC5, + 0XEF, 0X83, 0XA5, 0X40, 0XCB, 0X69, 0X18, 0X7E, 0XDB, 0X71, 0XBF, 0XC2, 0XFA, 0XEF, 0XF5, 0XB9, + 0X03, 0XF1, 0XF8, 0X78, 0X7F, 0X71, 0XE3, 0XBB, 0XDE, 0XF3, 0XC3, 0X03, 0X29, 0X9A, 0XBF, 0XD6, + 0XCD, 0XA7, 0X35, 0XD5, 0XE8, 0X88, 0XAE, 0X89, 0XCE, 0X4B, 0X93, 0X4E, 0X04, 0X02, 0X41, 0X86, + 0X7F, 0X4A, 0X96, 0X23, 0X19, 0X6D, 0XD1, 0X2C, 0X9C, 0X7A, 0X2C, 0X3B, 0XD6, 0X98, 0X7B, 0X4C +}; + + +/* ***** AES-CBC / HMAC-SHA1 Hash Tests ***** */ + +static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = { + 0x8B, 0X4D, 0XDA, 0X1B, 0XCF, 0X04, 0XA0, 0X31, 0XB4, 0XBF, 0XBD, 0X68, 0X43, 0X20, 0X7E, 0X76, + 0XB1, 0X96, 0X8B, 0XA2, 0X7C, 0XA2, 0X83, 0X9E, 0X39, 0X5A, 0X2F, 0X7E, 0X92, 0XB4, 0X48, 0X1A, + 0X3F, 0X6B, 0X5D, 0XDF, 0X52, 0X85, 0X5F, 0X8E, 0X42, 0X3C, 0XFB, 0XE9, 0X1A, 0X24, 0XD6, 0X08, + 0XDD, 0XFD, 0X16, 0XFB, 0XE9, 0X55, 0XEF, 0XF0, 0XA0, 0X8D, 0X13, 0XAB, 0X81, 0XC6, 0X90, 0X01, + 0XB5, 0X18, 0X84, 0XB3, 0XF6, 0XE6, 0X11, 0X57, 0XD6, 0X71, 0XC6, 0X3C, 0X3F, 0X2F, 0X33, 0XEE, + 0X24, 0X42, 0X6E, 0XAC, 0X0B, 0XCA, 0XEC, 0XF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4C, 0XEE, 0X98, 0XCB, 0X7C, 0X58, 0X7E, 0X20, 0X75, 0X1E, 0XB7, 0XC9, 0XF8, 0XF2, 0X0E, + 0X63, 0X9E, 0X05, 0X78, 0X1A, 0XB6, 0XA8, 0X7A, 0XF9, 0X98, 0X6A, 0XA6, 0X46, 0X84, 0X2E, 0XF6, + 0X4B, 0XDC, 0X9B, 0X8F, 0X9B, 0X8F, 0XEE, 0XB4, 0XAA, 0X3F, 0XEE, 0XC0, 0X37, 0X27, 0X76, 0XC7, + 0X95, 0XBB, 0X26, 0X74, 0X69, 0X12, 0X7F, 0XF1, 0XBB, 0XFF, 0XAE, 0XB5, 0X99, 0X6E, 0XCB, 0X0C +}; + +static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = { + 0x9a, 0X4f, 0X88, 0X1b, 0Xb6, 0X8f, 0Xd8, 0X60, + 0X42, 0X1a, 0X7d, 0X3d, 0Xf5, 0X82, 0X80, 0Xf1, + 0X18, 0X8c, 0X1d, 0X32 }; + + +static int +test_AES_CBC_HMAC_SHA1_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_SHA1); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset(ut_params->ibuf, + QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA1; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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"); + + free_testsuite_mbufs(); + 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_sessionless(ts_params->crypto_op_pool, 2); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + ut_params->op->xform->type = RTE_CRYPTO_XFORM_CIPHER; + + /* cipher parameters */ + ut_params->op->xform->cipher.op = RTE_CRYPTO_SYM_CIPHER_OP_ENCRYPT; + ut_params->op->xform->cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->op->xform->cipher.key.data = aes_cbc_key; + ut_params->op->xform->cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; + + /* hash parameters */ + ut_params->op->xform->next->type = RTE_CRYPTO_XFORM_AUTH; + + ut_params->op->xform->next->auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_GENERATE; + ut_params->op->xform->next->auth.algo = RTE_CRYPTO_SYM_HASH_SHA1_HMAC; + ut_params->op->xform->next->auth.key.length = HMAC_KEY_LENGTH_SHA1; + ut_params->op->xform->next->auth.key.data = hmac_sha1_key; + ut_params->op->xform->next->auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset(ut_params->ibuf, + QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA1; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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"); + + free_testsuite_mbufs(); + 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_XFORM_CIPHER; + ut_params->cipher_xform.next = NULL; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = &ut_params->cipher_xform; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_VERIFY; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->ibuf, QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA1; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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"); + + ut_params->op = ut_params->obuf->crypto_op; + TEST_ASSERT(!(ut_params->obuf->ol_flags & PKT_RX_CRYPTO_DIGEST_BAD), + "Digest verification failed"); + + free_testsuite_mbufs(); + return TEST_SUCCESS; +} + + +/* ***** 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_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->ibuf, QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA256; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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"); + + free_testsuite_mbufs(); + 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_XFORM_CIPHER; + ut_params->cipher_xform.next = NULL; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = &ut_params->cipher_xform; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_VERIFY; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->ibuf, QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA256; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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 */ + ut_params->op = ut_params->obuf->crypto_op; + + TEST_ASSERT(!(ut_params->obuf->ol_flags & PKT_RX_CRYPTO_DIGEST_BAD), + "Digest verification failed"); + + free_testsuite_mbufs(); + 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_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->ibuf, QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA512; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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"); + + free_testsuite_mbufs(); + 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_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_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_XFORM_CIPHER; + ut_params->cipher_xform.next = NULL; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = &ut_params->cipher_xform; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_VERIFY; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, sess); + + ut_params->op->digest.data = ut_params->digest; + ut_params->op->digest.phys_addr = rte_pktmbuf_mtophys_offset(ut_params->ibuf, QUOTE_512_BYTES); + ut_params->op->digest.length = DIGEST_BYTE_LENGTH_SHA512; + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys_offset(ut_params->ibuf, 0); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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 */ + ut_params->op = ut_params->obuf->crypto_op; + + TEST_ASSERT(!(ut_params->obuf->ol_flags & PKT_RX_CRYPTO_DIGEST_BAD), + "Digest verification failed"); + + /* + * Free crypto operation structure and buffers. + */ + if (ut_params->op) + { + rte_crypto_op_free(ut_params->op); + ut_params->op = NULL; + } + free_testsuite_mbufs(); + 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); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + DIGEST_BYTE_LENGTH_AES_XCBC); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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_HMAC_AES_XCBC_digest, + DIGEST_BYTE_LENGTH_AES_XCBC, + "Generated digest data not as expected"); + + /* + * Free crypto operation structure and buffers. + */ + if (ut_params->op) + { + rte_crypto_op_free(ut_params->op); + ut_params->op = NULL; + } + + free_testsuite_mbufs(); + return TEST_SUCCESS; +} + +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; + + /* 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); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + DIGEST_BYTE_LENGTH_AES_XCBC); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + rte_memcpy(ut_params->digest, + catch_22_quote_2_512_bytes_HMAC_AES_XCBC_digest, + DIGEST_BYTE_LENGTH_AES_XCBC); + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER; + ut_params->cipher_xform.next = NULL; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_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_XFORM_AUTH; + ut_params->auth_xform.next = &ut_params->cipher_xform; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_VERIFY; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_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->crypto_op_pool); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(ut_params->op->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* 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"); + + ut_params->op = ut_params->obuf->crypto_op; + TEST_ASSERT(!(ut_params->obuf->ol_flags & PKT_RX_CRYPTO_DIGEST_BAD), + "Digest verification failed"); + + /* + * Free crypto operation structure and buffers. + */ + if (ut_params->op) + { + rte_crypto_op_free(ut_params->op); + ut_params->op = NULL; + } + + free_testsuite_mbufs(); + return TEST_SUCCESS; +} + + +/* ***** AES-GCM Tests ***** */ + +#define CIPHER_KEY_LENGTH_AES_GCM 16 +#define AAD_LENGTH_AES_GCM 20 +#define AAD_LENGTH_AES_GCM_ROUNDUP 32 // Roundup to multiple of GCM block size(16) +#define CIPHER_IV_LENGTH_AES_GCM 16 +#define AUTH_TAG_LENGTH_AES_GCM 16 + +static uint8_t gcm_cipher_key[] = { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 +}; + +static uint8_t gcm_cipher_text[] = { + 0xCC, 0xDA, 0x4D, 0x93, 0xF9, 0x92, 0x52, 0xAD, 0x81, 0x5E, 0x5B, 0x0B, 0x0B, 0x40, 0x93, 0x74, + 0x11, 0x65, 0xA9, 0x5C, 0x71, 0x53, 0x73, 0x4D, 0x74, 0xE3, 0x2A, 0x7B, 0xD1, 0xF8, 0x4F, 0x7C, + 0x55, 0x86, 0x6F, 0x07, 0xAC, 0x6F, 0xF4, 0x36, 0x72, 0x30, 0x01, 0x11, 0x95, 0x4E, 0x7A, 0x00, + 0xDD, 0xAC, 0x94, 0xA9, 0xE0, 0x63, 0x2F, 0xB3, 0xF3, 0x52, 0xEF, 0xDD, 0x29, 0xF5, 0xAB, 0xA4, + 0xB5, 0xC9, 0x13, 0xE4, 0xBD, 0x93, 0xDC, 0x94, 0x98, 0xC7, 0x96, 0x2E, 0xA2, 0x54, 0xAB, 0x04, + 0x60, 0xBD, 0x9A, 0xD1, 0xAA, 0xA7, 0x07, 0x57, 0x4A, 0xA4, 0x78, 0x73, 0xB4, 0x1D, 0xC4, 0x11, + 0x82, 0x71, 0x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B, 0x76, 0xDA, 0xDE, 0x60, 0x4C, + 0x62, 0x49, 0x5D, 0xDE, 0x31, 0xCA, 0x87, 0xA7, 0xF7, 0x8B, 0x13, 0xE6, 0xB3, 0x5B, 0x8B, 0xC2, + 0xE2, 0x54, 0x05, 0x12, 0x92, 0x03, 0xD2, 0xAF, 0x3E, 0xB5, 0xE3, 0x9E, 0x26, 0x27, 0x8F, 0x35, + 0x62, 0xDC, 0xDC, 0xE2, 0x69, 0x61, 0x01, 0x0B, 0x30, 0x76, 0x50, 0x71, 0x90, 0x79, 0x8A, 0x46 +}; + +static uint8_t gcm_aad[] = { + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xab, 0xad, 0xda, 0xcc +}; + +static uint8_t gcm_iv[] = { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 +}; + +static uint8_t gcm_auth_tag[] = { + 0xDB, 0x54, 0xA0, 0x7E, 0x65, 0xF2, 0xEF, 0x84, + 0xF9, 0x16, 0xC0, 0xF9, 0xDE, 0x7F, 0xDE, 0xFE +}; + +static int test_AES_GCM(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, + AUTH_TAG_LENGTH_AES_GCM); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_GCM; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_CIPHER_OP_ENCRYPT; + ut_params->cipher_xform.cipher.key.data = gcm_cipher_key; + ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_GCM; + + /* Setup HMAC Parameters */ + ut_params->auth_xform.type = RTE_CRYPTO_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_AES_GCM; + ut_params->auth_xform.auth.digest_length = AUTH_TAG_LENGTH_AES_GCM; + ut_params->auth_xform.auth.add_auth_data_length = AAD_LENGTH_AES_GCM; + ut_params->auth_xform.auth.key.length = 0; + ut_params->auth_xform.auth.key.data = NULL; + + /* Create Crypto session*/ + ut_params->sess = rte_cryptodev_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->crypto_op_pool); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate crypto_op"); + + /* Set crypto operation data parameters */ + rte_crypto_op_attach_session(ut_params->op, ut_params->sess); + + /* iv */ + ut_params->op->iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_GCM); + TEST_ASSERT_NOT_NULL(ut_params->op->iv.data, "no room to prepend iv"); + ut_params->op->iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + ut_params->op->iv.length = CIPHER_IV_LENGTH_AES_GCM; + + /* aad */ + ut_params->op->additional_auth.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + AAD_LENGTH_AES_GCM_ROUNDUP ); + TEST_ASSERT_NOT_NULL(ut_params->op->additional_auth.data, "no room to prepend aad"); + ut_params->op->additional_auth.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + rte_memcpy(ut_params->op->additional_auth.data, gcm_aad, AAD_LENGTH_AES_GCM); + + + /* CalcY0 TODO: Add for ivLen = 16 */ + if (sizeof(gcm_iv) == 12) { + memset(ut_params->op->iv.data, 0, CIPHER_IV_LENGTH_AES_GCM); + rte_memcpy(ut_params->op->iv.data, gcm_iv, sizeof(gcm_iv)); + ut_params->op->iv.data[15] = 1; + } + + ut_params->op->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_GCM + AAD_LENGTH_AES_GCM_ROUNDUP; + ut_params->op->data.to_cipher.length = QUOTE_512_BYTES; + ut_params->op->data.to_hash.offset = CIPHER_IV_LENGTH_AES_GCM + AAD_LENGTH_AES_GCM_ROUNDUP; + ut_params->op->data.to_hash.length = QUOTE_512_BYTES; + rte_pktmbuf_attach_crypto_op(ut_params->ibuf, ut_params->op); + + /* Process crypto operation */ + ut_params->obuf = process_crypto_request(ts_params->valid_devs[0], + ut_params->ibuf); + TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf"); + + /* Validate obuf */ + TEST_ASSERT_BUFFERS_ARE_EQUAL( + rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + + CIPHER_IV_LENGTH_AES_GCM + AAD_LENGTH_AES_GCM_ROUNDUP, + gcm_cipher_text, + QUOTE_512_BYTES, + "GCM Ciphertext data not as expected"); + + TEST_ASSERT_BUFFERS_ARE_EQUAL( + rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + + CIPHER_IV_LENGTH_AES_GCM + AAD_LENGTH_AES_GCM_ROUNDUP + QUOTE_512_BYTES, + gcm_auth_tag, + AUTH_TAG_LENGTH_AES_GCM, + "GCM Generated auth tag not as expected"); + + /* + * Free crypto operation structure and buffers. + */ + if (ut_params->op) + { + rte_crypto_op_free(ut_params->op); + ut_params->op = NULL; + } + + free_testsuite_mbufs(); + return TEST_SUCCESS; +} + + +static int +test_stats(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_stats stats; + struct rte_cryptodev *dev; + cryptodev_stats_get_t temp_pfn; + + rte_cryptodev_stats_reset(ts_params->valid_devs[0]); + TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0] + 600, &stats) == -ENODEV), + "rte_cryptodev_stats_get invalid dev failed"); + TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], 0) != 0), + "rte_cryptodev_stats_get invalid Param failed"); + dev = &rte_crypto_devices[ts_params->valid_devs[0]]; + temp_pfn = dev->dev_ops->stats_get; + dev->dev_ops->stats_get = (cryptodev_stats_get_t)0; + TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats) == -ENOTSUP), + "rte_cryptodev_stats_get invalid Param failed"); + dev->dev_ops->stats_get = temp_pfn; + + /* Test expected values */ + ut_setup(); + test_AES_CBC_HMAC_SHA1_encrypt_digest(); + ut_teardown(); + TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats), + "rte_cryptodev_stats_get failed"); + TEST_ASSERT((stats.enqueued_count == 1), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + TEST_ASSERT((stats.dequeued_count == 1), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + TEST_ASSERT((stats.enqueue_err_count == 0), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + TEST_ASSERT((stats.dequeue_err_count == 0), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + + /* invalid device but should ignore and not reset device stats*/ + rte_cryptodev_stats_reset(ts_params->valid_devs[0] + 300); + TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats), + "rte_cryptodev_stats_get failed"); + TEST_ASSERT((stats.enqueued_count == 1), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + + /* check that a valid reset clears stats */ + rte_cryptodev_stats_reset(ts_params->valid_devs[0]); + TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats), + "rte_cryptodev_stats_get failed"); + TEST_ASSERT((stats.enqueued_count == 0), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + TEST_ASSERT((stats.dequeued_count == 0), + "rte_cryptodev_stats_get returned unexpected enqueued stat"); + + return TEST_SUCCESS; +} + + +static int +test_multi_session(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + unsigned nb_sessions = gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD ? + RTE_LIBRTE_PMD_QAT_MAX_SESSIONS : + RTE_LIBRTE_PMD_AESNI_MB_MAX_SESSIONS; + struct rte_cryptodev_session *sessions[nb_sessions + 1]; + uint16_t i; + + test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(ut_params); + + /* Create multiple crypto sessions*/ + for (i = 0; i < nb_sessions; i++) { + sessions[i] = rte_cryptodev_session_create(ts_params->valid_devs[0], + &ut_params->auth_xform); + TEST_ASSERT_NOT_NULL(sessions[i], "Session creation failed at session number %u", i); + + /* Attempt to send a request on each session */ + TEST_ASSERT_SUCCESS(test_AES_CBC_HMAC_SHA512_decrypt_perform( + sessions[i], ut_params, ts_params), + "Failed to perform decrypt on request number %u.", i); + } + + /* Next session create should fail */ + sessions[i] = rte_cryptodev_session_create(ts_params->valid_devs[0], + &ut_params->auth_xform); + TEST_ASSERT_NULL(sessions[i], "Session creation succeeded unexpectedly!"); + + for (i = 0; i < nb_sessions; i++) + rte_cryptodev_session_free(ts_params->valid_devs[0], sessions[i]); + + return TEST_SUCCESS; +} + +static struct unit_test_suite cryptodev_testsuite = { + .suite_name = "Crypto Device Unit Test Suite", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_dev_id), + TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_queue_pair_ids), + TEST_CASE_ST(ut_setup, ut_teardown, test_queue_pair_descriptor_setup), + TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session), + + 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_GCM), + + TEST_CASE(test_stats), + + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + +static struct unit_test_suite cryptodev_aesni_testsuite = { + .suite_name = "Crypto Device AESNI Unit Test Suite", + .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_CASES_END() /**< NULL terminate unit test array */ + } +}; + + +static int +test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/) +{ + gbl_cryptodev_type = RTE_CRYPTODEV_QAT_PMD; + return unit_test_suite_runner(&cryptodev_testsuite); +} +static struct test_command cryptodev_qat_cmd = { + .command = "cryptodev_qat_autotest", + .callback = test_cryptodev_qat, +}; + +static int +test_cryptodev_aesni(void /*argv __rte_unused, int argc __rte_unused*/) +{ + gbl_cryptodev_type = RTE_CRYPTODEV_AESNI_MB_PMD; + + return unit_test_suite_runner(&cryptodev_aesni_testsuite); +} + +static struct test_command cryptodev_aesni_cmd = { + .command = "cryptodev_aesni_autotest", + .callback = test_cryptodev_aesni, +}; + +REGISTER_TEST_COMMAND(cryptodev_qat_cmd); +REGISTER_TEST_COMMAND(cryptodev_aesni_cmd); diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h new file mode 100644 index 0000000..034393e --- /dev/null +++ b/app/test/test_cryptodev.h @@ -0,0 +1,68 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2015 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_H_ +#define TEST_CRYPTODEV_H_ + +#define HEX_DUMP 0 + +#define FALSE 0 +#define TRUE 1 + +#define MAX_NUM_OPS_INFLIGHT (4096) +#define MIN_NUM_OPS_INFLIGHT (128) +#define DEFAULT_NUM_OPS_INFLIGHT (128) + +#define MAX_NUM_QPS_PER_QAT_DEVICE (2) +#define DEFAULT_NUM_QPS_PER_QAT_DEVICE (2) +#define DEFAULT_BURST_SIZE (64) +#define DEFAULT_NUM_XFORMS (2) +#define NUM_MBUFS (8191) +#define MBUF_CACHE_SIZE (250) +#define MBUF_SIZE (2048 + DIGEST_BYTE_LENGTH_SHA512 + \ + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) + +#define BYTE_LENGTH(x) (x/8) +/* HASH DIGEST LENGTHS */ +#define DIGEST_BYTE_LENGTH_MD5 (BYTE_LENGTH(128)) +#define DIGEST_BYTE_LENGTH_SHA1 (BYTE_LENGTH(160)) +#define DIGEST_BYTE_LENGTH_SHA224 (BYTE_LENGTH(224)) +#define DIGEST_BYTE_LENGTH_SHA256 (BYTE_LENGTH(256)) +#define DIGEST_BYTE_LENGTH_SHA384 (BYTE_LENGTH(384)) +#define DIGEST_BYTE_LENGTH_SHA512 (BYTE_LENGTH(512)) +#define DIGEST_BYTE_LENGTH_AES_XCBC (BYTE_LENGTH(96)) +#define AES_XCBC_MAC_KEY_SZ (16) + +#define TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 (12) +#define TRUNCATED_DIGEST_BYTE_LENGTH_SHA256 (16) +#define TRUNCATED_DIGEST_BYTE_LENGTH_SHA512 (32) + +#endif /* TEST_CRYPTODEV_H_ */ diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c new file mode 100644 index 0000000..c2f8fe1 --- /dev/null +++ b/app/test/test_cryptodev_perf.c @@ -0,0 +1,1415 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2015 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. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "test.h" +#include "test_cryptodev.h" + + +#define PERF_NUM_OPS_INFLIGHT (128) +#define DEFAULT_NUM_REQS_TO_SUBMIT (10000000) + +struct crypto_testsuite_params { + struct rte_mempool *mbuf_mp; + struct rte_mempool *crypto_op_mp; + + uint16_t nb_queue_pairs; + + struct rte_cryptodev_config conf; + struct rte_cryptodev_qp_conf qp_conf; + uint8_t dev_id; +}; + + +#define MAX_NUM_OF_OPS_PER_UT (128) + +struct crypto_unittest_params { + struct rte_crypto_xform cipher_xform; + struct rte_crypto_xform auth_xform; + + struct rte_cryptodev_session *sess; + + struct rte_crypto_op_data *op; + + struct rte_mbuf *obuf[MAX_NUM_OF_OPS_PER_UT]; + struct rte_mbuf *ibuf[MAX_NUM_OF_OPS_PER_UT]; + + uint8_t *digest; +}; + +static struct rte_mbuf * +setup_test_string(struct rte_mempool *mpool, + const char *string, size_t len, uint8_t blocksize) +{ + struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); + size_t t_len = len - (blocksize ? (len % blocksize) : 0); + + if (m) { + char *dst = rte_pktmbuf_append(m, t_len); + + if (!dst) { + rte_pktmbuf_free(m); + return NULL; + } + + rte_memcpy(dst, string, t_len); + } + return m; +} + +static struct crypto_testsuite_params testsuite_params = { NULL }; +static struct crypto_unittest_params unittest_params; +static enum rte_cryptodev_type gbl_cryptodev_preftest_devtype; + +static int +testsuite_setup(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_info info; + unsigned i, nb_devs, valid_dev_id = 0; + uint16_t qp_id; + + ts_params->mbuf_mp = rte_mempool_lookup("CRYPTO_PERF_MBUFPOOL"); + if (ts_params->mbuf_mp == NULL) { + /* Not already created so create */ + ts_params->mbuf_mp = rte_mempool_create("CRYPTO_PERF_MBUFPOOL", NUM_MBUFS, + MBUF_SIZE, MBUF_CACHE_SIZE, + sizeof(struct rte_pktmbuf_pool_private), + rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, + rte_socket_id(), 0); + if (ts_params->mbuf_mp == NULL) { + RTE_LOG(ERR, USER1, "Can't create CRYPTO_PERF_MBUFPOOL\n"); + return TEST_FAILED; + } + } + + ts_params->crypto_op_mp = rte_crypto_op_pool_create("CRYPTO_OP_POOL", + NUM_MBUFS, MBUF_CACHE_SIZE, DEFAULT_NUM_XFORMS, rte_socket_id()); + if (ts_params->crypto_op_mp == NULL) { + RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); + return TEST_FAILED; + } + + /* Create 2 AESNI MB devices if required */ + if (gbl_cryptodev_preftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) { + nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD); + if (nb_devs < 2) { + for (i = nb_devs; i < 2; i++) { + int dev_id = rte_eal_vdev_init( + CRYPTODEV_NAME_AESNI_MB_PMD, NULL); + + TEST_ASSERT(dev_id >= 0, + "Failed to create instance %u of pmd : %s", + i, CRYPTODEV_NAME_AESNI_MB_PMD); + } + } + } + + nb_devs = rte_cryptodev_count(); + if (nb_devs < 1) { + RTE_LOG(ERR, USER1, "No crypto devices found?"); + return TEST_FAILED; + } + + /* Search for the first valid */ + for (i = 0; i < nb_devs; i++) { + rte_cryptodev_info_get(i, &info); + if (info.dev_type == gbl_cryptodev_preftest_devtype) { + ts_params->dev_id = i; + valid_dev_id = 1; + break; + } + } + + if (!valid_dev_id) + return TEST_FAILED; + + /* Using Crypto Device Id 0 by default. + * Since we can't free and re-allocate queue memory always set the queues + * on this device up to max size first so enough memory is allocated for + * any later re-configures needed by other tests */ + + ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; + ts_params->conf.socket_id = SOCKET_ID_ANY; + ts_params->conf.session_mp.nb_objs = + (gbl_cryptodev_preftest_devtype == RTE_CRYPTODEV_QAT_PMD) ? + RTE_LIBRTE_PMD_QAT_MAX_SESSIONS : + RTE_LIBRTE_PMD_AESNI_MB_MAX_SESSIONS; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id, + &ts_params->conf), + "Failed to configure cryptodev %u", + ts_params->dev_id); + + + ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->dev_id, qp_id, + &ts_params->qp_conf, + rte_cryptodev_socket_id(ts_params->dev_id)), + "Failed to setup queue pair %u on cryptodev %u", + qp_id, ts_params->dev_id); + } + + /*Now reconfigure queues to size we actually want to use in this testsuite.*/ + ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT; + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { + + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->dev_id, qp_id, + &ts_params->qp_conf, + rte_cryptodev_socket_id(ts_params->dev_id)), + "Failed to setup queue pair %u on cryptodev %u", + qp_id, ts_params->dev_id); + } + + return TEST_SUCCESS; +} +static void +testsuite_teardown(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + + if (ts_params->mbuf_mp != NULL) + RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n", + rte_mempool_count(ts_params->mbuf_mp)); +} + +static int +ut_setup(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + + /* Clear unit test parameters before running test */ + memset(ut_params, 0, sizeof(*ut_params)); + + rte_cryptodev_stats_reset(ts_params->dev_id); + + return TEST_SUCCESS; +} + +static void +ut_teardown(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + struct rte_cryptodev_stats stats; + + unsigned i; + + /* free crypto session structure */ + if (ut_params->sess) + rte_cryptodev_session_free(ts_params->dev_id, + ut_params->sess); + + /* free crypto operation structure */ + if (ut_params->op) + rte_crypto_op_free(ut_params->op); + + for (i = 0; i < MAX_NUM_OF_OPS_PER_UT; i++) { + if (ut_params->obuf[i]) + rte_pktmbuf_free(ut_params->obuf[i]); + else if (ut_params->ibuf[i]) + rte_pktmbuf_free(ut_params->ibuf[i]); + } + + if (ts_params->mbuf_mp != NULL) + RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n", + rte_mempool_count(ts_params->mbuf_mp)); + + rte_cryptodev_stats_get(ts_params->dev_id, &stats); + +} + +const char plaintext_quote[] = + "THE COUNT OF MONTE CRISTO by Alexandre Dumas, Pere Chapter 1. " + "Marseilles--The Arrival. On the 24th of February, 1815, the " + "look-out at Notre-Dame de la Garde signalled the three-master," + " the Pharaon from Smyrna, Trieste, and Naples. As usual, a " + "pilot put off immediately, and rounding the Chateau d'If, got " + "on board the vessel between Cape Morgion and Rion island. " + "Immediately, and according to custom, the ramparts of Fort " + "Saint-Jean were covered with spectators; it is always an event " + "at Marseilles for a ship to come into port, especially when " + "this ship, like the Pharaon, has been built, rigged, and laden" + " at the old Phocee docks, and belongs to an owner of the city." + " The ship drew on and had safely passed the strait, which some" + " volcanic shock has made between the Calasareigne and Jaros " + "islands; had doubled Pomegue, and approached the harbor under" + " topsails, jib, and spanker, but so slowly and sedately that" + " the idlers, with that instinct which is the forerunner of " + "evil, asked one another what misfortune could have happened " + "on board. However, those experienced in navigation saw plainly" + " that if any accident had occurred, it was not to the vessel " + "herself, for she bore down with all the evidence of being " + "skilfully handled, the anchor a-cockbill, the jib-boom guys " + "already eased off, and standing by the side of the pilot, who" + " was steering the Pharaon towards the narrow entrance of the" + " inner port, was a young man, who, with activity and vigilant" + " eye, watched every motion of the ship, and repeated each " + "direction of the pilot. The vague disquietude which prevailed " + "among the spectators had so much affected one of the crowd " + "that he did not await the arrival of the vessel in harbor, but" + " jumping into a small skiff, desired to be pulled alongside " + "the Pharaon, which he reached as she rounded into La Reserve " + "basin. When the young man on board saw this person approach, " + "he left his station by the pilot, and, hat in hand, leaned " + "over the ship's bulwarks. He was a fine, tall, slim young " + "fellow of eighteen or twenty, with black eyes, and hair as " + "dark as a raven's wing; and his whole appearance bespoke that " + "calmness and resolution peculiar to men accustomed from their " + "cradle to contend with danger. \"Ah, is it you, Dantes?\" " + "cried the man in the skiff. \"What's the matter? and why have " + "you such an air of sadness aboard?\" \"A great misfortune, M. " + "Morrel,\" replied the young man,--\"a great misfortune, for me" + " especially! Off Civita Vecchia we lost our brave Captain " + "Leclere.\" \"And the cargo?\" inquired the owner, eagerly. " + "\"Is all safe, M. Morrel; and I think you will be satisfied on" + " that head. But poor Captain Leclere--\" \"What happened to " + "him?\" asked the owner, with an air of considerable " + "resignation. \"What happened to the worthy captain?\" \"He " + "died.\" \"Fell into the sea?\" \"No, sir, he died of " + "brain-fever in dreadful agony.\" Then turning to the crew, " + "he said, \"Bear a hand there, to take in sail!\" All hands " + "obeyed, and at once the eight or ten seamen who composed the " + "crew, sprang to their respective stations at the spanker " + "brails and outhaul, topsail sheets and halyards, the jib " + "downhaul, and the topsail clewlines and buntlines. The young " + "sailor gave a look to see that his orders were promptly and " + "accurately obeyed, and then turned again to the owner. \"And " + "how did this misfortune occur?\" inquired the latter, resuming" + " the interrupted conversation. \"Alas, sir, in the most " + "unexpected manner. After a long talk with the harbor-master, " + "Captain Leclere left Naples greatly disturbed in mind. In " + "twenty-four hours he was attacked by a fever, and died three " + "days afterwards. We performed the usual burial service, and he" + " is at his rest, sewn up in his hammock with a thirty-six " + "pound shot at his head and his heels, off El Giglio island. " + "We bring to his widow his sword and cross of honor. It was " + "worth while, truly,\" added the young man with a melancholy " + "smile, \"to make war against the English for ten years, and " + "to die in his bed at last, like everybody else."; + +#define QUOTE_LEN_64B (64) +#define QUOTE_LEN_128B (128) +#define QUOTE_LEN_256B (256) +#define QUOTE_LEN_512B (512) +#define QUOTE_LEN_768B (768) +#define QUOTE_LEN_1024B (1024) +#define QUOTE_LEN_1280B (1280) +#define QUOTE_LEN_1536B (1536) +#define QUOTE_LEN_1792B (1792) +#define QUOTE_LEN_2048B (2048) + + +/* ***** AES-CBC / HMAC-SHA256 Performance Tests ***** */ + +#define HMAC_KEY_LENGTH_SHA256 (DIGEST_BYTE_LENGTH_SHA256) + +#define CIPHER_KEY_LENGTH_AES_CBC (16) +#define CIPHER_IV_LENGTH_AES_CBC (CIPHER_KEY_LENGTH_AES_CBC) + + +static uint8_t aes_cbc_key[] = { + 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2, + 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA }; + +static uint8_t aes_cbc_iv[] = { + 0xf5, 0xd3, 0x89, 0x0f, 0x47, 0x00, 0xcb, 0x52, + 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1 }; + +static uint8_t hmac_sha256_key[] = { + 0xff, 0xcb, 0x37, 0x30, 0x1d, 0x4a, 0xc2, 0x41, + 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A, + 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76, + 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60 }; + + +/* Cipher text output */ + +static const uint8_t AES_CBC_ciphertext_64B[] = { + 0x05, 0x15, 0x77, 0x32, 0xc9, 0x66, 0x91, 0x50, 0x93, 0x9f, 0xbb, 0x4e, 0x2e, 0x5a, 0x02, 0xd0, + 0x2d, 0x9d, 0x31, 0x5d, 0xc8, 0x9e, 0x86, 0x36, 0x54, 0x5c, 0x50, 0xe8, 0x75, 0x54, 0x74, 0x5e, + 0xd5, 0xa2, 0x84, 0x21, 0x2d, 0xc5, 0xf8, 0x1c, 0x55, 0x1a, 0xba, 0x91, 0xce, 0xb5, 0xa3, 0x1e, + 0x31, 0xbf, 0xe9, 0xa1, 0x97, 0x5c, 0x2b, 0xd6, 0x57, 0xa5, 0x9f, 0xab, 0xbd, 0xb0, 0x9b, 0x9c +}; + +static const uint8_t AES_CBC_ciphertext_128B[] = { + 0x79, 0x92, 0x65, 0xc8, 0xfb, 0x0a, 0xc7, 0xc4, 0x9b, 0x3b, 0xbe, 0x69, 0x7f, 0x7c, 0xf4, 0x4e, + 0xa5, 0x0d, 0xf6, 0x33, 0xc4, 0xdf, 0xf3, 0x0d, 0xdb, 0xb9, 0x68, 0x34, 0xb0, 0x0d, 0xbd, 0xb9, + 0xa7, 0xf3, 0x86, 0x50, 0x2a, 0xbe, 0x50, 0x5d, 0xb3, 0xbe, 0x72, 0xf9, 0x02, 0xb1, 0x69, 0x0b, + 0x8c, 0x96, 0x4c, 0x3c, 0x0c, 0x1e, 0x76, 0xe5, 0x7e, 0x75, 0xdd, 0xd0, 0xa9, 0x75, 0x00, 0x13, + 0x6b, 0x1e, 0xc0, 0xad, 0xfc, 0x03, 0xb5, 0x99, 0xdc, 0x37, 0x35, 0xfc, 0x16, 0x34, 0xfd, 0xb4, + 0xea, 0x1e, 0xb6, 0x51, 0xdf, 0xab, 0x87, 0xd6, 0x87, 0x41, 0xfa, 0x1c, 0xc6, 0x78, 0xa6, 0x3c, + 0x1d, 0x76, 0xfe, 0xff, 0x65, 0xfc, 0x63, 0x1e, 0x1f, 0xe2, 0x7c, 0x9b, 0xa2, 0x72, 0xc3, 0x34, + 0x23, 0xdf, 0x01, 0xf0, 0xfd, 0x02, 0x8b, 0x97, 0x00, 0x2b, 0x97, 0x4e, 0xab, 0x98, 0x21, 0x3c +}; + +static const uint8_t AES_CBC_ciphertext_256B[] = { + 0xc7, 0x71, 0x2b, 0xed, 0x2c, 0x97, 0x59, 0xfa, 0xcf, 0x5a, 0xb9, 0x31, 0x92, 0xe0, 0xc9, 0x92, + 0xc0, 0x2d, 0xd5, 0x9c, 0x84, 0xbf, 0x70, 0x36, 0x13, 0x48, 0xe0, 0xb1, 0xbf, 0x6c, 0xcd, 0x91, + 0xa0, 0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0x8a, 0xc9, 0xcf, 0xaf, 0x4a, 0xed, 0x35, + 0xc0, 0x97, 0x52, 0xc5, 0x00, 0xdf, 0xef, 0xc7, 0x9f, 0xf2, 0xe8, 0x15, 0x3e, 0xb3, 0x30, 0xe7, + 0x00, 0xd0, 0x4e, 0xeb, 0x79, 0xf6, 0xf6, 0xcf, 0xf0, 0xe7, 0x61, 0xd5, 0x3d, 0x6a, 0x73, 0x9d +}; + +static const uint8_t AES_CBC_ciphertext_512B[] = { + 0xb4, 0xc6, 0xc6, 0x5f, 0x7e, 0xca, 0x05, 0x70, 0x21, 0x7b, 0x92, 0x9e, 0x23, 0xe7, 0x92, 0xb8, + 0x27, 0x3d, 0x20, 0x29, 0x57, 0xfa, 0x1f, 0x26, 0x0a, 0x04, 0x34, 0xa6, 0xf2, 0xdc, 0x44, 0xb6, + 0x43, 0x40, 0x62, 0xde, 0x0c, 0xde, 0x1c, 0x30, 0x43, 0x85, 0x0b, 0xe8, 0x93, 0x1f, 0xa1, 0x2a, + 0x8a, 0x27, 0x35, 0x39, 0x14, 0x9f, 0x37, 0x64, 0x59, 0xb5, 0x0e, 0x96, 0x82, 0x5d, 0x63, 0x45, + 0xd6, 0x93, 0x89, 0x46, 0xe4, 0x71, 0x31, 0xeb, 0x0e, 0xd1, 0x7b, 0xda, 0x90, 0xb5, 0x81, 0xac, + 0x76, 0x54, 0x54, 0x85, 0x0b, 0xa9, 0x46, 0x9c, 0xf0, 0xfd, 0xde, 0x5d, 0xa8, 0xe3, 0xee, 0xe9, + 0xf4, 0x9d, 0x34, 0x76, 0x39, 0xe7, 0xc3, 0x4a, 0x84, 0x38, 0x92, 0x61, 0xf1, 0x12, 0x9f, 0x05, + 0xda, 0xdb, 0xc1, 0xd4, 0xb0, 0xa0, 0x27, 0x19, 0xa0, 0x56, 0x5d, 0x9b, 0xcc, 0x47, 0x7c, 0x15, + 0x1d, 0x52, 0x66, 0xd5, 0xff, 0xef, 0x12, 0x23, 0x86, 0xe2, 0xee, 0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1c, 0x95, 0x5e, 0x56, 0x33, 0xbc, 0x7a, 0x3f, 0x6f +}; + +static const uint8_t AES_CBC_ciphertext_768B[] = { + 0x3e, 0x7f, 0x9e, 0x4c, 0x88, 0x15, 0x68, 0x69, 0x10, 0x09, 0xe1, 0xa7, 0x0f, 0x27, 0x88, 0x2d, + 0x90, 0x73, 0x4f, 0x67, 0xd3, 0x8b, 0xaf, 0xa1, 0x2c, 0x37, 0xa5, 0x6c, 0x7c, 0xbd, 0x95, 0x4c, + 0x82, 0xcf, 0x05, 0x49, 0x16, 0x5c, 0xe7, 0x06, 0xd4, 0xcb, 0x55, 0x65, 0x9a, 0xd0, 0xe1, 0x46, + 0x3a, 0x37, 0x71, 0xad, 0xb0, 0xb4, 0x99, 0x1e, 0x23, 0x57, 0x48, 0x96, 0x9c, 0xc5, 0xc4, 0xdb, + 0x64, 0x3e, 0xc9, 0x7f, 0x90, 0x5a, 0xa0, 0x08, 0x75, 0x4c, 0x09, 0x06, 0x31, 0x6e, 0x59, 0x29, + 0xfc, 0x2f, 0x72, 0xde, 0xf2, 0x40, 0x5a, 0xfe, 0xd3, 0x66, 0x64, 0xb8, 0x9c, 0xc9, 0xa6, 0x1f, + 0xc3, 0x52, 0xcd, 0xb5, 0xd1, 0x4f, 0x43, 0x3f, 0xf4, 0x59, 0x25, 0xc4, 0xdd, 0x3e, 0x58, 0x7c, + 0x21, 0xd6, 0x21, 0xce, 0xa4, 0xbe, 0x08, 0x23, 0x46, 0x68, 0xc0, 0x00, 0x91, 0x47, 0xca, 0x9b, + 0xe0, 0xb4, 0xe3, 0xab, 0xbf, 0xcf, 0x68, 0x26, 0x97, 0x23, 0x09, 0x93, 0x64, 0x8f, 0x57, 0x59, + 0xe2, 0x41, 0x7c, 0xa2, 0x48, 0x7e, 0xd5, 0x2c, 0x54, 0x09, 0x1b, 0x07, 0x94, 0xca, 0x39, 0x83, + 0xdd, 0xf4, 0x7a, 0x1d, 0x2d, 0xdd, 0x67, 0xf7, 0x3c,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 0xf7, 0x52, + 0x92, 0x38, 0x36, 0xbf, 0xa9, 0x0a, 0xbb, 0x68, 0x45, 0x08, 0x25, 0xee, 0x59, 0xfe, 0xee, 0xf2, + 0x2c, 0xd4, 0x5f, 0x78, 0x59, 0x0d, 0x90, 0xf1, 0xd7, 0xe4, 0x39, 0x0e, 0x46, 0x36, 0xf5, 0x75, + 0x03, 0x3c, 0x28, 0xfb, 0xfa, 0x8f, 0xef, 0xc9, 0x61, 0x00, 0x94, 0xc3, 0xd2, 0x0f, 0xd9, 0xda +}; + +static const uint8_t AES_CBC_ciphertext_1024B[] = { + 0x7d, 0x01, 0x7e, 0x2f, 0x92, 0xb3, 0xea, 0x72, 0x4a, 0x3f, 0x10, 0xf9, 0x2b, 0xb0, 0xd5, 0xb9, + 0x19, 0x68, 0x94, 0xe9, 0x93, 0xe9, 0xd5, 0x26, 0x20, 0x44, 0xe2, 0x47, 0x15, 0x8d, 0x75, 0x48, + 0x8e, 0xe4, 0x40, 0x81, 0xb5, 0x06, 0xa8, 0xb8, 0x0e, 0x0f, 0x3b, 0xbc, 0x5b, 0xbe, 0x3b, 0xa2, + 0x2a, 0x0c, 0x48, 0x98, 0x19, 0xdf, 0xe9, 0x25, 0x75, 0xab, 0x93, 0x44, 0xb1, 0x72, 0x70, 0xbb, + 0x20, 0xcf, 0x78, 0xe9, 0x4d, 0xc6, 0xa9, 0xa9, 0x84, 0x78, 0xc5, 0xc0, 0xc4, 0xc9, 0x79, 0x1a, + 0xbc, 0x61, 0x25, 0x5f, 0xac, 0x01, 0x03, 0xb7, 0xef, 0x07, 0xf2, 0x62, 0x98, 0xee, 0xe3, 0xad, + 0x94, 0x75, 0x30, 0x67, 0xb9, 0x15, 0x00, 0xe7, 0x11, 0x32, 0x2e, 0x6b, 0x55, 0x9f, 0xac, 0x68, + 0xde, 0x61, 0x05, 0x80, 0x01, 0xf3, 0xad, 0xab, 0xaf, 0x45, 0xe0, 0xf4, 0x68, 0x5c, 0xc0, 0x52, + 0x92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 0x5e, 0xfd, 0x43, 0x3b, 0x27, 0xe1, 0x5e, + 0xa3, 0xa9, 0x5c, 0x3b, 0x60, 0xdd, 0xc6, 0x8d, 0x5a, 0xf1, 0x3e, 0x89, 0x4b, 0x24, 0xcf, 0x01, + 0x3a, 0x2d, 0x44, 0xe7, 0xda, 0xe7, 0xa1, 0xac, 0x11, 0x05, 0x0c, 0xa9, 0x7a, 0x82, 0x8c, 0x5c, + 0x29, 0x68, 0x9c, 0x73, 0x13, 0xcc, 0x67, 0x32, 0x11, 0x5e, 0xe5, 0xcc, 0x8c, 0xf5, 0xa7, 0x52, + 0x83, 0x9a, 0x70, 0xef, 0xde, 0x55, 0x9c, 0xc7, 0x8a, 0xed, 0xad, 0x28, 0x4a, 0xc5, 0x92, 0x6d, + 0x8e, 0x47, 0xca, 0xe3, 0xf8, 0x77, 0xb5, 0x26, 0x64, 0x84, 0xc2, 0xf1, 0xd7, 0xae, 0x0c, 0xb9, + 0x39, 0x0f, 0x43, 0x6b, 0xe9, 0xe0, 0x09, 0x4b, 0xe5, 0xe3, 0x17, 0xa6, 0x68, 0x69, 0x46, 0xf4, + 0xf0, 0x68, 0x7f, 0x2f, 0x1c, 0x7e, 0x4c, 0xd2, 0xb5, 0xc6, 0x16, 0x85, 0xcf, 0x02, 0x4c, 0x89, + 0x0b, 0x25, 0xb0, 0xeb, 0xf3, 0x77, 0x08, 0x6a, 0x46, 0x5c, 0xf6, 0x2f, 0xf1, 0x24, 0xc3, 0x4d, + 0x80, 0x60, 0x4d, 0x69, 0x98, 0xde, 0xc7, 0xa1, 0xf6, 0x4e, 0x18, 0x0c, 0x2a, 0xb0, 0xb2, 0xe0, + 0x46, 0xe7, 0x49, 0x37, 0xc8, 0x5a, 0x23, 0x24, 0xe3, 0x0f, 0xcc, 0x92, 0xb4, 0x8d, 0xdc, 0x9e +}; + +static const uint8_t AES_CBC_ciphertext_1280B[] = { + 0x91, 0x99, 0x5e, 0x9e, 0x84, 0xff, 0x59, 0x45, 0x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, 0x50, 0xa4, 0xb6, 0x21, 0x17, 0xfd, 0x9b, 0x5c, 0x36, 0xca, 0xcc, 0x73, 0x73, 0xad, + 0xe0, 0x57, 0x77, 0x90, 0x0e, 0x7f, 0x0f, 0x87, 0x7f, 0xdb, 0x73, 0xbf, 0xda, 0xc2, 0xb3, 0x05, + 0x22, 0x06, 0xf5, 0xa3, 0xfc, 0x1e, 0x8f, 0xda, 0xcf, 0x49, 0xd6, 0xb3, 0x66, 0x2c, 0xb5, 0x00, + 0xaf, 0x85, 0x6e, 0xb8, 0x5b, 0x8c, 0xa1, 0xa4, 0x21, 0xce, 0x40, 0xf3, 0x98, 0xac, 0xec, 0x88, + 0x62, 0x43, 0x2a, 0xac, 0xca, 0xcf, 0xb9, 0x30, 0xeb, 0xfc, 0xef, 0xf0, 0x6e, 0x64, 0x6d, 0xe7, + 0x54, 0x88, 0x6b, 0x22, 0x29, 0xbe, 0xa5, 0x8c, 0x31, 0x23, 0x3b, 0x4a, 0x80, 0x37, 0xe6, 0xd0, + 0x05, 0xfc, 0x10, 0x0e, 0xdd, 0xbb, 0x00, 0xc5, 0x07, 0x20, 0x59, 0xd3, 0x41, 0x17, 0x86, 0x46, + 0xab, 0x68, 0xf6, 0x48, 0x3c, 0xea, 0x5a, 0x06, 0x30, 0x21, 0x19, 0xed, 0x74, 0xbe, 0x0b, 0x97, + 0xee, 0x91, 0x35, 0x94, 0x1f, 0xcb, 0x68, 0x7f, 0xe4, 0x48, 0xb0, 0x16, 0xfb, 0xf0, 0x74, 0xdb, + 0x06, 0x59, 0x2e, 0x5a, 0x9c, 0xce, 0x8f, 0x7d, 0xba, 0x48, 0xd5, 0x3f, 0x5c, 0xb0, 0xc2, 0x33, + 0x48, 0x60, 0x17, 0x08, 0x85, 0xba, 0xff, 0xb9, 0x34, 0x0a, 0x3d, 0x8f, 0x21, 0x13, 0x12, 0x1b +}; + +static const uint8_t AES_CBC_ciphertext_1536B[] = { + 0x89, 0x93, 0x05, 0x99, 0xa9, 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9, 0x30, 0x40, 0x43, + 0xea, 0x87, 0xde, 0x35, 0xf6, 0x83, 0x59, 0x09, 0x68, 0x62, 0x00, 0x87, 0xb8, 0xe7, 0xca, 0x05, + 0x0f, 0xac, 0x42, 0x58, 0x45, 0xaa, 0xc9, 0x9b, 0xfd, 0x2a, 0xda, 0x65, 0x33, 0x93, 0x9d, 0xc6, + 0x93, 0x8d, 0xe2, 0xc5, 0x71, 0xc1, 0x5c, 0x13, 0xde, 0x7b, 0xd4, 0xb9, 0x4c, 0x35, 0x61, 0x85, + 0x90, 0x78, 0xf7, 0x81, 0x98, 0x45, 0x99, 0x24, 0x58, 0x73, 0x28, 0xf8, 0x31, 0xab, 0x54, 0x2e, + 0xc0, 0x38, 0x77, 0x25, 0x5c, 0x06, 0x9c, 0xc3, 0x69, 0x21, 0x92, 0x76, 0xe1, 0x16, 0xdc, 0xa9, + 0xee, 0xb6, 0x80, 0x66, 0x43, 0x11, 0x24, 0xb3, 0x07, 0x17, 0x89, 0x0f, 0xcb, 0xe0, 0x60, 0xa8, + 0x9d, 0x06, 0x4b, 0x6e, 0x72, 0xb7, 0xbc, 0x4f, 0xb8, 0xc0, 0x80, 0xa2, 0xfb, 0x46, 0x5b, 0x8f, + 0x11, 0x01, 0x92, 0x9d, 0x37, 0x09, 0x98, 0xc8, 0x0a, 0x46, 0xae, 0x12, 0xac, 0x61, 0x3f, 0xe7, + 0x41, 0x1a, 0xaa, 0x2e, 0xdc, 0xd7, 0x2a, 0x47, 0xee, 0xdf, 0x08, 0xd1, 0xff, 0xea, 0x13, 0xc6, + 0x05, 0xdb, 0x29, 0xcc, 0x03, 0xba, 0x7b, 0x6d, 0x40, 0xc1, 0xc9, 0x76, 0x75, 0x03, 0x7a, 0x71, + 0xc9, 0x5f, 0xd9, 0xe0, 0x61, 0x69, 0x36, 0x8f, 0xb2, 0xbc, 0x28, 0xf3, 0x90, 0x71, 0xda, 0x5f, + 0x08, 0xd5, 0x0d, 0xc1, 0xe6, 0xbd, 0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 0x8d, 0x6c, 0xa8, 0xc0, 0x55, 0x28, + 0xc6, 0xc3, 0xea, 0xeb, 0x05, 0xf5, 0x65, 0xeb, 0x53, 0xe1, 0x54, 0xef, 0xb8, 0x64, 0x98, 0x2d, + 0x98, 0x9e, 0xc8, 0xfe, 0xa2, 0x07, 0x30, 0xf7, 0xf7, 0xae, 0xdb, 0x32, 0xf8, 0x71, 0x9d, 0x06, + 0xdf, 0x9b, 0xda, 0x61, 0x7d, 0xdb, 0xae, 0x06, 0x24, 0x63, 0x74, 0xb6, 0xf3, 0x1b, 0x66, 0x09, + 0x60, 0xff, 0x2b, 0x29, 0xf5, 0xa9, 0x9d, 0x61, 0x5d, 0x55, 0x10, 0x82, 0x21, 0xbb, 0x64, 0x0d, + 0xef, 0x5c, 0xe3, 0x30, 0x1b, 0x60, 0x1e, 0x5b, 0xfe, 0x6c, 0xf5, 0x15, 0xa3, 0x86, 0x27, 0x58, + 0x46, 0x00, 0x20, 0xcb, 0x86, 0x9a, 0x52, 0x29, 0x20, 0x68, 0x4d, 0x67, 0x88, 0x70, 0xc2, 0x31, + 0xd8, 0xbb, 0xa5, 0xa7, 0x88, 0x7f, 0x66, 0xbc, 0xaa, 0x0f, 0xe1, 0x78, 0x7b, 0x97, 0x3c, 0xb7, + 0xd7, 0xd8, 0x04, 0xe0, 0x09, 0x60, 0xc8, 0xd0, 0x9e, 0xe5, 0x6b, 0x31, 0x7f, 0x88, 0xfe, 0xc3, + 0xfd, 0x89, 0xec, 0x76, 0x4b, 0xb3, 0xa7, 0x37, 0x03, 0xb7, 0xc6, 0x10, 0x7c, 0x9d, 0x0c, 0x75, + 0xd3, 0x08, 0x14, 0x94, 0x03, 0x42, 0x25, 0x26, 0x85, 0xf7, 0xf0, 0x90, 0x06, 0x3e, 0x6f, 0x60, + 0x52, 0x55, 0xd5, 0x0f, 0x79, 0x64, 0x69, 0x69, 0x46, 0xf9, 0x7f, 0x7f, 0x03, 0xf1, 0x1f, 0xdb, + 0x39, 0x05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 0x37, + 0xb3, 0x7a, 0x7e, 0xc4, 0xbc, 0x99, 0xfc, 0xe4, 0x89, 0x00, 0x68, 0x39, 0xbc, 0x5a, 0xba, 0xab, + 0x52, 0xab, 0xe6, 0x81, 0xfd, 0x93, 0x62, 0xe9, 0xb7, 0x12, 0xd1, 0x18, 0x1a, 0xb9, 0x55, 0x4a, + 0x0f, 0xae, 0x35, 0x11, 0x04, 0x27, 0xf3, 0x42, 0x4e, 0xca, 0xdf, 0x9f, 0x12, 0x62, 0xea, 0x03, + 0xc0, 0xa9, 0x22, 0x7b, 0x6c, 0x6c, 0xe3, 0xdf, 0x16, 0xad, 0x03, 0xc9, 0xfe, 0xa4, 0xdd, 0x4f +}; + +static const uint8_t AES_CBC_ciphertext_1792B[] = { + 0x59, 0xcc, 0xfe, 0x8f, 0xb4, 0x9d, 0x0e, 0xd1, 0x85, 0xfc, 0x9b, 0x43, 0xc1, 0xb7, 0x54, 0x67, + 0x01, 0xef, 0xb8, 0x71, 0x36, 0xdb, 0x50, 0x48, 0x7a, 0xea, 0xcf, 0xce, 0xba, 0x30, 0x10, 0x2e, + 0x96, 0x2b, 0xfd, 0xcf, 0x00, 0xe3, 0x1f, 0xac, 0x66, 0x14, 0x30, 0x86, 0x49, 0xdb, 0x01, 0x8b, + 0x07, 0xdd, 0x00, 0x9d, 0x0d, 0x5c, 0x19, 0x11, 0xe8, 0x44, 0x2b, 0x25, 0x70, 0xed, 0x7c, 0x33, + 0x0d, 0xe3, 0x34, 0x93, 0x63, 0xad, 0x26, 0xb1, 0x11, 0x91, 0x34, 0x2e, 0x1d, 0x50, 0xaa, 0xd4, + 0xef, 0x3a, 0x6d, 0xd7, 0x33, 0x20, 0x0d, 0x3f, 0x9b, 0xdd, 0xc3, 0xa5, 0xc5, 0xf1, 0x99, 0xdc, + 0xea, 0x52, 0xda, 0x55, 0xea, 0xa2, 0x7a, 0xc5, 0x78, 0x44, 0x4a, 0x02, 0x33, 0x19, 0x62, 0x37, + 0xf8, 0x8b, 0xd1, 0x0c, 0x21, 0xdf, 0x40, 0x19, 0x81, 0xea, 0xfb, 0x1c, 0xa7, 0xcc, 0x60, 0xfe, + 0x63, 0x25, 0x8f, 0xf3, 0x73, 0x0f, 0x45, 0xe6, 0x6a, 0x18, 0xbf, 0xbe, 0xad, 0x92, 0x2a, 0x1e, + 0x15, 0x65, 0x6f, 0xef, 0x92, 0xcd, 0x0e, 0x19, 0x3d, 0x42, 0xa8, 0xfc, 0x0d, 0x32, 0x58, 0xe0, + 0x56, 0x9f, 0xd6, 0x9b, 0x8b, 0xec, 0xe0, 0x45, 0x4d, 0x7e, 0x73, 0x87, 0xff, 0x74, 0x92, 0x59, + 0x60, 0x13, 0x93, 0xda, 0xec, 0xbf, 0xfa, 0x20, 0xb6, 0xe7, 0xdf, 0xc7, 0x10, 0xf5, 0x79, 0xb4, + 0xd7, 0xac, 0xaf, 0x2b, 0x37, 0x52, 0x30, 0x1d, 0xbe, 0x0f, 0x60, 0x77, 0x3d, 0x03, 0x63, 0xa9, + 0xae, 0xb1, 0xf3, 0xca, 0xca, 0xb4, 0x21, 0xd7, 0x6f, 0x2e, 0x5e, 0x9b, 0x68, 0x53, 0x80, 0xab, + 0x30, 0x23, 0x0a, 0x72, 0x6b, 0xb1, 0xd8, 0x25, 0x5d, 0x3a, 0x62, 0x9b, 0x4f, 0x59, 0x3b, 0x79, + 0xa8, 0x9e, 0x08, 0x6d, 0x37, 0xb0, 0xfc, 0x42, 0x51, 0x25, 0x86, 0xbd, 0x54, 0x5a, 0x95, 0x20, + 0x6c, 0xac, 0xb9, 0x30, 0x1c, 0x03, 0xc9, 0x49, 0x38, 0x55, 0x31, 0x49, 0xed, 0xa9, 0x0e, 0xc3, + 0x65, 0xb4, 0x68, 0x6b, 0x07, 0x4c, 0x0a, 0xf9, 0x21, 0x69, 0x7c, 0x9f, 0x28, 0x80, 0xe9, 0x49, + 0x22, 0x7c, 0xec, 0x97, 0xf7, 0x70, 0xb4, 0xb8, 0x25, 0xe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0xbd, 0x65, 0x8a, 0x83, + 0xde, 0x7c, 0x05, 0x26, 0x93, 0x19, 0xcc, 0xf3, 0x71, 0x0e, 0xad, 0x2f, 0xb3, 0xc9, 0x38, 0x50, + 0x64, 0xd5, 0x4c, 0x60, 0x5f, 0x02, 0x13, 0x34, 0xc9, 0x75, 0xc4, 0x60, 0xab, 0x2e, 0x17, 0x7d +}; + +static const uint8_t AES_CBC_ciphertext_2048B[] = { + 0x8b, 0x55, 0xbd, 0xfd, 0x2b, 0x35, 0x76, 0x5c, 0xd1, 0x90, 0xd7, 0x6a, 0x63, 0x1e, 0x39, 0x71, + 0x0d, 0x5c, 0xd8, 0x03, 0x00, 0x75, 0xf1, 0x07, 0x03, 0x8d, 0x76, 0xeb, 0x3b, 0x00, 0x1e, 0x33, + 0x88, 0xfc, 0x8f, 0x08, 0x4d, 0x33, 0xf1, 0x3c, 0xee, 0xd0, 0x5d, 0x19, 0x8b, 0x3c, 0x50, 0x86, + 0xfd, 0x8d, 0x58, 0x21, 0xb4, 0xae, 0x0f, 0x81, 0xe9, 0x9f, 0xc9, 0xc0, 0x90, 0xf7, 0x04, 0x6f, + 0x39, 0x1d, 0x8a, 0x3f, 0x8d, 0x32, 0x23, 0xb5, 0x1f, 0xcc, 0x8a, 0x12, 0x2d, 0x46, 0x82, 0x5e, + 0x6a, 0x34, 0x8c, 0xb1, 0x93, 0x70, 0x3b, 0xde, 0x55, 0xaf, 0x16, 0x35, 0x99, 0x84, 0xd5, 0x88, + 0xc9, 0x54, 0xb1, 0xb2, 0xd3, 0xeb, 0x9e, 0x55, 0x9a, 0xa9, 0xa7, 0xf5, 0xda, 0x29, 0xcf, 0xe1, + 0x98, 0x64, 0x45, 0x77, 0xf2, 0x12, 0x69, 0x8f, 0x78, 0xd8, 0x82, 0x41, 0xb2, 0x9f, 0xe2, 0x1c, + 0x63, 0x9b, 0x24, 0x81, 0x67, 0x95, 0xa2, 0xff, 0x26, 0x9d, 0x65, 0x48, 0x61, 0x30, 0x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 0xde, 0x5d, 0xb7, 0xe9, 0x75, 0x6b, 0x29, 0x94, 0xd6, 0xf7, 0xc3, 0xdf, 0xfb, 0x70, + 0xec, 0xb5, 0x8c, 0xb0, 0x78, 0x7a, 0xee, 0x52, 0x5f, 0x8c, 0xae, 0x85, 0xe5, 0x98, 0xa2, 0xb7, + 0x7c, 0x02, 0x2a, 0xcc, 0x9e, 0xde, 0x99, 0x5f, 0x84, 0x20, 0xbb, 0xdc, 0xf2, 0xd2, 0x13, 0x46, + 0x3c, 0xd6, 0x4d, 0xe7, 0x50, 0xef, 0x55, 0xc3, 0x96, 0x9f, 0xec, 0x6c, 0xd8, 0xe2, 0xea, 0xed, + 0xc7, 0x33, 0xc9, 0xb3, 0x1c, 0x4f, 0x1d, 0x83, 0x1d, 0xe4, 0xdd, 0xb2, 0x24, 0x8f, 0xf9, 0xf5 +}; + + +static const uint8_t HMAC_SHA256_ciphertext_64B_digest[] = { + 0xc5, 0x6d, 0x4f, 0x29, 0xf4, 0xd2, 0xcc, 0x87, + 0x3c, 0x81, 0x02, 0x6d, 0x38, 0x7a, 0x67, 0x3e, + 0x95, 0x9c, 0x5c, 0x8f, 0xda, 0x5c, 0x06, 0xe0, + 0x65, 0xf1, 0x6c, 0x51, 0x52, 0x49, 0x3e, 0x5f +}; + +static const uint8_t HMAC_SHA256_ciphertext_128B_digest[] = { + 0x76, 0x64, 0x2d, 0x69, 0x71, 0x5d, 0x6a, 0xd8, + 0x9f, 0x74, 0x11, 0x2f, 0x58, 0xe0, 0x4a, 0x2f, + 0x6c, 0x88, 0x5e, 0x4d, 0x9c, 0x79, 0x83, 0x1c, + 0x8a, 0x14, 0xd0, 0x07, 0xfb, 0xbf, 0x6c, 0x8f +}; + +static const uint8_t HMAC_SHA256_ciphertext_256B_digest[] = { + 0x05, 0xa7, 0x44, 0xcd, 0x91, 0x8c, 0x95, 0xcf, + 0x7b, 0x8f, 0xd3, 0x90, 0x86, 0x7e, 0x7b, 0xb9, + 0x05, 0xd6, 0x6e, 0x7a, 0xc1, 0x7b, 0x26, 0xff, + 0xd3, 0x4b, 0xe0, 0x22, 0x8b, 0xa8, 0x47, 0x52 +}; + +static const uint8_t HMAC_SHA256_ciphertext_512B_digest[] = { + 0x08, 0xb7, 0x29, 0x54, 0x18, 0x7e, 0x97, 0x49, + 0xc6, 0x7c, 0x9f, 0x94, 0xa5, 0x4f, 0xa2, 0x25, + 0xd0, 0xe2, 0x30, 0x7b, 0xad, 0x93, 0xc9, 0x12, + 0x0f, 0xf0, 0xf0, 0x71, 0xc2, 0xf6, 0x53, 0x8f +}; + +static const uint8_t HMAC_SHA256_ciphertext_768B_digest[] = { + 0xe4, 0x3e, 0x73, 0x93, 0x03, 0xaf, 0x6f, 0x9c, + 0xca, 0x57, 0x3b, 0x4a, 0x6e, 0x83, 0x58, 0xf5, + 0x66, 0xc2, 0xb4, 0xa7, 0xe0, 0xee, 0x63, 0x6b, + 0x48, 0xb7, 0x50, 0x45, 0x69, 0xdf, 0x5c, 0x5b +}; + +static const uint8_t HMAC_SHA256_ciphertext_1024B_digest[] = { + 0x03, 0xb9, 0x96, 0x26, 0xdc, 0x1c, 0xab, 0xe2, + 0xf5, 0x70, 0x55, 0x15, 0x67, 0x6e, 0x48, 0x11, + 0xe7, 0x67, 0xea, 0xfa, 0x5c, 0x6b, 0x28, 0x22, + 0xc9, 0x0e, 0x67, 0x04, 0xb3, 0x71, 0x7f, 0x88 +}; + +static const uint8_t HMAC_SHA256_ciphertext_1280B_digest[] = { + 0x01, 0x91, 0xb8, 0x78, 0xd3, 0x21, 0x74, 0xa5, + 0x1c, 0x8b, 0xd4, 0xd2, 0xc0, 0x49, 0xd7, 0xd2, + 0x16, 0x46, 0x66, 0x85, 0x50, 0x6d, 0x08, 0xcc, + 0xc7, 0x0a, 0xa3, 0x71, 0xcc, 0xde, 0xee, 0xdc +}; + +static const uint8_t HMAC_SHA256_ciphertext_1536B_digest[] = { + 0xf2, 0xe5, 0xe9, 0x57, 0x53, 0xd7, 0x69, 0x28, + 0x7b, 0x69, 0xb5, 0x49, 0xa3, 0x31, 0x56, 0x5f, + 0xa4, 0xe9, 0x87, 0x26, 0x2f, 0xe0, 0x2d, 0xd6, + 0x08, 0x44, 0x01, 0x71, 0x0c, 0x93, 0x85, 0x84 +}; + +static const uint8_t HMAC_SHA256_ciphertext_1792B_digest[] = { + 0xf6, 0x57, 0x62, 0x01, 0xbf, 0x2d, 0xea, 0x4a, + 0xef, 0x43, 0x85, 0x60, 0x18, 0xdf, 0x8b, 0xb4, + 0x60, 0xc0, 0xfd, 0x2f, 0x90, 0x15, 0xe6, 0x91, + 0x56, 0x61, 0x68, 0x7f, 0x5e, 0x92, 0xa8, 0xdd +}; + +static const uint8_t HMAC_SHA256_ciphertext_2048B_digest[] = { + 0x81, 0x1a, 0x29, 0xbc, 0x6b, 0x9f, 0xbb, 0xb8, + 0xef, 0x71, 0x7b, 0x1f, 0x6f, 0xd4, 0x7e, 0x68, + 0x3a, 0x9c, 0xb9, 0x98, 0x22, 0x81, 0xfa, 0x95, + 0xee, 0xbc, 0x7f, 0x23, 0x29, 0x88, 0x76, 0xb8 +}; + +struct crypto_data_params { + const char *name; + uint16_t length; + const char *plaintext; + struct crypto_expected_output { + const uint8_t *ciphertext; + const uint8_t *digest; + } expected; +}; + +#define MAX_PACKET_SIZE_INDEX 10 + +struct crypto_data_params aes_cbc_hmac_sha256_output[MAX_PACKET_SIZE_INDEX] = { + { "64B", 64, &plaintext_quote[sizeof(plaintext_quote) - 1 - 64], { AES_CBC_ciphertext_64B, HMAC_SHA256_ciphertext_64B_digest } }, + { "128B", 128, &plaintext_quote[sizeof(plaintext_quote) - 1 - 128], { AES_CBC_ciphertext_128B, HMAC_SHA256_ciphertext_128B_digest } }, + { "256B", 256, &plaintext_quote[sizeof(plaintext_quote) - 1 - 256], { AES_CBC_ciphertext_256B, HMAC_SHA256_ciphertext_256B_digest } }, + { "512B", 512, &plaintext_quote[sizeof(plaintext_quote) - 1 - 512], { AES_CBC_ciphertext_512B, HMAC_SHA256_ciphertext_512B_digest } }, + { "768B", 768, &plaintext_quote[sizeof(plaintext_quote) - 1 - 768], { AES_CBC_ciphertext_768B, HMAC_SHA256_ciphertext_768B_digest } }, + { "1024B", 1024, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1024], { AES_CBC_ciphertext_1024B, HMAC_SHA256_ciphertext_1024B_digest } }, + { "1280B", 1280, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1280], { AES_CBC_ciphertext_1280B, HMAC_SHA256_ciphertext_1280B_digest } }, + { "1536B", 1536, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1536], { AES_CBC_ciphertext_1536B, HMAC_SHA256_ciphertext_1536B_digest } }, + { "1792B", 1792, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1792], { AES_CBC_ciphertext_1792B, HMAC_SHA256_ciphertext_1792B_digest } }, + { "2048B", 2048, &plaintext_quote[sizeof(plaintext_quote) - 1 - 2048], { AES_CBC_ciphertext_2048B, HMAC_SHA256_ciphertext_2048B_digest } } +}; + + +static int +test_perf_crypto_qp_vary_burst_size(uint16_t dev_num) +{ + uint32_t num_to_submit = 2048, max_outstanding_reqs = 512; + struct rte_mbuf *rx_mbufs[num_to_submit], *tx_mbufs[num_to_submit]; + uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0; + uint32_t burst_sent, burst_received; + uint32_t b, burst_size, num_sent, num_received; + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + struct crypto_data_params *data_params = aes_cbc_hmac_sha256_output; + + if (rte_cryptodev_count() == 0) { + printf("\nNo crypto devices available. Is kernel driver loaded?\n"); + return TEST_FAILED; + } + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_CIPHER_OP_DECRYPT; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC; + + + /* Setup HMAC Parameters */ + ut_params->auth_xform.type = RTE_CRYPTO_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_VERIFY; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_session_create(ts_params->dev_id, + &ut_params->cipher_xform); + + TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); + + /* Generate Crypto op data structure(s) */ + for (b = 0; b < num_to_submit ; b++) { + tx_mbufs[b] = setup_test_string(ts_params->mbuf_mp, + (const char *)data_params[0].expected.ciphertext, + data_params[0].length, 0); + TEST_ASSERT_NOT_NULL(tx_mbufs[b], "Failed to allocate tx_buf"); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append(tx_mbufs[b], + DIGEST_BYTE_LENGTH_SHA256); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + rte_memcpy(ut_params->digest, data_params[0].expected.digest, + DIGEST_BYTE_LENGTH_SHA256); + + struct rte_crypto_op_data *cop = rte_crypto_op_alloc(ts_params->crypto_op_mp); + TEST_ASSERT_NOT_NULL(cop, "Failed to allocate crypto_op"); + + rte_crypto_op_attach_session(cop, ut_params->sess); + + cop->digest.data = ut_params->digest; + cop->digest.phys_addr = rte_pktmbuf_mtophys_offset(tx_mbufs[b], data_params[0].length); + cop->digest.length = DIGEST_BYTE_LENGTH_SHA256; + + cop->iv.data = (uint8_t *)rte_pktmbuf_prepend(tx_mbufs[b], CIPHER_IV_LENGTH_AES_CBC); + cop->iv.phys_addr = rte_pktmbuf_mtophys(tx_mbufs[b]); + cop->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(cop->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + cop->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + cop->data.to_cipher.length = data_params[0].length; + + cop->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + cop->data.to_hash.length = data_params[0].length; + + rte_pktmbuf_attach_crypto_op(tx_mbufs[b], cop); + } + + printf("\nTest to measure the IA cycle cost using AES128_CBC_SHA256_HMAC algorithm with " + "a constant request size of %u.", data_params[0].length); + printf("\nThis test will keep retries at 0 and only measure IA cycle cost for each request."); + printf("\nDev No\tQP No\tNum Sent\tNum Received\tTx/Rx burst"); + printf("\tRetries (Device Busy)\tAverage IA cycle cost (assuming 0 retries)"); + for (b = 2; b <= 128 ; b *= 2) { + num_sent = 0; + num_received = 0; + retries = 0; + failed_polls = 0; + burst_size = b; + total_cycles = 0; + while (num_sent < num_to_submit) { + start_cycles = rte_rdtsc_precise(); + burst_sent = rte_cryptodev_enqueue_burst(dev_num, 0, + &tx_mbufs[num_sent], + ((num_to_submit-num_sent) < burst_size) ? + num_to_submit-num_sent : burst_size); + if (burst_sent == 0) + retries++; + else + num_sent += burst_sent; + end_cycles = rte_rdtsc_precise(); + total_cycles += (end_cycles - start_cycles); + /* + * Wait until requests have been sent. + */ + rte_delay_ms(1); + + start_cycles = rte_rdtsc_precise(); + burst_received = rte_cryptodev_dequeue_burst(dev_num, + 0, rx_mbufs, burst_size); + if (burst_received == 0) + failed_polls++; + else + num_received += burst_received; + end_cycles = rte_rdtsc_precise(); + total_cycles += end_cycles - start_cycles; + } + while (num_received != num_to_submit) { + if (gbl_cryptodev_preftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) + rte_cryptodev_enqueue_burst(dev_num, 0, NULL, 0); + + burst_received = rte_cryptodev_dequeue_burst(dev_num, + 0, rx_mbufs, burst_size); + if (burst_received == 0) + failed_polls++; + else + num_received += burst_received; + } + + printf("\n%u\t%u\t\%u\t\t%u\t\t%u", dev_num, 0, + num_sent, num_received, burst_size); + printf("\t\t%"PRIu64, retries); + printf("\t\t\t%"PRIu64, total_cycles/num_received); + } + printf("\n"); + + for (b = 0; b < max_outstanding_reqs ; b++) { + rte_crypto_op_free(tx_mbufs[b]->crypto_op); + rte_pktmbuf_free(tx_mbufs[b]); + } + return TEST_SUCCESS; +} + +static int +test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) +{ + uint16_t index; + uint32_t burst_sent, burst_received; + uint32_t b, num_sent, num_received, throughput; + uint64_t failed_polls, retries, start_cycles, end_cycles; + const uint64_t mhz = rte_get_tsc_hz()/1000000; + double mmps; + struct rte_mbuf *rx_mbufs[DEFAULT_BURST_SIZE], *tx_mbufs[DEFAULT_BURST_SIZE]; + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + struct crypto_data_params *data_params = aes_cbc_hmac_sha256_output; + + if (rte_cryptodev_count() == 0) { + printf("\nNo crypto devices available. Is kernel driver loaded?\n"); + return TEST_FAILED; + } + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_SYM_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_SYM_CIPHER_OP_ENCRYPT; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC; + + /* Setup HMAC Parameters */ + ut_params->auth_xform.type = RTE_CRYPTO_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_SYM_HASH_OP_DIGEST_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_SYM_HASH_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_session_create(ts_params->dev_id, + &ut_params->cipher_xform); + + TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); + + printf("\nThroughput test which will continually attempt to send AES128_CBC_SHA256_HMAC requests " + "with a constant burst size of %u while varying payload sizes", DEFAULT_BURST_SIZE); + printf("\nDev No\tQP No\tReq Size(B)\tNum Sent\tNum Received\tMrps\tThoughput(Mbps)"); + printf("\tRetries (Attempted a burst, but the device was busy)"); + for (index = 0; index < MAX_PACKET_SIZE_INDEX; index++) { + num_sent = 0; + num_received = 0; + retries = 0; + failed_polls = 0; + + /* Generate Crypto op data structure(s) */ + for (b = 0; b < DEFAULT_BURST_SIZE ; b++) { + tx_mbufs[b] = setup_test_string(ts_params->mbuf_mp, + data_params[index].plaintext, data_params[index].length, 0); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append( + tx_mbufs[b], DIGEST_BYTE_LENGTH_SHA256); + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + rte_memcpy(ut_params->digest, data_params[index].expected.digest, + DIGEST_BYTE_LENGTH_SHA256); + struct rte_crypto_op_data *cop = rte_crypto_op_alloc(ts_params->crypto_op_mp); + TEST_ASSERT_NOT_NULL(cop, "Failed to allocate crypto_op"); + + rte_crypto_op_attach_session(cop, ut_params->sess); + + cop->digest.data = ut_params->digest; + cop->digest.phys_addr = rte_pktmbuf_mtophys_offset( + tx_mbufs[b], data_params[index].length); + cop->digest.length = DIGEST_BYTE_LENGTH_SHA256; + + cop->iv.data = (uint8_t *)rte_pktmbuf_prepend(tx_mbufs[b], + CIPHER_IV_LENGTH_AES_CBC); + cop->iv.phys_addr = rte_pktmbuf_mtophys(tx_mbufs[b]); + cop->iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(cop->iv.data, aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + + cop->data.to_cipher.offset = CIPHER_IV_LENGTH_AES_CBC; + cop->data.to_cipher.length = data_params[index].length; + + cop->data.to_hash.offset = CIPHER_IV_LENGTH_AES_CBC; + cop->data.to_hash.length = data_params[index].length; + + rte_pktmbuf_attach_crypto_op(tx_mbufs[b], cop); + } + start_cycles = rte_rdtsc_precise(); + while (num_sent < DEFAULT_NUM_REQS_TO_SUBMIT) { + burst_sent = rte_cryptodev_enqueue_burst(dev_num, 0, tx_mbufs, + ((DEFAULT_NUM_REQS_TO_SUBMIT-num_sent) < DEFAULT_BURST_SIZE) ? + DEFAULT_NUM_REQS_TO_SUBMIT-num_sent : DEFAULT_BURST_SIZE); + if (burst_sent == 0) + retries++; + else + num_sent += burst_sent; + + burst_received = rte_cryptodev_dequeue_burst(dev_num, 0, rx_mbufs, DEFAULT_BURST_SIZE); + if (burst_received == 0) + failed_polls++; + else + num_received += burst_received; + } + while (num_received != DEFAULT_NUM_REQS_TO_SUBMIT) { + if (gbl_cryptodev_preftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) + rte_cryptodev_enqueue_burst(dev_num, 0, NULL, 0); + + burst_received = rte_cryptodev_dequeue_burst(dev_num, 0, + rx_mbufs, DEFAULT_BURST_SIZE); + if (burst_received == 0) + failed_polls++; + else + num_received += burst_received; + } + end_cycles = rte_rdtsc_precise(); + mmps = (double)num_received*mhz/(end_cycles - start_cycles); + throughput = mmps*data_params[index].length*8; + printf("\n%u\t%u\t%u\t\t%u\t%u", dev_num, 0, data_params[index].length, num_sent, num_received); + printf("\t%.2f\t%u", mmps, throughput); + printf("\t\t%"PRIu64, retries); + for (b = 0; b < DEFAULT_BURST_SIZE ; b++) { + rte_crypto_op_free(tx_mbufs[b]->crypto_op); + rte_pktmbuf_free(tx_mbufs[b]); + } + } + printf("\n"); + return TEST_SUCCESS; +} + +static int +test_perf_encrypt_digest_vary_req_size(void) +{ + return test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(testsuite_params.dev_id); +} + +static int +test_perf_vary_burst_size(void) +{ + return test_perf_crypto_qp_vary_burst_size(testsuite_params.dev_id); +} + + +static struct unit_test_suite cryptodev_testsuite = { + .suite_name = "Crypto Device Unit Test Suite", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(ut_setup, ut_teardown, test_perf_encrypt_digest_vary_req_size), + TEST_CASE_ST(ut_setup, ut_teardown, test_perf_vary_burst_size), + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + +static int +perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) +{ + gbl_cryptodev_preftest_devtype = RTE_CRYPTODEV_AESNI_MB_PMD; + + return unit_test_suite_runner(&cryptodev_testsuite); +} + +static int +perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) +{ + gbl_cryptodev_preftest_devtype = RTE_CRYPTODEV_QAT_PMD; + + return unit_test_suite_runner(&cryptodev_testsuite); +} + +static struct test_command cryptodev_aesni_mb_perf_cmd = { + .command = "cryptodev_aesni_mb_perftest", + .callback = perftest_aesni_mb_cryptodev, +}; + +static struct test_command cryptodev_qat_perf_cmd = { + .command = "cryptodev_qat_perftest", + .callback = perftest_qat_cryptodev, +}; + +REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perf_cmd); +REGISTER_TEST_COMMAND(cryptodev_qat_perf_cmd); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 388cf11..2d98958 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4020,7 +4020,7 @@ test_close_bonded_device(void) return 0; } -static int +static void testsuite_teardown(void) { if (test_params->pkt_eth_hdr != NULL) { @@ -4029,7 +4029,7 @@ testsuite_teardown(void) } /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + remove_slaves_and_stop_bonded_device(); } static void @@ -4993,7 +4993,7 @@ static struct unit_test_suite link_bonding_test_suite = { TEST_CASE(test_reconfigure_bonded_device), TEST_CASE(test_close_bonded_device), - { NULL, NULL, NULL, NULL, NULL } /**< NULL terminate unit test array */ + TEST_CASES_END() /**< NULL terminate unit test array */ } }; diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 460539d..713368d 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -453,7 +453,7 @@ test_setup(void) return 0; } -static int +static void testsuite_teardown(void) { struct slave_conf *port; @@ -467,8 +467,6 @@ testsuite_teardown(void) FOR_EACH_PORT(i, port) rte_eth_dev_stop(port->port_id); - - return 0; } /* @@ -1390,7 +1388,8 @@ static struct unit_test_suite link_bonding_mode4_test_suite = { TEST_CASE_NAMED("test_mode4_tx_burst", test_mode4_tx_burst_wrapper), TEST_CASE_NAMED("test_mode4_marker", test_mode4_marker_wrapper), TEST_CASE_NAMED("test_mode4_expired", test_mode4_expired_wrapper), - { NULL, NULL, NULL, NULL, NULL } /**< NULL terminate unit test array */ + + TEST_CASES_END() /**< NULL terminate unit test array */ } }; -- 2.4.3