From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, akhil.goyal@nxp.com
Cc: ravi1.kumar@amd.com, ruifeng.wang@arm.com, anoobj@marvell.com,
roy.fan.zhang@intel.com, declan.doherty@intel.com,
pablo.de.lara.guarch@intel.com, rnagadheeraj@marvell.com,
adwivedi@marvell.com, g.singh@nxp.com, jianjay.zhou@huawei.com,
lironh@marvell.com, Adam Dybkowski <adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH v3 3/4] test/crypto: add capability checks
Date: Fri, 13 Dec 2019 16:22:43 +0100 [thread overview]
Message-ID: <20191213152245.13477-4-adamx.dybkowski@intel.com> (raw)
In-Reply-To: <20191213152245.13477-1-adamx.dybkowski@intel.com>
This patch adds capability checks to many tests meant to be run
in the future on various PMDs. This way the code is prepared for
more thorough refactoring in order to create one big central
unit tests array.
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
app/test/test_cryptodev.c | 616 +++++++++++++++++++++++++++++++++++++-
1 file changed, 615 insertions(+), 1 deletion(-)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 412a24e2f..290df0b69 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -669,6 +669,13 @@ 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;
+ /* This test is for QAT and NITROX PMDs only */
+ if (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)) &&
+ gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NITROX_PMD)))
+ return -ENOTSUP;
+
/* Stop the device in case it's started so it can be configured */
rte_cryptodev_stop(ts_params->valid_devs[0]);
@@ -740,6 +747,11 @@ test_queue_pair_descriptor_setup(void)
uint16_t qp_id;
+ /* This test is for QAT PMD only */
+ if (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)))
+ return -ENOTSUP;
+
/* Stop the device in case it's started so it can be configured */
rte_cryptodev_stop(ts_params->valid_devs[0]);
@@ -1348,6 +1360,19 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SHA1_HMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* 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);
@@ -2314,6 +2339,20 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
unsigned plaintext_len;
uint8_t *plaintext;
+ /* QAT PMD supports byte-aligned data only */
+ if ((tdata->validAuthLenInBits.len % 8 != 0) &&
+ (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))))
+ return -ENOTSUP;
+
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
@@ -2374,6 +2413,20 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
unsigned plaintext_len;
uint8_t *plaintext;
+ /* QAT PMD supports byte-aligned data only */
+ if ((tdata->validAuthLenInBits.len % 8 != 0) &&
+ (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))))
+ return -ENOTSUP;
+
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
@@ -2434,6 +2487,14 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
unsigned plaintext_len;
uint8_t *plaintext;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
@@ -2494,6 +2555,14 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
unsigned plaintext_len;
uint8_t *plaintext;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
@@ -2693,6 +2762,14 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
unsigned plaintext_pad_len;
unsigned plaintext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -2765,6 +2842,14 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -2843,6 +2928,14 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
unsigned plaintext_pad_len;
unsigned plaintext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -2916,6 +3009,14 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -2993,6 +3094,14 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
unsigned ciphertext_pad_len;
unsigned ciphertext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
@@ -3062,6 +3171,14 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
unsigned ciphertext_pad_len;
unsigned ciphertext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
@@ -3129,6 +3246,14 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
unsigned plaintext_pad_len;
unsigned plaintext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -3195,6 +3320,14 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
unsigned plaintext_pad_len;
unsigned plaintext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -3270,6 +3403,14 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -3371,6 +3512,19 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
uint8_t extra_offset = 4;
uint8_t *expected_ciphertext_shifted;
+ /* QAT PMD supports byte-aligned data only */
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)))
+ return -ENOTSUP;
+
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -3462,6 +3616,14 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
unsigned ciphertext_pad_len;
unsigned ciphertext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
@@ -3525,6 +3687,14 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
unsigned ciphertext_pad_len;
unsigned ciphertext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
@@ -3685,6 +3855,19 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
unsigned plaintext_pad_len;
unsigned plaintext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create SNOW 3G session */
retval = create_wireless_algo_cipher_auth_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -3772,6 +3955,19 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata,
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -3936,6 +4132,19 @@ test_snow3g_auth_cipher_sgl(const struct snow3g_test_data *tdata,
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -4116,6 +4325,19 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata,
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -4282,6 +4504,19 @@ test_kasumi_auth_cipher_sgl(const struct kasumi_test_data *tdata,
struct rte_cryptodev_info dev_info;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
@@ -4457,6 +4692,19 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
unsigned plaintext_pad_len;
unsigned plaintext_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_KASUMI_F9;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create KASUMI session */
retval = create_wireless_algo_cipher_auth_session(
ts_params->valid_devs[0],
@@ -4711,6 +4959,12 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
struct rte_cryptodev_sym_capability_idx cap_idx;
+ /* QAT PMD supports byte-aligned data only */
+ if ((tdata->validAuthLenInBits.len % 8 != 0) &&
+ (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))))
+ return -ENOTSUP;
+
/* Check if device supports ZUC EIA3 */
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
@@ -4762,7 +5016,7 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
TEST_ASSERT_BUFFERS_ARE_EQUAL(
ut_params->digest,
tdata->digest.data,
- DIGEST_BYTE_LENGTH_KASUMI_F9,
+ tdata->digest.len,
"ZUC Generated auth tag not as expected");
return 0;
@@ -5652,6 +5906,11 @@ test_zuc_hash_generate_test_case_6(void)
static int
test_zuc_hash_generate_test_case_7(void)
{
+ /* This test is not for SW ZUC PMD */
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ZUC_PMD)))
+ return -ENOTSUP;
+
return test_zuc_authentication(&zuc_test_case_auth_2080b);
}
@@ -5676,6 +5935,11 @@ test_zuc_cipher_auth_test_case_2(void)
static int
test_zuc_auth_cipher_test_case_1(void)
{
+ /* This test is not for SW ZUC PMD */
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_ZUC_PMD)))
+ return -ENOTSUP;
+
return test_zuc_auth_cipher(
&zuc_auth_cipher_test_case_1, IN_PLACE, 0);
}
@@ -6632,6 +6896,20 @@ test_authenticated_encryption(const struct aead_test_data *tdata)
uint16_t plaintext_pad_len;
uint32_t i;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ const struct rte_cryptodev_symmetric_capability *capability;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ capability = rte_cryptodev_sym_capability_get(
+ ts_params->valid_devs[0], &cap_idx);
+ if (capability == NULL)
+ return -ENOTSUP;
+ if (rte_cryptodev_sym_capability_check_aead(
+ capability, tdata->key.len, tdata->auth_tag.len,
+ tdata->aad.len, tdata->iv.len))
+ return -ENOTSUP;
+
/* Create AEAD session */
retval = create_aead_session(ts_params->valid_devs[0],
tdata->algo,
@@ -6724,6 +7002,21 @@ test_pdcp_proto(int i, int oop,
uint8_t *plaintext;
int ret = TEST_SUCCESS;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ if (pdcp_test_params[i].auth_alg != 0) {
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = pdcp_test_params[i].auth_alg;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ }
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = pdcp_test_params[i].cipher_alg;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Generate test mbuf data */
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -6890,6 +7183,21 @@ test_pdcp_proto_SGL(int i, int oop,
int segs = 1;
unsigned int trn_data = 0;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ if (pdcp_test_params[i].auth_alg != 0) {
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = pdcp_test_params[i].auth_alg;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ }
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = pdcp_test_params[i].cipher_alg;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
if (fragsz > input_vec_len)
fragsz = input_vec_len;
@@ -7434,6 +7742,8 @@ test_AES_GCM_auth_encryption_fail_iv_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.iv.data[0] += 1;
res = test_authenticated_encryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "encryption not failed");
return TEST_SUCCESS;
}
@@ -7448,6 +7758,8 @@ test_AES_GCM_auth_encryption_fail_in_data_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.plaintext.data[0] += 1;
res = test_authenticated_encryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "encryption not failed");
return TEST_SUCCESS;
}
@@ -7462,6 +7774,8 @@ test_AES_GCM_auth_encryption_fail_out_data_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.ciphertext.data[0] += 1;
res = test_authenticated_encryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "encryption not failed");
return TEST_SUCCESS;
}
@@ -7476,6 +7790,8 @@ test_AES_GCM_auth_encryption_fail_aad_len_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.aad.len += 1;
res = test_authenticated_encryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "encryption not failed");
return TEST_SUCCESS;
}
@@ -7493,6 +7809,8 @@ test_AES_GCM_auth_encryption_fail_aad_corrupt(void)
aad[0] += 1;
tdata.aad.data = aad;
res = test_authenticated_encryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "encryption not failed");
return TEST_SUCCESS;
}
@@ -7507,6 +7825,8 @@ test_AES_GCM_auth_encryption_fail_tag_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.auth_tag.data[0] += 1;
res = test_authenticated_encryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "encryption not failed");
return TEST_SUCCESS;
}
@@ -7521,6 +7841,20 @@ test_authenticated_decryption(const struct aead_test_data *tdata)
uint8_t *plaintext;
uint32_t i;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ const struct rte_cryptodev_symmetric_capability *capability;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ capability = rte_cryptodev_sym_capability_get(
+ ts_params->valid_devs[0], &cap_idx);
+ if (capability == NULL)
+ return -ENOTSUP;
+ if (rte_cryptodev_sym_capability_check_aead(
+ capability, tdata->key.len, tdata->auth_tag.len,
+ tdata->aad.len, tdata->iv.len))
+ return -ENOTSUP;
+
/* Create AEAD session */
retval = create_aead_session(ts_params->valid_devs[0],
tdata->algo,
@@ -7736,6 +8070,8 @@ test_AES_GCM_auth_decryption_fail_iv_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.iv.data[0] += 1;
res = test_authenticated_decryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "decryption not failed");
return TEST_SUCCESS;
}
@@ -7750,6 +8086,8 @@ test_AES_GCM_auth_decryption_fail_in_data_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.plaintext.data[0] += 1;
res = test_authenticated_decryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "decryption not failed");
return TEST_SUCCESS;
}
@@ -7763,6 +8101,8 @@ test_AES_GCM_auth_decryption_fail_out_data_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.ciphertext.data[0] += 1;
res = test_authenticated_decryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "decryption not failed");
return TEST_SUCCESS;
}
@@ -7776,6 +8116,8 @@ test_AES_GCM_auth_decryption_fail_aad_len_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.aad.len += 1;
res = test_authenticated_decryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "decryption not failed");
return TEST_SUCCESS;
}
@@ -7792,6 +8134,8 @@ test_AES_GCM_auth_decryption_fail_aad_corrupt(void)
aad[0] += 1;
tdata.aad.data = aad;
res = test_authenticated_decryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "decryption not failed");
return TEST_SUCCESS;
}
@@ -7805,6 +8149,8 @@ test_AES_GCM_auth_decryption_fail_tag_corrupt(void)
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
tdata.auth_tag.data[0] += 1;
res = test_authenticated_decryption(&tdata);
+ if (res == -ENOTSUP)
+ return res;
TEST_ASSERT_EQUAL(res, TEST_FAILED, "authentication not failed");
return TEST_SUCCESS;
}
@@ -7819,6 +8165,14 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata)
uint8_t *ciphertext, *auth_tag;
uint16_t plaintext_pad_len;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create AEAD session */
retval = create_aead_session(ts_params->valid_devs[0],
tdata->algo,
@@ -7896,6 +8250,14 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata)
int retval;
uint8_t *plaintext;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create AEAD session */
retval = create_aead_session(ts_params->valid_devs[0],
tdata->algo,
@@ -7968,6 +8330,21 @@ test_authenticated_encryption_sessionless(
uint16_t plaintext_pad_len;
uint8_t key[tdata->key.len + 1];
+ /* This test is for AESNI MB and AESNI GCM PMDs only */
+ if ((gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) &&
+ (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))))
+ return -ENOTSUP;
+
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
/* clear mbuf payload */
@@ -8049,6 +8426,21 @@ test_authenticated_decryption_sessionless(
uint8_t *plaintext;
uint8_t key[tdata->key.len + 1];
+ /* This test is for AESNI MB and AESNI GCM PMDs only */
+ if ((gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) &&
+ (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))))
+ return -ENOTSUP;
+
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* alloc mbuf and set payload */
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -8227,6 +8619,19 @@ test_stats(void)
struct rte_cryptodev *dev;
cryptodev_stats_get_t temp_pfn;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SHA1_HMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0] + 600,
&stats) == -ENODEV),
@@ -8361,6 +8766,14 @@ test_MD5_HMAC_generate(const struct HMAC_MD5_vector *test_case)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_MD5_HMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
if (MD5_HMAC_create_session(ts_params, ut_params,
RTE_CRYPTO_AUTH_OP_GENERATE, test_case))
return TEST_FAILED;
@@ -8407,6 +8820,14 @@ test_MD5_HMAC_verify(const struct HMAC_MD5_vector *test_case)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_MD5_HMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
if (MD5_HMAC_create_session(ts_params, ut_params,
RTE_CRYPTO_AUTH_OP_VERIFY, test_case)) {
return TEST_FAILED;
@@ -8465,6 +8886,19 @@ test_multi_session(void)
uint16_t i;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SHA512_HMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(ut_params,
aes_cbc_key, hmac_sha512_key);
@@ -8580,6 +9014,19 @@ test_multi_session_random_usage(void)
};
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_SHA512_HMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
sessions = rte_malloc(NULL,
@@ -8662,6 +9109,14 @@ test_null_cipher_only_operation(void)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* 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);
@@ -8728,6 +9183,14 @@ test_null_auth_only_operation(void)
struct crypto_unittest_params *ut_params = &unittest_params;
uint8_t *digest;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* 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);
@@ -8800,6 +9263,19 @@ test_null_cipher_auth_operation(void)
struct crypto_unittest_params *ut_params = &unittest_params;
uint8_t *digest;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* 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);
@@ -8888,6 +9364,19 @@ test_null_auth_cipher_operation(void)
struct crypto_unittest_params *ut_params = &unittest_params;
uint8_t *digest;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Generate test mbuf data */
ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
catch_22_quote, QUOTE_512_BYTES, 0);
@@ -8977,6 +9466,11 @@ test_null_invalid_operation(void)
struct crypto_unittest_params *ut_params = &unittest_params;
int ret;
+ /* This test is for NULL PMD only */
+ if (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
+ return -ENOTSUP;
+
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.next = NULL;
@@ -9029,6 +9523,11 @@ test_null_burst_operation(void)
struct rte_crypto_op *burst[NULL_BURST_LENGTH] = { NULL };
struct rte_crypto_op *burst_dequeued[NULL_BURST_LENGTH] = { NULL };
+ /* This test is for NULL PMD only */
+ if (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
+ return -ENOTSUP;
+
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.next = &ut_params->auth_xform;
@@ -9205,6 +9704,14 @@ test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
"No GMAC length in the source data");
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_AES_GMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
retval = create_gmac_session(ts_params->valid_devs[0],
tdata, RTE_CRYPTO_AUTH_OP_GENERATE);
@@ -9308,6 +9815,14 @@ test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata)
TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
"No GMAC length in the source data");
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = RTE_CRYPTO_AUTH_AES_GMAC;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
retval = create_gmac_session(ts_params->valid_devs[0],
tdata, RTE_CRYPTO_AUTH_OP_VERIFY);
@@ -9866,6 +10381,14 @@ test_authentication_verify_fail_when_data_corruption(
uint8_t *plaintext;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = reference->auth_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create session */
retval = create_auth_session(ut_params,
ts_params->valid_devs[0],
@@ -9924,6 +10447,14 @@ test_authentication_verify_GMAC_fail_when_corruption(
int retval;
uint8_t *plaintext;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = reference->auth_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create session */
retval = create_auth_cipher_session(ut_params,
ts_params->valid_devs[0],
@@ -9986,6 +10517,19 @@ test_authenticated_decryption_fail_when_corruption(
uint8_t *ciphertext;
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = reference->auth_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = reference->crypto_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create session */
retval = create_auth_cipher_session(ut_params,
ts_params->valid_devs[0],
@@ -10049,6 +10593,19 @@ test_authenticated_encryt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = reference->auth_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = reference->crypto_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create session */
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -10152,6 +10709,19 @@ test_authenticated_decrypt_with_esn(
uint8_t cipher_key[reference->cipher_key.len + 1];
uint8_t auth_key[reference->auth_key.len + 1];
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+ cap_idx.algo.auth = reference->auth_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cap_idx.algo.cipher = reference->crypto_algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
/* Create session */
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -10324,6 +10894,41 @@ test_authenticated_encryption_SGL(const struct aead_test_data *tdata,
int segs = 1;
unsigned int trn_data = 0;
uint8_t *plaintext, *ciphertext, *auth_tag;
+ struct rte_cryptodev_info dev_info;
+
+ /* Verify the capabilities */
+ struct rte_cryptodev_sym_capability_idx cap_idx;
+ cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+ cap_idx.algo.aead = tdata->algo;
+ if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+ &cap_idx) == NULL)
+ return -ENOTSUP;
+
+ /* Detailed check for the particular SGL support flag */
+ rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
+ if (!oop) {
+ unsigned int sgl_in = fragsz < tdata->plaintext.len;
+ if (sgl_in && (!(dev_info.feature_flags &
+ RTE_CRYPTODEV_FF_IN_PLACE_SGL)))
+ return -ENOTSUP;
+ } else {
+ unsigned int sgl_in = fragsz < tdata->plaintext.len;
+ unsigned int sgl_out = (fragsz_oop ? fragsz_oop : fragsz) <
+ tdata->plaintext.len;
+ if (sgl_in && !sgl_out) {
+ if (!(dev_info.feature_flags &
+ RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT))
+ return -ENOTSUP;
+ } else if (!sgl_in && sgl_out) {
+ if (!(dev_info.feature_flags &
+ RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT))
+ return -ENOTSUP;
+ } else if (sgl_in && sgl_out) {
+ if (!(dev_info.feature_flags &
+ RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT))
+ return -ENOTSUP;
+ }
+ }
if (fragsz > tdata->plaintext.len)
fragsz = tdata->plaintext.len;
@@ -10573,6 +11178,11 @@ test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B(void)
static int
test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg(void)
{
+ /* This test is not for QAT PMD */
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)))
+ return -ENOTSUP;
+
return test_authenticated_encryption_SGL(
&gcm_test_case_8, OUT_OF_PLACE, 400,
gcm_test_case_8.plaintext.len);
@@ -10581,6 +11191,10 @@ test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg(void)
static int
test_AES_GCM_auth_encrypt_SGL_in_place_1500B(void)
{
+ /* This test is not for OPENSSL PMD */
+ if (gbl_driver_id == rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)))
+ return -ENOTSUP;
return test_authenticated_encryption_SGL(
&gcm_test_case_SGL_1, IN_PLACE, 1500, 0);
--
2.17.1
next prev parent reply other threads:[~2019-12-13 15:23 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 16:10 [dpdk-dev] [PATCH 0/1] Refactor crypto unit tests Adam Dybkowski
2019-12-11 16:10 ` [dpdk-dev] [PATCH 1/1] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2019-12-12 14:09 ` [dpdk-dev] [PATCH v2 0/1] Refactor crypto unit tests Adam Dybkowski
2019-12-12 14:09 ` [dpdk-dev] [PATCH v2 1/1] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2019-12-13 15:22 ` [dpdk-dev] [PATCH v3 0/4] Refactor crypto unit tests Adam Dybkowski
2019-12-13 15:22 ` [dpdk-dev] [PATCH v3 1/4] test/crypto: refactor " Adam Dybkowski
2019-12-13 15:22 ` [dpdk-dev] [PATCH v3 2/4] test/crypto: refactor unit tests - continuation Adam Dybkowski
2020-01-15 18:06 ` Trahe, Fiona
2019-12-13 15:22 ` Adam Dybkowski [this message]
2019-12-13 15:22 ` [dpdk-dev] [PATCH v3 4/4] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2020-01-16 10:40 ` [dpdk-dev] [PATCH v4 0/4] Refactor crypto unit tests Adam Dybkowski
2020-01-16 10:40 ` [dpdk-dev] [PATCH v4 1/4] test/crypto: refactor " Adam Dybkowski
2020-01-16 10:40 ` [dpdk-dev] [PATCH v4 2/4] test/crypto: refactor unit tests - continuation Adam Dybkowski
2020-01-16 10:40 ` [dpdk-dev] [PATCH v4 3/4] test/crypto: add capability checks Adam Dybkowski
2020-01-16 10:40 ` [dpdk-dev] [PATCH v4 4/4] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2020-01-16 12:42 ` [dpdk-dev] [PATCH v5 0/4] Refactor crypto unit tests Adam Dybkowski
2020-01-16 12:42 ` [dpdk-dev] [PATCH v5 1/4] test/crypto: refactor " Adam Dybkowski
2020-01-16 12:42 ` [dpdk-dev] [PATCH v5 2/4] test/crypto: refactor unit tests - continuation Adam Dybkowski
2020-01-16 12:42 ` [dpdk-dev] [PATCH v5 3/4] test/crypto: add capability checks Adam Dybkowski
2020-01-16 12:42 ` [dpdk-dev] [PATCH v5 4/4] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2020-01-17 9:53 ` [dpdk-dev] [PATCH v5 0/4] Refactor crypto unit tests Dybkowski, AdamX
2020-01-17 14:46 ` [dpdk-dev] [PATCH v6 0/3] " Adam Dybkowski
2020-01-17 14:46 ` [dpdk-dev] [PATCH v6 1/3] test/crypto: refactor " Adam Dybkowski
2020-01-17 14:46 ` [dpdk-dev] [PATCH v6 2/3] test/crypto: add capability checks Adam Dybkowski
2020-01-17 14:46 ` [dpdk-dev] [PATCH v6 3/3] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2020-01-17 14:56 ` [dpdk-dev] [PATCH v6 0/3] Refactor crypto unit tests Trahe, Fiona
2020-01-20 10:02 ` Akhil Goyal
2020-01-20 13:11 ` [dpdk-dev] [PATCH v7 " Adam Dybkowski
2020-01-20 13:11 ` [dpdk-dev] [PATCH v7 1/3] test/crypto: refactor " Adam Dybkowski
2020-01-20 13:11 ` [dpdk-dev] [PATCH v7 2/3] test/crypto: add capability checks Adam Dybkowski
2020-01-20 13:11 ` [dpdk-dev] [PATCH v7 3/3] test/crypto: refactor unit tests into one combined array Adam Dybkowski
2020-01-20 13:30 ` [dpdk-dev] [PATCH v7 0/3] Refactor crypto unit tests Akhil Goyal
2020-01-21 10:26 ` Akhil Goyal
2019-12-12 11:56 ` [dpdk-dev] [PATCH 0/1] " Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191213152245.13477-4-adamx.dybkowski@intel.com \
--to=adamx.dybkowski@intel.com \
--cc=adwivedi@marvell.com \
--cc=akhil.goyal@nxp.com \
--cc=anoobj@marvell.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=g.singh@nxp.com \
--cc=jianjay.zhou@huawei.com \
--cc=lironh@marvell.com \
--cc=pablo.de.lara.guarch@intel.com \
--cc=ravi1.kumar@amd.com \
--cc=rnagadheeraj@marvell.com \
--cc=roy.fan.zhang@intel.com \
--cc=ruifeng.wang@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).