Skip to content

Commit

Permalink
test/crypto: fix capability check for ZUC cipher-auth
Browse files Browse the repository at this point in the history
[ upstream commit dd4d13779d63475aa13d2b9f9de06db145e39c78 ]

The cipher-auth test function for ZUC was not using the improved cipher
and auth capability check functions. This meant the required key and IV
lengths were not being checked, leading to problems with ZUC-256 tests
running, and failing, on devices that only support ZUC-128.

Fixes: 27b7871 ("test/crypto: check cipher parameters")
Fixes: f93fce6 ("test/crypto: check auth parameters")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Brian Dooley <brian.dooley@intel.com>
Acked-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  • Loading branch information
ciarapow authored and kevintraynor committed Mar 21, 2023
1 parent 0872c1a commit 50f94c9
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions app/test/test_cryptodev.c
Expand Up @@ -135,6 +135,17 @@ security_proto_supported(enum rte_security_session_action_type action,
static int
dev_configure_and_start(uint64_t ff_disable);

static int
check_cipher_capability(const struct crypto_testsuite_params *ts_params,
const enum rte_crypto_cipher_algorithm cipher_algo,
const uint16_t key_size, const uint16_t iv_size);

static int
check_auth_capability(const struct crypto_testsuite_params *ts_params,
const enum rte_crypto_auth_algorithm auth_algo,
const uint16_t key_size, const uint16_t iv_size,
const uint16_t tag_size);

static struct rte_mbuf *
setup_test_string(struct rte_mempool *mpool,
const char *string, size_t len, uint8_t blocksize)
Expand Down Expand Up @@ -4794,7 +4805,6 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
unsigned int plaintext_len;

struct rte_cryptodev_info dev_info;
struct rte_cryptodev_sym_capability_idx cap_idx;

rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
uint64_t feat_flags = dev_info.feature_flags;
Expand All @@ -4816,19 +4826,14 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
return TEST_SKIPPED;

/* Check if device supports ZUC EEA3 */
cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;

if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
&cap_idx) == NULL)
if (check_cipher_capability(ts_params, RTE_CRYPTO_CIPHER_ZUC_EEA3,
tdata->key.len, tdata->cipher_iv.len) < 0)
return TEST_SKIPPED;

/* Check if device supports ZUC EIA3 */
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;

if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
&cap_idx) == NULL)
if (check_auth_capability(ts_params, RTE_CRYPTO_AUTH_ZUC_EIA3,
tdata->key.len, tdata->auth_iv.len,
tdata->digest.len) < 0)
return TEST_SKIPPED;

/* Create ZUC session */
Expand Down

0 comments on commit 50f94c9

Please sign in to comment.