* [PATCH 2/2] test/crypto: handle returns from raw crypto APIs
2023-05-22 11:56 [PATCH 1/2] cryptodev: update raw datapath API documentation Anoob Joseph
@ 2023-05-22 11:56 ` Anoob Joseph
2023-05-25 7:59 ` Akhil Goyal
2023-05-25 7:57 ` [PATCH 1/2] cryptodev: update raw datapath API documentation Akhil Goyal
1 sibling, 1 reply; 5+ messages in thread
From: Anoob Joseph @ 2023-05-22 11:56 UTC (permalink / raw)
To: Ciara Power, Akhil Goyal, Fan Zhang
Cc: Gagandeep Singh, Hemant Agrawal, Jerin Jacob, Tejasree Kondoj,
Vidya Sagar Velumuri, dev
Raw crypto APIs may return -ENOTSUP when the cryptodev does not support
the requested feature. Handle it gracefully so that tests get marked as
"SKIPPED" instead of "FAILED".
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
app/test/test_cryptodev.c | 449 +++++++++++++++-----------
app/test/test_cryptodev.h | 2 +-
app/test/test_cryptodev_blockcipher.c | 12 +-
3 files changed, 279 insertions(+), 184 deletions(-)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index f48d837a50..fc82e3c305 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -195,7 +195,7 @@ static struct crypto_testsuite_params testsuite_params = { NULL };
struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
static struct crypto_unittest_params unittest_params;
-void
+int
process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
uint8_t len_in_bits, uint8_t cipher_iv_len)
@@ -221,26 +221,25 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
int enqueue_status, dequeue_status;
struct crypto_unittest_params *ut_params = &unittest_params;
int is_sgl = sop->m_src->nb_segs > 1;
- int is_oop = 0;
+ int ret = TEST_SUCCESS, is_oop = 0;
ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
- if (ctx_service_size < 0) {
- op->status = RTE_CRYPTO_OP_STATUS_ERROR;
- return;
- }
+ if (ctx_service_size < 0)
+ return TEST_SKIPPED;
ctx = malloc(ctx_service_size);
- if (!ctx) {
- op->status = RTE_CRYPTO_OP_STATUS_ERROR;
- return;
- }
+ if (ctx == NULL)
+ return TEST_FAILED;
/* Both are enums, setting crypto_sess will suit any session type */
sess.crypto_sess = op->sym->session;
- if (rte_cryptodev_configure_raw_dp_ctx(dev_id, qp_id, ctx,
- op->sess_type, sess, 0) < 0) {
- op->status = RTE_CRYPTO_OP_STATUS_ERROR;
+ ret = rte_cryptodev_configure_raw_dp_ctx(dev_id, qp_id, ctx, op->sess_type, sess, 0);
+ if (ret == -ENOTSUP) {
+ ret = TEST_SKIPPED;
+ goto exit;
+ } else if (ret) {
+ ret = TEST_FAILED;
goto exit;
}
@@ -433,6 +432,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
exit:
free(ctx);
+ return ret;
}
static void
@@ -2340,6 +2340,8 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(void *sess,
const uint8_t *digest,
const uint8_t *iv)
{
+ int ret;
+
/* Generate test mbuf data and digest */
ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
(const char *)
@@ -2385,10 +2387,11 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(void *sess,
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ ret = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 0, 0);
+ if (ret != TEST_SUCCESS)
+ return ret;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op),
@@ -3143,10 +3146,12 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 1, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 1,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
ut_params->obuf = ut_params->op->sym->m_src;
@@ -3235,10 +3240,12 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 1, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 1,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -3322,10 +3329,12 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 1, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 1,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -3409,10 +3418,12 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 1, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 1,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -3633,10 +3644,12 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -3732,10 +3745,12 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4091,10 +4106,12 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4183,10 +4200,12 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4284,10 +4303,12 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4403,10 +4424,12 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4534,10 +4557,12 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4636,10 +4661,12 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4736,10 +4763,12 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4830,10 +4859,12 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -4942,10 +4973,12 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -5092,10 +5125,12 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -5299,10 +5334,12 @@ test_snow3g_auth_cipher_sgl(const struct snow3g_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -5500,10 +5537,12 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -5704,10 +5743,12 @@ test_kasumi_auth_cipher_sgl(const struct kasumi_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -5862,10 +5903,12 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -6031,10 +6074,12 @@ test_zuc_cipher(const struct wireless_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -6166,10 +6211,12 @@ test_zuc_cipher_sgl(const struct wireless_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 0, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 0, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -6284,10 +6331,12 @@ test_zuc_authentication(const struct wireless_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 1, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 1,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
@@ -6439,10 +6488,12 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -6642,10 +6693,12 @@ test_zuc_auth_cipher_sgl(const struct wireless_test_data *tdata,
if (retval < 0)
return retval;
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 1, tdata->cipher_iv.len);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 1,
+ tdata->cipher_iv.len);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -8876,10 +8929,12 @@ test_authenticated_encryption(const struct aead_test_data *tdata)
/* Process crypto operation */
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_aead_op(ts_params->valid_devs[0], ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 0, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 0, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
@@ -9103,8 +9158,10 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,
/* filling lengths */
ut_params->op->sym->cipher.data.length = ut_params->op->sym->m_src->pkt_len;
ut_params->op->sym->auth.data.length = ut_params->op->sym->m_src->pkt_len;
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 0, 0);
+
+ ret = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 0, 0);
+ if (ret != TEST_SUCCESS)
+ return ret;
} else {
ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op);
}
@@ -9384,8 +9441,10 @@ test_pdcp_proto_SGL(int i, int oop,
+= temp_mbuf->pkt_len;
temp_mbuf = temp_mbuf->next;
}
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 0, 0);
+
+ ret = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 0, 0);
+ if (ret != TEST_SUCCESS)
+ return ret;
} else {
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -11580,10 +11639,12 @@ test_authenticated_decryption(const struct aead_test_data *tdata)
/* Process crypto operation */
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_aead_op(ts_params->valid_devs[0], ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 0, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 0, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
@@ -11919,10 +11980,12 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata)
ut_params->op->sym->m_dst = ut_params->obuf;
/* Process crypto operation */
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 0, 0, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 0, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
@@ -12023,10 +12086,12 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata)
ut_params->op->sym->m_dst = ut_params->obuf;
/* Process crypto operation */
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 0, 0, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 0, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
@@ -12227,10 +12292,12 @@ test_authenticated_decryption_sessionless(
"crypto op session type not sessionless");
/* Process crypto operation */
- if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 0, 0, 0);
- else
+ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 0, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(process_crypto_request(
ts_params->valid_devs[0], ut_params->op),
"failed to process sym crypto op");
@@ -12596,6 +12663,7 @@ test_MD5_HMAC_generate(const struct HMAC_MD5_vector *test_case)
{
uint16_t plaintext_pad_len;
uint8_t *plaintext, *auth_tag;
+ int ret;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -12637,10 +12705,11 @@ test_MD5_HMAC_generate(const struct HMAC_MD5_vector *test_case)
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ ret = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0, 0);
+ if (ret != TEST_SUCCESS)
+ return ret;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op),
@@ -12669,6 +12738,7 @@ static int
test_MD5_HMAC_verify(const struct HMAC_MD5_vector *test_case)
{
uint8_t *plaintext;
+ int ret;
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -12708,10 +12778,11 @@ test_MD5_HMAC_verify(const struct HMAC_MD5_vector *test_case)
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ ret = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0, 0);
+ if (ret != TEST_SUCCESS)
+ return ret;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op),
@@ -13581,10 +13652,12 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
@@ -13713,10 +13786,12 @@ test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata)
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
@@ -14451,10 +14526,12 @@ test_authentication_verify_fail_when_data_corruption(
TEST_ASSERT_NOT_EQUAL(ut_params->op->status,
RTE_CRYPTO_OP_STATUS_SUCCESS,
"authentication not failed");
- } else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 0, 0);
- else {
+ } else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else {
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
}
@@ -14538,10 +14615,12 @@ test_authentication_verify_GMAC_fail_when_corruption(
TEST_ASSERT_NOT_EQUAL(ut_params->op->status,
RTE_CRYPTO_OP_STATUS_SUCCESS,
"authentication not failed");
- } else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 1, 0, 0);
- else {
+ } else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else {
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NULL(ut_params->op, "authentication not failed");
@@ -14629,10 +14708,12 @@ test_authenticated_decryption_fail_when_corruption(
TEST_ASSERT_NOT_EQUAL(ut_params->op->status,
RTE_CRYPTO_OP_STATUS_SUCCESS,
"authentication not failed");
- } else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 0, 0);
- else {
+ } else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else {
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NULL(ut_params->op, "authentication not failed");
@@ -14734,10 +14815,12 @@ test_authenticated_encrypt_with_esn(
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(
ts_params->valid_devs[0], ut_params->op);
@@ -14864,10 +14947,12 @@ test_authenticated_decrypt_with_esn(
if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_crypt_auth_op(ts_params->valid_devs[0],
ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 1, 1, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 1, 1, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
@@ -15222,10 +15307,12 @@ test_authenticated_encryption_SGL(const struct aead_test_data *tdata,
if (oop == IN_PLACE &&
gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
process_cpu_aead_op(ts_params->valid_devs[0], ut_params->op);
- else if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
- process_sym_raw_dp_op(ts_params->valid_devs[0], 0,
- ut_params->op, 0, 0, 0, 0);
- else
+ else if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
+ retval = process_sym_raw_dp_op(ts_params->valid_devs[0], 0, ut_params->op, 0, 0, 0,
+ 0);
+ if (retval != TEST_SUCCESS)
+ return retval;
+ } else
TEST_ASSERT_NOT_NULL(
process_crypto_request(ts_params->valid_devs[0],
ut_params->op), "failed to process sym crypto op");
diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h
index abd795f54a..f2c417a267 100644
--- a/app/test/test_cryptodev.h
+++ b/app/test/test_cryptodev.h
@@ -235,7 +235,7 @@ create_segmented_mbuf(struct rte_mempool *mbuf_pool, int pkt_len,
return NULL;
}
-void
+int
process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
uint8_t len_in_bits, uint8_t cipher_iv_len);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 6c9a5964ea..e6469d03b5 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -555,8 +555,16 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
is_auth = 1;
- process_sym_raw_dp_op(dev_id, 0, op, is_cipher, is_auth, 0,
- tdata->iv.len);
+ status = process_sym_raw_dp_op(dev_id, 0, op, is_cipher, is_auth,
+ 0, tdata->iv.len);
+ if (status != TEST_SUCCESS) {
+ if (status == TEST_SKIPPED)
+ snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "SKIPPED");
+ else
+ snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "FAILED");
+
+ goto error_exit;
+ }
} else {
if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread