int retval;
unsigned plaintext_pad_len;
+ unsigned plaintext_len;
uint8_t *plaintext;
/* Create SNOW3G session */
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
+ plaintext_len = ceil_byte_length(tdata->plaintext.len);
/* Append data which is padded to a multiple of */
/* the algorithms block size */
- plaintext_pad_len = tdata->plaintext.len >> 3;
+ plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
plaintext_pad_len);
- memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3);
+ memcpy(plaintext, tdata->plaintext.data, plaintext_len);
/* Create SNOW3G opertaion */
retval = create_snow3g_hash_operation(NULL, tdata->digest.len,
int retval;
unsigned plaintext_pad_len;
+ unsigned plaintext_len;
uint8_t *plaintext;
/* Create SNOW3G session */
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- /* Append data which is padded to a multiple */
- /* of the algorithms block size */
- plaintext_pad_len = tdata->plaintext.len >> 3;
+ plaintext_len = ceil_byte_length(tdata->plaintext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
- plaintext_pad_len);
- memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3);
+ plaintext_pad_len);
+ memcpy(plaintext, tdata->plaintext.data, plaintext_len);
/* Create SNOW3G operation */
retval = create_snow3g_hash_operation(tdata->digest.data,
int retval;
uint8_t *plaintext, *ciphertext;
- uint8_t plaintext_pad_len;
+ unsigned plaintext_pad_len;
+ unsigned plaintext_len;
/* Create SNOW3G session */
retval = create_snow3g_cipher_session(ts_params->valid_devs[0],
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- /*
- * Append data which is padded to a
- * multiple of the algorithms block size
- */
- /*tdata->plaintext.len = tdata->plaintext.len >> 3;*/
- plaintext_pad_len = RTE_ALIGN_CEIL((tdata->plaintext.len >> 3), 16);
-
- plaintext = (uint8_t *) rte_pktmbuf_append(ut_params->ibuf,
- plaintext_pad_len);
- memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3));
+ plaintext_len = ceil_byte_length(tdata->plaintext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
+ plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ plaintext_pad_len);
+ memcpy(plaintext, tdata->plaintext.data, plaintext_len);
TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
uint8_t *plaintext, *ciphertext;
int retval;
- uint8_t plaintext_pad_len;
+ unsigned plaintext_pad_len;
+ unsigned plaintext_len;
/* Create SNOW3G session */
retval = create_snow3g_cipher_session(ts_params->valid_devs[0],
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- /*
- * Append data which is padded to a
- * multiple of the algorithms block size
- */
- /*tdata->plaintext.len = tdata->plaintext.len >> 3;*/
- plaintext_pad_len = RTE_ALIGN_CEIL((tdata->plaintext.len >> 3), 16);
-
- plaintext = (uint8_t *) rte_pktmbuf_append(ut_params->ibuf,
- plaintext_pad_len);
-
- rte_pktmbuf_append(ut_params->obuf,
- plaintext_pad_len);
-
- memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3));
+ plaintext_len = ceil_byte_length(tdata->plaintext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
+ plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ plaintext_pad_len);
+ rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
+ memcpy(plaintext, tdata->plaintext.data, plaintext_len);
TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
int retval;
uint8_t *plaintext, *ciphertext;
- uint8_t ciphertext_pad_len;
+ unsigned ciphertext_pad_len;
+ unsigned ciphertext_len;
/* Create SNOW3G session */
retval = create_snow3g_cipher_session(ts_params->valid_devs[0],
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- /*
- * Append data which is padded to a
- * multiple of the algorithms block size
- */
- ciphertext_pad_len = RTE_ALIGN_CEIL((tdata->ciphertext.len >> 3), 16);
-
- ciphertext = (uint8_t *) rte_pktmbuf_append(ut_params->ibuf,
- ciphertext_pad_len);
- memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len >> 3);
+ ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 16);
+ ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ ciphertext_pad_len);
+ memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
ut_params->op);
TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
- ut_params->obuf = ut_params->op->sym->m_src;
+ ut_params->obuf = ut_params->op->sym->m_dst;
if (ut_params->obuf)
plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
+ tdata->iv.len;
int retval;
uint8_t *plaintext, *ciphertext;
- uint8_t ciphertext_pad_len;
+ unsigned ciphertext_pad_len;
+ unsigned ciphertext_len;
/* Create SNOW3G session */
retval = create_snow3g_cipher_session(ts_params->valid_devs[0],
memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->obuf));
- /*
- * Append data which is padded to a
- * multiple of the algorithms block size
- */
- ciphertext_pad_len = RTE_ALIGN_CEIL((tdata->ciphertext.len >> 3), 16);
-
- ciphertext = (uint8_t *) rte_pktmbuf_append(ut_params->ibuf,
- ciphertext_pad_len);
-
- rte_pktmbuf_append(ut_params->obuf,
- ciphertext_pad_len);
-
- memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len >> 3);
+ ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 16);
+ ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ ciphertext_pad_len);
+ rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
+ memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
int retval;
uint8_t *plaintext, *ciphertext;
- uint8_t plaintext_pad_len;
+ unsigned plaintext_pad_len;
+ unsigned plaintext_len;
/* Create SNOW3G session */
retval = create_snow3g_cipher_auth_session(ts_params->valid_devs[0],
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- /* Append data which is padded to a multiple */
- /* of the algorithms block size */
- plaintext_pad_len = tdata->plaintext.len >> 3;
-
+ plaintext_len = ceil_byte_length(tdata->plaintext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
- plaintext_pad_len);
- memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3);
+ plaintext_pad_len);
+ memcpy(plaintext, tdata->plaintext.data, plaintext_len);
TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
int retval;
uint8_t *plaintext, *ciphertext;
- uint8_t plaintext_pad_len;
+ unsigned plaintext_pad_len;
+ unsigned plaintext_len;
/* Create SNOW3G session */
retval = create_snow3g_auth_cipher_session(ts_params->valid_devs[0],
memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
rte_pktmbuf_tailroom(ut_params->ibuf));
- /* Append data which is padded to a multiple */
- /* of the algorithms block size */
- plaintext_pad_len = RTE_ALIGN_CEIL((tdata->plaintext.len >> 3), 8);
-
+ plaintext_len = ceil_byte_length(tdata->plaintext.len);
+ /* Append data which is padded to a multiple of */
+ /* the algorithms block size */
+ plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
- plaintext_pad_len);
- memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3);
+ plaintext_pad_len);
+ memcpy(plaintext, tdata->plaintext.data, plaintext_len);
TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_5),
-
/** Snow3G decrypt only (UEA2) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_decryption_test_case_1),