| 4589 | } |
| 4590 | |
| 4591 | static int |
| 4592 | test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata) |
| 4593 | { |
| 4594 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 4595 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 4596 | uint8_t *plaintext, *ciphertext; |
| 4597 | int retval; |
| 4598 | uint32_t plaintext_len; |
| 4599 | uint32_t plaintext_pad_len; |
| 4600 | uint8_t extra_offset = 4; |
| 4601 | uint8_t *expected_ciphertext_shifted; |
| 4602 | struct rte_cryptodev_info dev_info; |
| 4603 | |
| 4604 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 4605 | uint64_t feat_flags = dev_info.feature_flags; |
| 4606 | |
| 4607 | if (!(feat_flags & RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA) && |
| 4608 | ((tdata->validDataLenInBits.len % 8) != 0)) { |
| 4609 | printf("Device doesn't support NON-Byte Aligned Data.\n"); |
| 4610 | return TEST_SKIPPED; |
| 4611 | } |
| 4612 | |
| 4613 | /* Verify the capabilities */ |
| 4614 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 4615 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 4616 | cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_SNOW3G_UEA2; |
| 4617 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 4618 | &cap_idx) == NULL) |
| 4619 | return TEST_SKIPPED; |
| 4620 | |
| 4621 | if (global_api_test_type == CRYPTODEV_RAW_API_TEST) |
| 4622 | return TEST_SKIPPED; |
| 4623 | |
| 4624 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 4625 | return TEST_SKIPPED; |
| 4626 | |
| 4627 | /* Create SNOW 3G session */ |
| 4628 | retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0], |
| 4629 | RTE_CRYPTO_CIPHER_OP_ENCRYPT, |
| 4630 | RTE_CRYPTO_CIPHER_SNOW3G_UEA2, |
| 4631 | tdata->key.data, tdata->key.len, |
| 4632 | tdata->cipher_iv.len); |
| 4633 | if (retval < 0) |
| 4634 | return retval; |
| 4635 | |
| 4636 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 4637 | ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 4638 | |
| 4639 | TEST_ASSERT_NOT_NULL(ut_params->ibuf, |
| 4640 | "Failed to allocate input buffer in mempool"); |
| 4641 | TEST_ASSERT_NOT_NULL(ut_params->obuf, |
| 4642 | "Failed to allocate output buffer in mempool"); |
| 4643 | |
| 4644 | /* Clear mbuf payload */ |
| 4645 | memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, |
| 4646 | rte_pktmbuf_tailroom(ut_params->ibuf)); |
| 4647 | |
| 4648 | plaintext_len = ceil_byte_length(tdata->plaintext.len + extra_offset); |
no test coverage detected