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)
{
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");
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];
/* 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;
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);
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);
/* 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;
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);
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];
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;
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);
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);
/* 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);
"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);
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,
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;
}
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);
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;
}
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);
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;
/* 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)
/* 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;
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(
/* 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)
/* 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;
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)
/* 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)
/* 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;
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(
/* 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)
/* 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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
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)
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;
"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(
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);
/* 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;
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;
"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(
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;
/* 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;
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 */
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);
/* 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)
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;
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(
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;
/* 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;
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(
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;
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)
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;
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;
/* 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)
/* 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;
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(