@@ -456,12 +456,6 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
t_vec->auth_key.data = NULL;
aad_alloc = 1;
break;
- case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
- case RTE_CRYPTO_AUTH_KASUMI_F9:
- case RTE_CRYPTO_AUTH_ZUC_EIA3:
- t_vec->auth_key.data = auth_key;
- aad_alloc = 1;
- break;
case RTE_CRYPTO_AUTH_AES_GMAC:
/* auth key should be the same as cipher key */
t_vec->auth_key.data = cipher_key;
@@ -117,7 +117,7 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8)
return -EINVAL;
- sess->iv_offset = cipher_xform->cipher.iv.offset;
+ sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
if (cipher_xform->cipher.iv.length != KASUMI_IV_LENGTH) {
KASUMI_LOG_ERR("Wrong IV length");
return -EINVAL;
@@ -133,6 +133,13 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9)
return -EINVAL;
sess->auth_op = auth_xform->auth.op;
+
+ sess->auth_iv_offset = auth_xform->auth.iv.offset;
+ if (auth_xform->auth.iv.length != KASUMI_IV_LENGTH) {
+ KASUMI_LOG_ERR("Wrong IV length");
+ return -EINVAL;
+ }
+
/* Initialize key */
sso_kasumi_init_f9_key_sched(auth_xform->auth.key.data,
&sess->pKeySched_hash);
@@ -194,7 +201,7 @@ process_kasumi_cipher_op(struct rte_crypto_op **ops,
rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
(ops[i]->sym->cipher.data.offset >> 3);
iv_ptr = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
- session->iv_offset);
+ session->cipher_iv_offset);
iv[i] = *((uint64_t *)(iv_ptr));
num_bytes[i] = ops[i]->sym->cipher.data.length >> 3;
@@ -227,7 +234,7 @@ process_kasumi_cipher_op_bit(struct rte_crypto_op *op,
}
dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *);
iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
- session->iv_offset);
+ session->cipher_iv_offset);
iv = *((uint64_t *)(iv_ptr));
length_in_bits = op->sym->cipher.data.length;
@@ -246,6 +253,7 @@ process_kasumi_hash_op(struct rte_crypto_op **ops,
unsigned i;
uint8_t processed_ops = 0;
uint8_t *src, *dst;
+ uint8_t *iv_ptr;
uint32_t length_in_bits;
uint32_t num_bytes;
uint32_t shift_bits;
@@ -253,12 +261,6 @@ process_kasumi_hash_op(struct rte_crypto_op **ops,
uint8_t direction;
for (i = 0; i < num_ops; i++) {
- if (unlikely(ops[i]->sym->auth.aad.length != KASUMI_IV_LENGTH)) {
- ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
- KASUMI_LOG_ERR("aad");
- break;
- }
-
if (unlikely(ops[i]->sym->auth.digest.length != KASUMI_DIGEST_LENGTH)) {
ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
KASUMI_LOG_ERR("digest");
@@ -276,8 +278,9 @@ process_kasumi_hash_op(struct rte_crypto_op **ops,
src = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
(ops[i]->sym->auth.data.offset >> 3);
- /* IV from AAD */
- iv = *((uint64_t *)(ops[i]->sym->auth.aad.data));
+ iv_ptr = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
+ session->auth_iv_offset);
+ iv = *((uint64_t *)(iv_ptr));
/* Direction from next bit after end of message */
num_bytes = (length_in_bits >> 3) + 1;
shift_bits = (BYTE_LEN - 1 - length_in_bits) % BYTE_LEN;
@@ -56,12 +56,12 @@ static const struct rte_cryptodev_capabilities kasumi_pmd_capabilities[] = {
.max = 4,
.increment = 0
},
- .aad_size = {
+ .iv_size = {
.min = 8,
.max = 8,
.increment = 0
},
- .iv_size = { 0 }
+ .aad_size = { 0 }
}, }
}, }
},
@@ -92,7 +92,8 @@ struct kasumi_session {
sso_kasumi_key_sched_t pKeySched_hash;
enum kasumi_operation op;
enum rte_crypto_auth_operation auth_op;
- uint16_t iv_offset;
+ uint16_t cipher_iv_offset;
+ uint16_t auth_iv_offset;
} __rte_cache_aligned;
@@ -130,7 +130,11 @@ struct qat_session {
struct {
uint16_t offset;
uint16_t length;
- } iv;
+ } cipher_iv;
+ struct {
+ uint16_t offset;
+ uint16_t length;
+ } auth_iv;
rte_spinlock_t lock; /* protects this struct */
};
@@ -837,8 +837,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ);
cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) +
authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ;
- auth_param->hash_state_sz =
- RTE_ALIGN_CEIL(add_auth_data_length, 16) >> 3;
+ auth_param->hash_state_sz = ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ >> 3;
break;
case ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3:
hash->auth_config.config =
@@ -854,8 +853,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
memcpy(cdesc->cd_cur_ptr + state1_size, authkey, authkeylen);
cdesc->cd_cur_ptr += state1_size + state2_size
+ ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ;
- auth_param->hash_state_sz =
- RTE_ALIGN_CEIL(add_auth_data_length, 16) >> 3;
+ auth_param->hash_state_sz = ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ >> 3;
break;
case ICP_QAT_HW_AUTH_ALGO_MD5:
@@ -298,8 +298,8 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
/* Get cipher xform from crypto xform chain */
cipher_xform = qat_get_cipher_xform(xform);
- session->iv.offset = cipher_xform->iv.offset;
- session->iv.length = cipher_xform->iv.length;
+ session->cipher_iv.offset = cipher_xform->iv.offset;
+ session->cipher_iv.length = cipher_xform->iv.length;
switch (cipher_xform->algo) {
case RTE_CRYPTO_CIPHER_AES_CBC:
@@ -584,6 +584,9 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
}
cipher_xform = qat_get_cipher_xform(xform);
+ session->auth_iv.offset = auth_xform->iv.offset;
+ session->auth_iv.length = auth_xform->iv.length;
+
if ((session->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_128) ||
(session->qat_hash_alg ==
ICP_QAT_HW_AUTH_ALGO_GALOIS_64)) {
@@ -646,7 +649,7 @@ qat_bpicipher_preprocess(struct qat_session *ctx,
else
/* runt block, i.e. less than one full block */
iv = rte_crypto_op_ctod_offset(op, uint8_t *,
- ctx->iv.offset);
+ ctx->cipher_iv.offset);
#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX
rte_hexdump(stdout, "BPI: src before pre-process:", last_block,
@@ -702,7 +705,7 @@ qat_bpicipher_postprocess(struct qat_session *ctx,
else
/* runt block, i.e. less than one full block */
iv = rte_crypto_op_ctod_offset(op, uint8_t *,
- ctx->iv.offset);
+ ctx->cipher_iv.offset);
#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_RX
rte_hexdump(stdout, "BPI: src before post-process:", last_block,
@@ -903,8 +906,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
uint32_t min_ofs = 0;
uint64_t src_buf_start = 0, dst_buf_start = 0;
uint8_t do_sgl = 0;
- uint8_t *iv_ptr;
-
+ uint8_t *cipher_iv_ptr = NULL;
#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX
if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC)) {
@@ -977,21 +979,21 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
cipher_ofs = op->sym->cipher.data.offset;
}
- iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
- ctx->iv.offset);
+ cipher_iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
+ ctx->cipher_iv.offset);
/* copy IV into request if it fits */
- if (ctx->iv.length <=
+ if (ctx->cipher_iv.length <=
sizeof(cipher_param->u.cipher_IV_array)) {
rte_memcpy(cipher_param->u.cipher_IV_array,
- iv_ptr,
- ctx->iv.length);
+ cipher_iv_ptr,
+ ctx->cipher_iv.length);
} else {
ICP_QAT_FW_LA_CIPH_IV_FLD_FLAG_SET(
qat_req->comn_hdr.serv_specif_flags,
ICP_QAT_FW_CIPH_IV_64BIT_PTR);
cipher_param->u.s.cipher_IV_ptr =
rte_crypto_op_ctophys_offset(op,
- ctx->iv.offset);
+ ctx->cipher_iv.offset);
}
min_ofs = cipher_ofs;
}
@@ -1022,7 +1024,10 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
auth_len = auth_len + auth_ofs + 1;
auth_ofs = 0;
}
- }
+ } else
+ auth_param->u1.aad_adr =
+ rte_crypto_op_ctophys_offset(op,
+ ctx->auth_iv.offset);
} else if (ctx->qat_hash_alg ==
ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ||
@@ -1030,16 +1035,17 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
ICP_QAT_HW_AUTH_ALGO_GALOIS_64) {
auth_ofs = op->sym->cipher.data.offset;
auth_len = op->sym->cipher.data.length;
+
+ auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr;
} else {
auth_ofs = op->sym->auth.data.offset;
auth_len = op->sym->auth.data.length;
+
}
min_ofs = auth_ofs;
auth_param->auth_res_addr = op->sym->auth.digest.phys_addr;
- auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr;
-
}
if (op->sym->m_src->next || (op->sym->m_dst && op->sym->m_dst->next))
@@ -1147,7 +1153,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ||
ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_64) {
- if (ctx->iv.length == 12) {
+ if (ctx->cipher_iv.length == 12) {
/*
* For GCM a 12 bit IV is allowed,
* but we need to inform the f/w
@@ -1182,10 +1188,17 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
rte_pktmbuf_mtod(op->sym->m_src, uint8_t*),
rte_pktmbuf_data_len(op->sym->m_src));
if (do_cipher)
- rte_hexdump(stdout, "iv:", iv_ptr,
- ctx->iv.length);
+ rte_hexdump(stdout, "cipher iv:", cipher_iv_ptr,
+ ctx->cipher_iv.length);
if (do_auth) {
+ if (ctx->auth_iv.length) {
+ uint8_t *auth_iv_ptr = rte_crypto_op_ctod_offset(op,
+ uint8_t *,
+ ctx->auth_iv.offset);
+ rte_hexdump(stdout, "auth iv:", auth_iv_ptr,
+ ctx->auth_iv.length);
+ }
rte_hexdump(stdout, "digest:", op->sym->auth.digest.data,
op->sym->auth.digest.length);
rte_hexdump(stdout, "aad:", op->sym->auth.aad.data,
@@ -258,12 +258,12 @@
.max = 4, \
.increment = 0 \
}, \
- .aad_size = { \
+ .iv_size = { \
.min = 16, \
.max = 16, \
.increment = 0 \
}, \
- .iv_size = { 0 } \
+ .aad_size = { 0 } \
}, } \
}, } \
}, \
@@ -446,12 +446,12 @@
.max = 4, \
.increment = 0 \
}, \
- .aad_size = { \
+ .iv_size = { \
.min = 8, \
.max = 8, \
.increment = 0 \
}, \
- .iv_size = { 0 } \
+ .aad_size = { 0 } \
}, } \
}, } \
}, \
@@ -574,12 +574,12 @@
.max = 4, \
.increment = 0 \
}, \
- .aad_size = { \
+ .iv_size = { \
.min = 16, \
.max = 16, \
.increment = 0 \
}, \
- .iv_size = { 0 } \
+ .aad_size = { 0 } \
}, } \
}, } \
}
@@ -121,7 +121,7 @@ snow3g_set_session_parameters(struct snow3g_session *sess,
SNOW3G_LOG_ERR("Wrong IV length");
return -EINVAL;
}
- sess->iv_offset = cipher_xform->cipher.iv.offset;
+ sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
/* Initialize key */
sso_snow3g_init_key_sched(cipher_xform->cipher.key.data,
@@ -133,6 +133,13 @@ snow3g_set_session_parameters(struct snow3g_session *sess,
if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_SNOW3G_UIA2)
return -EINVAL;
sess->auth_op = auth_xform->auth.op;
+
+ if (auth_xform->auth.iv.length != SNOW3G_IV_LENGTH) {
+ SNOW3G_LOG_ERR("Wrong IV length");
+ return -EINVAL;
+ }
+ sess->auth_iv_offset = auth_xform->auth.iv.offset;
+
/* Initialize key */
sso_snow3g_init_key_sched(auth_xform->auth.key.data,
&sess->pKeySched_hash);
@@ -193,7 +200,7 @@ process_snow3g_cipher_op(struct rte_crypto_op **ops,
rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
(ops[i]->sym->cipher.data.offset >> 3);
iv[i] = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
- session->iv_offset);
+ session->cipher_iv_offset);
num_bytes[i] = ops[i]->sym->cipher.data.length >> 3;
processed_ops++;
@@ -223,7 +230,7 @@ process_snow3g_cipher_op_bit(struct rte_crypto_op *op,
}
dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *);
iv = rte_crypto_op_ctod_offset(op, uint8_t *,
- session->iv_offset);
+ session->cipher_iv_offset);
length_in_bits = op->sym->cipher.data.length;
sso_snow3g_f8_1_buffer_bit(&session->pKeySched_cipher, iv,
@@ -242,14 +249,9 @@ process_snow3g_hash_op(struct rte_crypto_op **ops,
uint8_t processed_ops = 0;
uint8_t *src, *dst;
uint32_t length_in_bits;
+ uint8_t *iv;
for (i = 0; i < num_ops; i++) {
- if (unlikely(ops[i]->sym->auth.aad.length != SNOW3G_IV_LENGTH)) {
- ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
- SNOW3G_LOG_ERR("aad");
- break;
- }
-
if (unlikely(ops[i]->sym->auth.digest.length != SNOW3G_DIGEST_LENGTH)) {
ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
SNOW3G_LOG_ERR("digest");
@@ -267,13 +269,15 @@ process_snow3g_hash_op(struct rte_crypto_op **ops,
src = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
(ops[i]->sym->auth.data.offset >> 3);
+ iv = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
+ session->auth_iv_offset);
if (session->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) {
dst = (uint8_t *)rte_pktmbuf_append(ops[i]->sym->m_src,
ops[i]->sym->auth.digest.length);
sso_snow3g_f9_1_buffer(&session->pKeySched_hash,
- ops[i]->sym->auth.aad.data, src,
+ iv, src,
length_in_bits, dst);
/* Verify digest. */
if (memcmp(dst, ops[i]->sym->auth.digest.data,
@@ -287,7 +291,7 @@ process_snow3g_hash_op(struct rte_crypto_op **ops,
dst = ops[i]->sym->auth.digest.data;
sso_snow3g_f9_1_buffer(&session->pKeySched_hash,
- ops[i]->sym->auth.aad.data, src,
+ iv, src,
length_in_bits, dst);
}
processed_ops++;
@@ -56,12 +56,12 @@ static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
.max = 4,
.increment = 0
},
- .aad_size = {
+ .iv_size = {
.min = 16,
.max = 16,
.increment = 0
},
- .iv_size = { 0 },
+ .aad_size = { 0 }
}, }
}, }
},
@@ -91,7 +91,8 @@ struct snow3g_session {
enum rte_crypto_auth_operation auth_op;
sso_snow3g_key_schedule_t pKeySched_cipher;
sso_snow3g_key_schedule_t pKeySched_hash;
- uint16_t iv_offset;
+ uint16_t cipher_iv_offset;
+ uint16_t auth_iv_offset;
} __rte_cache_aligned;
@@ -120,7 +120,7 @@ zuc_set_session_parameters(struct zuc_session *sess,
ZUC_LOG_ERR("Wrong IV length");
return -EINVAL;
}
- sess->iv_offset = cipher_xform->cipher.iv.offset;
+ sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
/* Copy the key */
memcpy(sess->pKey_cipher, cipher_xform->cipher.key.data,
@@ -132,6 +132,13 @@ zuc_set_session_parameters(struct zuc_session *sess,
if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_ZUC_EIA3)
return -EINVAL;
sess->auth_op = auth_xform->auth.op;
+
+ if (auth_xform->auth.iv.length != ZUC_IV_KEY_LENGTH) {
+ ZUC_LOG_ERR("Wrong IV length");
+ return -EINVAL;
+ }
+ sess->auth_iv_offset = auth_xform->auth.iv.offset;
+
/* Copy the key */
memcpy(sess->pKey_hash, auth_xform->auth.key.data,
ZUC_IV_KEY_LENGTH);
@@ -214,7 +221,7 @@ process_zuc_cipher_op(struct rte_crypto_op **ops,
rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
(ops[i]->sym->cipher.data.offset >> 3);
iv[i] = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
- session->iv_offset);
+ session->cipher_iv_offset);
num_bytes[i] = ops[i]->sym->cipher.data.length >> 3;
cipher_keys[i] = session->pKey_cipher;
@@ -239,14 +246,9 @@ process_zuc_hash_op(struct rte_crypto_op **ops,
uint8_t *src;
uint32_t *dst;
uint32_t length_in_bits;
+ uint8_t *iv;
for (i = 0; i < num_ops; i++) {
- if (unlikely(ops[i]->sym->auth.aad.length != ZUC_IV_KEY_LENGTH)) {
- ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
- ZUC_LOG_ERR("aad");
- break;
- }
-
if (unlikely(ops[i]->sym->auth.digest.length != ZUC_DIGEST_LENGTH)) {
ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
ZUC_LOG_ERR("digest");
@@ -264,13 +266,15 @@ process_zuc_hash_op(struct rte_crypto_op **ops,
src = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
(ops[i]->sym->auth.data.offset >> 3);
+ iv = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
+ session->auth_iv_offset);
if (session->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) {
dst = (uint32_t *)rte_pktmbuf_append(ops[i]->sym->m_src,
ops[i]->sym->auth.digest.length);
sso_zuc_eia3_1_buffer(session->pKey_hash,
- ops[i]->sym->auth.aad.data, src,
+ iv, src,
length_in_bits, dst);
/* Verify digest. */
if (memcmp(dst, ops[i]->sym->auth.digest.data,
@@ -284,7 +288,7 @@ process_zuc_hash_op(struct rte_crypto_op **ops,
dst = (uint32_t *)ops[i]->sym->auth.digest.data;
sso_zuc_eia3_1_buffer(session->pKey_hash,
- ops[i]->sym->auth.aad.data, src,
+ iv, src,
length_in_bits, dst);
}
processed_ops++;
@@ -56,12 +56,12 @@ static const struct rte_cryptodev_capabilities zuc_pmd_capabilities[] = {
.max = 4,
.increment = 0
},
- .aad_size = {
+ .iv_size = {
.min = 16,
.max = 16,
.increment = 0
},
- .iv_size = { 0 }
+ .aad_size = { 0 }
}, }
}, }
},
@@ -92,7 +92,8 @@ struct zuc_session {
enum rte_crypto_auth_operation auth_op;
uint8_t pKey_cipher[ZUC_IV_KEY_LENGTH];
uint8_t pKey_hash[ZUC_IV_KEY_LENGTH];
- uint16_t iv_offset;
+ uint16_t cipher_iv_offset;
+ uint16_t auth_iv_offset;
} __rte_cache_aligned;
@@ -373,9 +373,6 @@ struct rte_crypto_auth_xform {
* This field must be specified when the hash algorithm is one of the
* following:
*
- * - For SNOW 3G (@ref RTE_CRYPTO_AUTH_SNOW3G_UIA2), this is the
- * length of the IV (which should be 16).
- *
* - For GCM (@ref RTE_CRYPTO_AUTH_AES_GCM). In this case, this is
* the length of the Additional Authenticated Data (called A, in NIST
* SP800-38D).
@@ -617,9 +614,7 @@ struct rte_crypto_sym_op {
uint8_t *data;
/**< Pointer to Additional Authenticated Data (AAD)
* needed for authenticated cipher mechanisms (CCM and
- * GCM), and to the IV for SNOW 3G authentication
- * (@ref RTE_CRYPTO_AUTH_SNOW3G_UIA2). For other
- * authentication mechanisms this pointer is ignored.
+ * GCM).
*
* The length of the data pointed to by this field is
* set up for the session in the @ref
@@ -1774,7 +1774,7 @@ test_AES_chain_armv8_all(void)
static int
create_wireless_algo_hash_session(uint8_t dev_id,
const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len,
+ const uint8_t iv_len, const uint8_t auth_len,
enum rte_crypto_auth_operation op,
enum rte_crypto_auth_algorithm algo)
{
@@ -1795,7 +1795,8 @@ create_wireless_algo_hash_session(uint8_t dev_id,
ut_params->auth_xform.auth.key.length = key_len;
ut_params->auth_xform.auth.key.data = hash_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
+ ut_params->auth_xform.auth.iv.length = iv_len;
ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
&ut_params->auth_xform);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
@@ -1903,9 +1904,9 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
enum rte_crypto_auth_operation auth_op,
enum rte_crypto_auth_algorithm auth_algo,
enum rte_crypto_cipher_algorithm cipher_algo,
- const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len,
- uint8_t iv_len)
+ const uint8_t *key, uint8_t key_len,
+ uint8_t auth_iv_len, uint8_t auth_len,
+ uint8_t cipher_iv_len)
{
uint8_t cipher_auth_key[key_len];
@@ -1924,7 +1925,9 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
/* Hash key = cipher key */
ut_params->auth_xform.auth.key.data = cipher_auth_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ /* Auth IV will be after cipher IV */
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
+ ut_params->auth_xform.auth.iv.length = auth_iv_len;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -1935,7 +1938,7 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
ut_params->cipher_xform.cipher.key.length = key_len;
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
- ut_params->cipher_xform.cipher.iv.length = iv_len;
+ ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
@@ -1960,9 +1963,9 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
struct crypto_unittest_params *ut_params = &unittest_params;
const uint8_t *key = tdata->key.data;
- const uint8_t aad_len = tdata->aad.len;
const uint8_t auth_len = tdata->digest.len;
- uint8_t iv_len = tdata->iv.len;
+ uint8_t cipher_iv_len = tdata->cipher_iv.len;
+ uint8_t auth_iv_len = tdata->auth_iv.len;
memcpy(cipher_auth_key, key, key_len);
@@ -1976,7 +1979,9 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
/* Hash key = cipher key */
ut_params->auth_xform.auth.key.data = cipher_auth_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ /* Auth IV will be after cipher IV */
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
+ ut_params->auth_xform.auth.iv.length = auth_iv_len;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -1987,7 +1992,7 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
ut_params->cipher_xform.cipher.key.length = key_len;
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
- ut_params->cipher_xform.cipher.iv.length = iv_len;
+ ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
@@ -2017,8 +2022,8 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
enum rte_crypto_auth_algorithm auth_algo,
enum rte_crypto_cipher_algorithm cipher_algo,
const uint8_t *key, const uint8_t key_len,
- const uint8_t aad_len, const uint8_t auth_len,
- uint8_t iv_len)
+ uint8_t auth_iv_len, uint8_t auth_len,
+ uint8_t cipher_iv_len)
{
uint8_t auth_cipher_key[key_len];
@@ -2034,7 +2039,9 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
ut_params->auth_xform.auth.key.length = key_len;
ut_params->auth_xform.auth.key.data = auth_cipher_key;
ut_params->auth_xform.auth.digest_length = auth_len;
- ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+ /* Auth IV will be after cipher IV */
+ ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
+ ut_params->auth_xform.auth.iv.length = auth_iv_len;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
@@ -2044,7 +2051,7 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
ut_params->cipher_xform.cipher.key.data = auth_cipher_key;
ut_params->cipher_xform.cipher.key.length = key_len;
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
- ut_params->cipher_xform.cipher.iv.length = iv_len;
+ ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
TEST_HEXDUMP(stdout, "key:", key, key_len);
@@ -2059,19 +2066,16 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
static int
create_wireless_algo_hash_operation(const uint8_t *auth_tag,
- const unsigned auth_tag_len,
- const uint8_t *aad, const unsigned aad_len,
- unsigned data_pad_len,
+ unsigned int auth_tag_len,
+ const uint8_t *iv, unsigned int iv_len,
+ unsigned int data_pad_len,
enum rte_crypto_auth_operation op,
- enum rte_crypto_auth_algorithm algo,
- const unsigned auth_len, const unsigned auth_offset)
+ unsigned int auth_len, unsigned int auth_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned aad_buffer_len;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -2086,32 +2090,9 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
/* set crypto operation source mbuf */
sym_op->m_src = ut_params->ibuf;
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
- */
- if (algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
-
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
-
- TEST_HEXDUMP(stdout, "aad:",
- sym_op->auth.aad.data, aad_len);
-
+ /* iv */
+ rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+ iv, iv_len);
/* digest */
sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->ibuf, auth_tag_len);
@@ -2120,7 +2101,7 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
"no room to append auth tag");
ut_params->digest = sym_op->auth.digest.data;
sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
- ut_params->ibuf, data_pad_len + aad_len);
+ ut_params->ibuf, data_pad_len);
sym_op->auth.digest.length = auth_tag_len;
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
@@ -2139,27 +2120,22 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
static int
create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
- enum rte_crypto_auth_operation op,
- enum rte_crypto_auth_algorithm auth_algo)
+ enum rte_crypto_auth_operation op)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
const uint8_t *auth_tag = tdata->digest.data;
const unsigned int auth_tag_len = tdata->digest.len;
- const uint8_t *aad = tdata->aad.data;
- const uint8_t aad_len = tdata->aad.len;
unsigned int plaintext_len = ceil_byte_length(tdata->plaintext.len);
unsigned int data_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
- const uint8_t *iv = tdata->iv.data;
- const uint8_t iv_len = tdata->iv.len;
+ const uint8_t *cipher_iv = tdata->cipher_iv.data;
+ const uint8_t cipher_iv_len = tdata->cipher_iv.len;
+ const uint8_t *auth_iv = tdata->auth_iv.data;
+ const uint8_t auth_iv_len = tdata->auth_iv.len;
const unsigned int cipher_len = tdata->validCipherLenInBits.len;
- const unsigned int cipher_offset = 0;
const unsigned int auth_len = tdata->validAuthLenInBits.len;
- const unsigned int auth_offset = tdata->aad.len << 3;
-
- unsigned int aad_buffer_len;
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
@@ -2193,37 +2169,17 @@ create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
sym_op->auth.digest.data,
sym_op->auth.digest.length);
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
- */
- if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data =
- (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len);
+ /* Copy cipher and auth IVs at the end of the crypto operation */
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
+ IV_OFFSET);
+ rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
+ iv_ptr += cipher_iv_len;
+ rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
- /* iv */
- rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
- iv, iv_len);
sym_op->cipher.data.length = cipher_len;
- sym_op->cipher.data.offset = cipher_offset + auth_offset;
+ sym_op->cipher.data.offset = 0;
sym_op->auth.data.length = auth_len;
- sym_op->auth.data.offset = auth_offset + cipher_offset;
+ sym_op->auth.data.offset = 0;
return 0;
}
@@ -2233,26 +2189,22 @@ create_zuc_cipher_hash_generate_operation(
const struct wireless_test_data *tdata)
{
return create_wireless_cipher_hash_operation(tdata,
- RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_ZUC_EIA3);
+ RTE_CRYPTO_AUTH_OP_GENERATE);
}
static int
create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
const unsigned auth_tag_len,
- const uint8_t *aad, const uint8_t aad_len,
+ const uint8_t *auth_iv, uint8_t auth_iv_len,
unsigned data_pad_len,
enum rte_crypto_auth_operation op,
- enum rte_crypto_auth_algorithm auth_algo,
- const uint8_t *iv, const uint8_t iv_len,
+ const uint8_t *cipher_iv, uint8_t cipher_iv_len,
const unsigned cipher_len, const unsigned cipher_offset,
const unsigned auth_len, const unsigned auth_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned aad_buffer_len;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -2285,33 +2237,13 @@ create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
sym_op->auth.digest.data,
sym_op->auth.digest.length);
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
- */
- if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data =
- (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len);
+ /* Copy cipher and auth IVs at the end of the crypto operation */
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
+ IV_OFFSET);
+ rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
+ iv_ptr += cipher_iv_len;
+ rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
- /* iv */
- rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
- iv, iv_len);
sym_op->cipher.data.length = cipher_len;
sym_op->cipher.data.offset = cipher_offset + auth_offset;
sym_op->auth.data.length = auth_len;
@@ -2321,19 +2253,16 @@ create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
}
static int
-create_wireless_algo_auth_cipher_operation(const unsigned auth_tag_len,
- const uint8_t *iv, const uint8_t iv_len,
- const uint8_t *aad, const uint8_t aad_len,
- unsigned data_pad_len,
- const unsigned cipher_len, const unsigned cipher_offset,
- const unsigned auth_len, const unsigned auth_offset,
- enum rte_crypto_auth_algorithm auth_algo)
+create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len,
+ const uint8_t *cipher_iv, uint8_t cipher_iv_len,
+ const uint8_t *auth_iv, uint8_t auth_iv_len,
+ unsigned int data_pad_len,
+ unsigned int cipher_len, unsigned int cipher_offset,
+ unsigned int auth_len, unsigned int auth_offset)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- unsigned aad_buffer_len = 0;
-
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -2365,33 +2294,13 @@ create_wireless_algo_auth_cipher_operation(const unsigned auth_tag_len,
sym_op->auth.digest.data,
sym_op->auth.digest.length);
- /* aad */
- /*
- * Always allocate the aad up to the block size.
- * The cryptodev API calls out -
- * - the array must be big enough to hold the AAD, plus any
- * space to round this up to the nearest multiple of the
- * block size (8 bytes for KASUMI 16 bytes).
- */
- if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
- else
- aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
- sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend(
- ut_params->ibuf, aad_buffer_len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
- "no room to prepend aad");
- sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
- ut_params->ibuf);
- sym_op->auth.aad.length = aad_len;
- memset(sym_op->auth.aad.data, 0, aad_buffer_len);
- rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
- TEST_HEXDUMP(stdout, "aad:",
- sym_op->auth.aad.data, aad_len);
+ /* Copy cipher and auth IVs at the end of the crypto operation */
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
+ IV_OFFSET);
+ rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
+ iv_ptr += cipher_iv_len;
+ rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
- /* iv */
- rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
- iv, iv_len);
sym_op->cipher.data.length = cipher_len;
sym_op->cipher.data.offset = auth_offset + cipher_offset;
@@ -2415,7 +2324,7 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_GENERATE,
RTE_CRYPTO_AUTH_SNOW3G_UIA2);
if (retval < 0)
@@ -2437,11 +2346,10 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3));
+ 0);
if (retval < 0)
return retval;
@@ -2450,7 +2358,7 @@ test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_src;
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -2476,7 +2384,7 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_VERIFY,
RTE_CRYPTO_AUTH_SNOW3G_UIA2);
if (retval < 0)
@@ -2498,12 +2406,11 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_hash_operation(tdata->digest.data,
tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len,
RTE_CRYPTO_AUTH_OP_VERIFY,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3));
+ 0);
if (retval < 0)
return retval;
@@ -2512,7 +2419,7 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
@@ -2537,7 +2444,7 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_GENERATE,
RTE_CRYPTO_AUTH_KASUMI_F9);
if (retval < 0)
@@ -2559,11 +2466,10 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_KASUMI_F9,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3));
+ 0);
if (retval < 0)
return retval;
@@ -2572,7 +2478,7 @@ test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_src;
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + ALIGN_POW2_ROUNDUP(tdata->aad.len, 8);
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -2598,7 +2504,7 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_VERIFY,
RTE_CRYPTO_AUTH_KASUMI_F9);
if (retval < 0)
@@ -2620,12 +2526,11 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_hash_operation(tdata->digest.data,
tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len,
RTE_CRYPTO_AUTH_OP_VERIFY,
- RTE_CRYPTO_AUTH_KASUMI_F9,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3));
+ 0);
if (retval < 0)
return retval;
@@ -2634,7 +2539,7 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
@@ -2800,7 +2705,7 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -2821,7 +2726,8 @@ test_kasumi_encryption(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->plaintext.len,
0);
if (retval < 0)
@@ -2876,7 +2782,7 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -2893,8 +2799,8 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->plaintext.len,
0);
if (retval < 0)
@@ -2941,7 +2847,7 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -2964,8 +2870,8 @@ test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->plaintext.len,
0);
if (retval < 0)
@@ -3019,7 +2925,7 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3038,8 +2944,8 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->plaintext.len,
0);
if (retval < 0)
@@ -3083,7 +2989,7 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3106,8 +3012,8 @@ test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->ciphertext.len,
0);
if (retval < 0)
@@ -3150,7 +3056,7 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3171,8 +3077,8 @@ test_kasumi_decryption(const struct kasumi_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create KASUMI operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->ciphertext.len,
0);
if (retval < 0)
@@ -3215,7 +3121,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3236,7 +3142,8 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0);
if (retval < 0)
@@ -3280,7 +3187,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3308,8 +3215,8 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0);
if (retval < 0)
@@ -3362,7 +3269,7 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3384,8 +3291,8 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0);
if (retval < 0)
@@ -3452,7 +3359,7 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3487,8 +3394,8 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len);
#endif
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
extra_offset);
if (retval < 0)
@@ -3543,7 +3450,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3564,7 +3471,8 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0);
if (retval < 0)
@@ -3605,7 +3513,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_DECRYPT,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3636,8 +3544,8 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create SNOW 3G operation */
- retval = create_wireless_algo_cipher_operation_oop(tdata->iv.data,
- tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0);
if (retval < 0)
@@ -3724,8 +3632,7 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3738,7 +3645,7 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
"ZUC Ciphertext data not as expected");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -3768,8 +3675,8 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
RTE_CRYPTO_AUTH_SNOW3G_UIA2,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
- tdata->iv.len);
+ tdata->auth_iv.len, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -3790,15 +3697,14 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
- tdata->digest.len, tdata->aad.data,
- tdata->aad.len, /*tdata->plaintext.len,*/
+ tdata->digest.len, tdata->auth_iv.data,
+ tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- tdata->iv.data, tdata->iv.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3)
+ 0
);
if (retval < 0)
return retval;
@@ -3808,8 +3714,7 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3822,7 +3727,7 @@ test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
"SNOW 3G Ciphertext data not as expected");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -3851,8 +3756,8 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
RTE_CRYPTO_AUTH_SNOW3G_UIA2,
RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
- tdata->iv.len);
+ tdata->auth_iv.len, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -3875,15 +3780,13 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
/* Create SNOW 3G operation */
retval = create_wireless_algo_auth_cipher_operation(
tdata->digest.len,
- tdata->iv.data, tdata->iv.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len,
tdata->validCipherLenInBits.len,
0,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3),
- RTE_CRYPTO_AUTH_SNOW3G_UIA2
- );
+ 0);
if (retval < 0)
return retval;
@@ -3893,13 +3796,12 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
@@ -3938,8 +3840,8 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
RTE_CRYPTO_AUTH_KASUMI_F9,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
- tdata->iv.len);
+ tdata->auth_iv.len, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
@@ -3960,14 +3862,13 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_auth_cipher_operation(tdata->digest.len,
- tdata->iv.data, tdata->iv.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len,
tdata->validCipherLenInBits.len,
0,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3),
- RTE_CRYPTO_AUTH_KASUMI_F9
+ 0
);
if (retval < 0)
@@ -3978,8 +3879,7 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
@@ -3990,7 +3890,7 @@ test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
tdata->validCipherLenInBits.len,
"KASUMI Ciphertext data not as expected");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -4021,8 +3921,8 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
RTE_CRYPTO_AUTH_KASUMI_F9,
RTE_CRYPTO_CIPHER_KASUMI_F8,
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
- tdata->iv.len);
+ tdata->auth_iv.len, tdata->digest.len,
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -4044,15 +3944,14 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
- tdata->digest.len, tdata->aad.data,
- tdata->aad.len,
+ tdata->digest.len, tdata->auth_iv.data,
+ tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_KASUMI_F9,
- tdata->iv.data, tdata->iv.len,
+ tdata->cipher_iv.data, tdata->cipher_iv.len,
tdata->validCipherLenInBits.len,
0,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3)
+ 0
);
if (retval < 0)
return retval;
@@ -4062,13 +3961,12 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->obuf = ut_params->op->sym->m_src;
if (ut_params->obuf)
- ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + tdata->aad.len;
+ ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
else
ciphertext = plaintext;
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + tdata->aad.len;
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -4112,7 +4010,7 @@ test_zuc_encryption(const struct wireless_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_ZUC_EEA3,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -4133,7 +4031,8 @@ test_zuc_encryption(const struct wireless_test_data *tdata)
TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
/* Create ZUC operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data, tdata->iv.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len,
tdata->plaintext.len,
0);
if (retval < 0)
@@ -4208,7 +4107,7 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
RTE_CRYPTO_CIPHER_ZUC_EEA3,
tdata->key.data, tdata->key.len,
- tdata->iv.len);
+ tdata->cipher_iv.len);
if (retval < 0)
return retval;
@@ -4217,8 +4116,8 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
/* Create ZUC operation */
- retval = create_wireless_algo_cipher_operation(tdata->iv.data,
- tdata->iv.len, tdata->plaintext.len,
+ retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
+ tdata->cipher_iv.len, tdata->plaintext.len,
0);
if (retval < 0)
return retval;
@@ -4272,7 +4171,7 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
/* Create ZUC session */
retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
tdata->key.data, tdata->key.len,
- tdata->aad.len, tdata->digest.len,
+ tdata->auth_iv.len, tdata->digest.len,
RTE_CRYPTO_AUTH_OP_GENERATE,
RTE_CRYPTO_AUTH_ZUC_EIA3);
if (retval < 0)
@@ -4294,11 +4193,10 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
/* Create ZUC operation */
retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
- tdata->aad.data, tdata->aad.len,
+ tdata->auth_iv.data, tdata->auth_iv.len,
plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
- RTE_CRYPTO_AUTH_ZUC_EIA3,
tdata->validAuthLenInBits.len,
- (tdata->aad.len << 3));
+ 0);
if (retval < 0)
return retval;
@@ -4307,7 +4205,7 @@ test_zuc_authentication(const struct wireless_test_data *tdata)
ut_params->obuf = ut_params->op->sym->m_src;
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
- + plaintext_pad_len + ALIGN_POW2_ROUNDUP(tdata->aad.len, 8);
+ + plaintext_pad_len;
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
@@ -43,7 +43,7 @@ struct kasumi_hash_test_data {
struct {
uint8_t data[8];
unsigned len;
- } aad;
+ } auth_iv;
/* Includes message and DIRECTION (1 bit), plus 1 0*,
* with enough 0s, so total length is multiple of 64 bits */
@@ -71,7 +71,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_1 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
},
@@ -102,7 +102,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_2 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x3E, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0xD8, 0xE2,
},
@@ -134,7 +134,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_3 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A,
},
@@ -168,7 +168,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_4 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD
},
@@ -203,7 +203,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_5 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
},
@@ -247,7 +247,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_6 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2
},
@@ -288,7 +288,7 @@ struct kasumi_hash_test_data kasumi_hash_test_case_7 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
},
@@ -42,13 +42,13 @@ struct kasumi_test_data {
struct {
uint8_t data[64] __rte_aligned(16);
unsigned len;
- } iv;
+ } cipher_iv;
/* Includes: COUNT (4 bytes) and FRESH (4 bytes) */
struct {
uint8_t data[8];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[1024]; /* Data may include direction bit */
@@ -88,7 +88,7 @@ struct kasumi_test_data kasumi_test_case_1 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
},
@@ -143,7 +143,7 @@ struct kasumi_test_data kasumi_test_case_2 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00
},
@@ -188,13 +188,13 @@ struct kasumi_test_data kasumi_test_case_3 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
},
.len = 8
},
- .aad = {
+ .auth_iv = {
.data = {
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49
},
@@ -237,7 +237,7 @@ struct kasumi_test_data kasumi_test_case_4 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x39, 0x8A, 0x59, 0xB4, 0x2C, 0x00, 0x00, 0x00,
},
@@ -274,7 +274,7 @@ struct kasumi_test_data kasumi_test_case_5 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x48, 0x00, 0x00, 0x00
},
@@ -331,13 +331,13 @@ struct kasumi_test_data kasumi_test_case_6 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
},
.len = 8
},
- .aad = {
+ .auth_iv = {
.data = {
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49
},
@@ -2704,10 +2704,12 @@ test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
auth_xform.auth.algo = auth_algo;
- auth_xform.auth.add_auth_data_length = SNOW3G_CIPHER_IV_LENGTH;
auth_xform.auth.key.data = snow3g_hash_key;
auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
+ /* Auth IV will be after cipher IV */
+ auth_xform.auth.iv.offset = IV_OFFSET + SNOW3G_CIPHER_IV_LENGTH;
+ auth_xform.auth.iv.length = SNOW3G_CIPHER_IV_LENGTH;
switch (chain) {
case CIPHER_HASH:
@@ -2969,10 +2971,6 @@ test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
op->sym->auth.digest.phys_addr =
rte_pktmbuf_mtophys_offset(m, data_len);
op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = iv_ptr;
- op->sym->auth.aad.phys_addr = rte_crypto_op_ctophys_offset(op,
- IV_OFFSET);
- op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
/* Data lengths/offsets Parameters */
op->sym->auth.data.offset = 0;
@@ -3017,11 +3015,16 @@ test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
unsigned data_len,
unsigned digest_len)
{
+ uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
+ uint8_t *, IV_OFFSET);
+
if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
rte_crypto_op_free(op);
return NULL;
}
+ rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
+
/* Authentication Parameters */
op->sym->auth.digest.data =
@@ -3031,13 +3034,6 @@ test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
rte_pktmbuf_mtophys_offset(m, data_len +
SNOW3G_CIPHER_IV_LENGTH);
op->sym->auth.digest.length = digest_len;
- op->sym->auth.aad.data = rte_crypto_op_ctod_offset(op,
- uint8_t *, IV_OFFSET);
- op->sym->auth.aad.phys_addr = rte_crypto_op_ctophys_offset(op,
- IV_OFFSET);
- op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
- rte_memcpy(op->sym->auth.aad.data, snow3g_iv,
- SNOW3G_CIPHER_IV_LENGTH);
/* Data lengths/offsets Parameters */
op->sym->auth.data.offset = 0;
@@ -42,7 +42,7 @@ struct snow3g_hash_test_data {
struct {
uint8_t data[64];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[2056];
@@ -67,7 +67,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_1 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
@@ -102,7 +102,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_2 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
0xA9, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0xF7, 0x37
@@ -147,7 +147,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_3 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
0xA9, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0xF7, 0x37
@@ -433,7 +433,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_4 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
@@ -465,7 +465,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_5 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x3E, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0xD8, 0xE2,
0xBE, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0x58, 0xE2
@@ -498,7 +498,7 @@ struct snow3g_hash_test_data snow3g_hash_test_case_6 = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A,
0xB6, 0xAF, 0x61, 0x44, 0x98, 0x38, 0x70, 0x3A
@@ -42,7 +42,7 @@ struct snow3g_test_data {
struct {
uint8_t data[64] __rte_aligned(16);
unsigned len;
- } iv;
+ } cipher_iv;
struct {
uint8_t data[1024];
@@ -69,7 +69,7 @@ struct snow3g_test_data {
struct {
uint8_t data[64];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[64];
@@ -84,7 +84,7 @@ struct snow3g_test_data snow3g_test_case_1 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
@@ -133,7 +133,7 @@ struct snow3g_test_data snow3g_test_case_1 = {
.validCipherLenInBits = {
.len = 800
},
- .aad = {
+ .auth_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
@@ -150,7 +150,7 @@ struct snow3g_test_data snow3g_test_case_2 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00,
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00
@@ -189,7 +189,7 @@ struct snow3g_test_data snow3g_test_case_2 = {
.validCipherLenInBits = {
.len = 512
},
- .aad = {
+ .auth_iv = {
.data = {
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00,
0xE2, 0x8B, 0xCF, 0x7B, 0xC0, 0x00, 0x00, 0x00
@@ -206,7 +206,7 @@ struct snow3g_test_data snow3g_test_case_3 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -233,7 +233,7 @@ struct snow3g_test_data snow3g_test_case_3 = {
.validCipherLenInBits = {
.len = 120
},
- .aad = {
+ .auth_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -257,7 +257,7 @@ struct snow3g_test_data snow3g_test_case_4 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x39, 0x8A, 0x59, 0xB4, 0x2C, 0x00, 0x00, 0x00,
0x39, 0x8A, 0x59, 0xB4, 0x2C, 0x00, 0x00, 0x00
@@ -298,7 +298,7 @@ struct snow3g_test_data snow3g_test_case_5 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x72, 0xA4, 0xF2, 0x0F, 0x48, 0x00, 0x00, 0x00,
0x72, 0xA4, 0xF2, 0x0F, 0x48, 0x00, 0x00, 0x00
@@ -357,14 +357,14 @@ struct snow3g_test_data snow3g_test_case_6 = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
@@ -42,7 +42,7 @@ struct wireless_test_data {
struct {
uint8_t data[64] __rte_aligned(16);
unsigned len;
- } iv;
+ } cipher_iv;
struct {
uint8_t data[2048];
@@ -69,7 +69,7 @@ struct wireless_test_data {
struct {
uint8_t data[64];
unsigned len;
- } aad;
+ } auth_iv;
struct {
uint8_t data[64];
@@ -84,7 +84,7 @@ static struct wireless_test_data zuc_test_case_cipher_193b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00,
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00
@@ -125,7 +125,7 @@ static struct wireless_test_data zuc_test_case_cipher_800b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00,
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00
@@ -184,7 +184,7 @@ static struct wireless_test_data zuc_test_case_cipher_1570b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x76, 0x45, 0x2E, 0xC1, 0x14, 0x00, 0x00, 0x00,
0x76, 0x45, 0x2E, 0xC1, 0x14, 0x00, 0x00, 0x00
@@ -267,7 +267,7 @@ static struct wireless_test_data zuc_test_case_cipher_2798b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0xE4, 0x85, 0x0F, 0xE1, 0x84, 0x00, 0x00, 0x00,
0xE4, 0x85, 0x0F, 0xE1, 0x84, 0x00, 0x00, 0x00
@@ -388,7 +388,7 @@ static struct wireless_test_data zuc_test_case_cipher_4019b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x27, 0x38, 0xCD, 0xAA, 0xD0, 0x00, 0x00, 0x00,
0x27, 0x38, 0xCD, 0xAA, 0xD0, 0x00, 0x00, 0x00
@@ -547,7 +547,7 @@ static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00,
0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00
@@ -578,7 +578,7 @@ static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = {
.validCipherLenInBits = {
.len = 200
},
- .aad = {
+ .auth_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -602,7 +602,7 @@ static struct wireless_test_data zuc_test_case_cipher_800b_auth_120b = {
},
.len = 16
},
- .iv = {
+ .cipher_iv = {
.data = {
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00,
0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00
@@ -651,7 +651,7 @@ static struct wireless_test_data zuc_test_case_cipher_800b_auth_120b = {
.validCipherLenInBits = {
.len = 800
},
- .aad = {
+ .auth_iv = {
.data = {
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
@@ -675,7 +675,7 @@ struct wireless_test_data zuc_test_case_auth_1b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -703,7 +703,7 @@ struct wireless_test_data zuc_test_case_auth_90b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x56, 0x1E, 0xB2, 0xDD, 0xA0, 0x00, 0x00, 0x00,
0x56, 0x1E, 0xB2, 0xDD, 0xA0, 0x00, 0x00, 0x00
@@ -734,7 +734,7 @@ struct wireless_test_data zuc_test_case_auth_577b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0xA9, 0x40, 0x59, 0xDA, 0x50, 0x00, 0x00, 0x00,
0x29, 0x40, 0x59, 0xDA, 0x50, 0x00, 0x80, 0x00
@@ -773,7 +773,7 @@ struct wireless_test_data zuc_test_case_auth_2079b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x05, 0x09, 0x78, 0x50, 0x80, 0x00, 0x00, 0x00,
0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00
@@ -835,7 +835,7 @@ struct wireless_test_data zuc_test_auth_5670b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x56, 0x1E, 0xB2, 0xDD, 0xE0, 0x00, 0x00, 0x00,
0x56, 0x1E, 0xB2, 0xDD, 0xE0, 0x00, 0x00, 0x00
@@ -950,7 +950,7 @@ static struct wireless_test_data zuc_test_case_auth_128b = {
.data = { 0x0 },
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = { 0x0 },
.len = 16
},
@@ -975,7 +975,7 @@ static struct wireless_test_data zuc_test_case_auth_2080b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0x05, 0x09, 0x78, 0x50, 0x80, 0x00, 0x00, 0x00,
0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00
@@ -1037,7 +1037,7 @@ static struct wireless_test_data zuc_test_case_auth_584b = {
},
.len = 16
},
- .aad = {
+ .auth_iv = {
.data = {
0xa9, 0x40, 0x59, 0xda, 0x50, 0x0, 0x0, 0x0,
0x29, 0x40, 0x59, 0xda, 0x50, 0x0, 0x80, 0x0