struct crypto_testsuite_params {
struct rte_mempool *mbuf_pool;
+ struct rte_mempool *large_mbuf_pool;
struct rte_mempool *op_mpool;
struct rte_cryptodev_config conf;
struct rte_cryptodev_qp_conf qp_conf;
/* Not already created so create */
ts_params->mbuf_pool = rte_pktmbuf_pool_create(
"CRYPTO_MBUFPOOL",
- NUM_MBUFS, MBUF_CACHE_SIZE, 0, UINT16_MAX,
+ 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");
}
}
+ ts_params->large_mbuf_pool = rte_mempool_lookup(
+ "CRYPTO_LARGE_MBUFPOOL");
+ if (ts_params->large_mbuf_pool == NULL) {
+ /* Not already created so create */
+ ts_params->large_mbuf_pool = rte_pktmbuf_pool_create(
+ "CRYPTO_LARGE_MBUFPOOL",
+ 1, 0, 0, UINT16_MAX,
+ rte_socket_id());
+ if (ts_params->large_mbuf_pool == NULL) {
+ RTE_LOG(ERR, USER1,
+ "Can't create CRYPTO_LARGE_MBUFPOOL\n");
+ return TEST_FAILED;
+ }
+ }
+
ts_params->op_mpool = rte_crypto_op_pool_create(
"MBUF_CRYPTO_SYM_OP_POOL",
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
}
}
- /* Create 2 LIBCRYPTO devices if required */
- if (gbl_cryptodev_type == RTE_CRYPTODEV_LIBCRYPTO_PMD) {
-#ifndef RTE_LIBRTE_PMD_LIBCRYPTO
- RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO must be"
+ /* Create 2 OPENSSL devices if required */
+ if (gbl_cryptodev_type == RTE_CRYPTODEV_OPENSSL_PMD) {
+#ifndef RTE_LIBRTE_PMD_OPENSSL
+ RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
" enabled in config file to run this testsuite.\n");
return TEST_FAILED;
#endif
nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_LIBCRYPTO_PMD);
+ RTE_CRYPTODEV_OPENSSL_PMD);
if (nb_devs < 2) {
for (i = nb_devs; i < 2; i++) {
ret = rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD),
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
NULL);
TEST_ASSERT(ret == 0, "Failed to create "
"instance %u of pmd : %s", i,
- RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD));
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
}
}
}
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];
- rte_cryptodev_info_get(dev_id, &info);
+ dev_id = ts_params->valid_devs[0];
- /*
- * 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
- */
+ rte_cryptodev_info_get(dev_id, &info);
- ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
- ts_params->conf.socket_id = SOCKET_ID_ANY;
- ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
+ ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
+ ts_params->conf.socket_id = SOCKET_ID_ANY;
+ ts_params->conf.session_mp.nb_objs = info.sym.max_nb_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);
+ 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;
+ ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
- for (qp_id = 0; qp_id < info.max_nb_queue_pairs; 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);
- }
+ for (qp_id = 0; qp_id < info.max_nb_queue_pairs; 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;
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 = DEFAULT_NUM_OPS_INFLIGHT;
"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,
test_device_configure_invalid_queue_pair_ids(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
+ uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;
/* Stop the device in case it's started so it can be configured */
rte_cryptodev_stop(ts_params->valid_devs[0]);
ts_params->valid_devs[0],
ts_params->conf.nb_queue_pairs);
+ /* revert to original testsuite value */
+ ts_params->conf.nb_queue_pairs = orig_nb_qps;
+
return TEST_SUCCESS;
}
}
static int
-test_AES_chain_libcrypto_all(void)
+test_AES_chain_openssl_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_LIBCRYPTO_PMD,
+ RTE_CRYPTODEV_OPENSSL_PMD,
BLKCIPHER_AES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
}
static int
-test_AES_cipheronly_libcrypto_all(void)
+test_AES_cipheronly_openssl_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_LIBCRYPTO_PMD,
+ RTE_CRYPTODEV_OPENSSL_PMD,
BLKCIPHER_AES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
}
static int
-test_authonly_libcrypto_all(void)
+test_authonly_openssl_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_LIBCRYPTO_PMD,
+ RTE_CRYPTODEV_OPENSSL_PMD,
BLKCIPHER_AUTHONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
}
static int
-test_3DES_chain_libcrypto_all(void)
+test_3DES_chain_openssl_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_LIBCRYPTO_PMD,
+ RTE_CRYPTODEV_OPENSSL_PMD,
BLKCIPHER_3DES_CHAIN_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
}
static int
-test_3DES_cipheronly_libcrypto_all(void)
+test_3DES_cipheronly_openssl_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
int status;
status = test_blockcipher_all_tests(ts_params->mbuf_pool,
ts_params->op_mpool, ts_params->valid_devs[0],
- RTE_CRYPTODEV_LIBCRYPTO_PMD,
+ RTE_CRYPTODEV_OPENSSL_PMD,
BLKCIPHER_3DES_CIPHERONLY_TYPE);
TEST_ASSERT_EQUAL(status, 0, "Test failed");
if (retval < 0)
return retval;
- ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+ if (tdata->aad.len > MBUF_SIZE)
+ ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
+ else
+ ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+ TEST_ASSERT_NOT_NULL(ut_params->ibuf,
+ "Failed to allocate input buffer in mempool");
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
if (retval < 0)
return retval;
- ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+ if (tdata->aad.len > MBUF_SIZE)
+ ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
+ else
+ ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+ TEST_ASSERT_NOT_NULL(ut_params->ibuf,
+ "Failed to allocate input buffer in mempool");
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_cipher_auth_test_case_1),
+ /** Negative tests */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ authentication_verify_HMAC_SHA1_fail_data_corrupt),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ authentication_verify_HMAC_SHA1_fail_tag_corrupt),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ authentication_verify_AES128_GMAC_fail_data_corrupt),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ authentication_verify_AES128_GMAC_fail_tag_corrupt),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
+
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
}
};
-static struct unit_test_suite cryptodev_libcrypto_testsuite = {
- .suite_name = "Crypto Device LIBCRYPTO Unit Test Suite",
+static struct unit_test_suite cryptodev_openssl_testsuite = {
+ .suite_name = "Crypto Device OPENSSL Unit Test Suite",
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_multi_session_random_usage),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_chain_libcrypto_all),
+ test_AES_chain_openssl_all),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_cipheronly_libcrypto_all),
+ test_AES_cipheronly_openssl_all),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_3DES_chain_libcrypto_all),
+ test_3DES_chain_openssl_all),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_3DES_cipheronly_libcrypto_all),
+ test_3DES_cipheronly_openssl_all),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_authonly_libcrypto_all),
+ test_authonly_openssl_all),
/** AES GCM Authenticated Encryption */
TEST_CASE_ST(ut_setup, ut_teardown,
}
static int
-test_cryptodev_libcrypto(void)
+test_cryptodev_openssl(void)
{
- gbl_cryptodev_type = RTE_CRYPTODEV_LIBCRYPTO_PMD;
+ gbl_cryptodev_type = RTE_CRYPTODEV_OPENSSL_PMD;
- return unit_test_suite_runner(&cryptodev_libcrypto_testsuite);
+ return unit_test_suite_runner(&cryptodev_openssl_testsuite);
}
static int
REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat);
REGISTER_TEST_COMMAND(cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb);
-REGISTER_TEST_COMMAND(cryptodev_libcrypto_autotest, test_cryptodev_libcrypto);
+REGISTER_TEST_COMMAND(cryptodev_openssl_autotest, test_cryptodev_openssl);
REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_autotest, test_cryptodev_aesni_gcm);
REGISTER_TEST_COMMAND(cryptodev_null_autotest, test_cryptodev_null);
REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_autotest, test_cryptodev_sw_snow3g);