Hi Radu,
Please see my comments inline.
Regards,
Nithin Sen
> +static int
> +test_NEA_helper(
> + struct nxa_256_test_data *tdata,
> + enum rte_crypto_cipher_operation op)
> +{
> + struct crypto_testsuite_params *ts_params = &testsuite_params;
> + struct crypto_unittest_params *ut_params = &unittest_params;
> +
> + int retval;
> + uint8_t *input, *output;
> + uint32_t pad_len;
> + uint32_t len;
> + bool is_enc = (op == RTE_CRYPTO_CIPHER_OP_ENCRYPT);
> +
> + if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
> + return TEST_SKIPPED;
> +
> + /* Create session */
> + retval = create_wireless_algo_cipher_session(ts_params-
> >valid_devs[0],
> + RTE_CRYPTO_CIPHER_OP_ENCRYPT,
> + tdata->cipher_algo, tdata->key, 32,
> 16);
> + if (retval < 0)
[Nithinsen] Could this be retval != 0, since the TEST_SKIPPED macro value is
positive ?
> + return retval;
> +
> + ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
> +
> +static int
> +test_NIA_helper(struct nxa_256_test_data *tdata)
> +{
> + struct crypto_testsuite_params *ts_params = &testsuite_params;
> + struct crypto_unittest_params *ut_params = &unittest_params;
> +
> + int retval;
> + uint32_t plaintext_pad_len;
> + uint32_t plaintext_len;
> + uint8_t *plaintext;
> +
> + if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
> + return TEST_SKIPPED;
> +
> + /* Create auth session */
> + retval = create_wireless_algo_hash_session(ts_params-
> >valid_devs[0],
> + tdata->key, 32,
> + 16, tdata->tag_size >> 3,
> + RTE_CRYPTO_AUTH_OP_VERIFY,
> + tdata->auth_algo);
> + if (retval < 0)
[Nithinsen] Could this be retval != 0, since the TEST_SKIPPED macro value is
positive ?
> + return retval;
> + /* alloc mbuf and set payload */
> + ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
> +
> + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
> + rte_pktmbuf_tailroom(ut_params->ibuf));
> +
> + plaintext_len = ceil_byte_length(tdata->msg_size);
> + /* Append data which is padded to a multiple */
> + /* of the algorithms block size */
> + plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
> + plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
> + plaintext_pad_len);
> + memcpy(plaintext, tdata->plaintext, plaintext_len);
> +
> + /* Create auth operation */
> + retval = create_wireless_algo_hash_operation(tdata->tag,
> + tdata->tag_size >> 3,
> + tdata->iv, 16,
> + plaintext_pad_len,
> + RTE_CRYPTO_AUTH_OP_VERIFY,
> + tdata->msg_size >> 3,
[Nithinsen] Isn't this api expecting length in bits ? As in other pdcp cases.
> + 0);
> + if (retval < 0)
> + return retval;
> +
> + if (global_api_test_type == CRYPTODEV_RAW_API_TEST) {
> + retval = process_sym_raw_dp_op(ts_params->valid_devs[0],
> 0, ut_params->op, 0, 1, 1,
> + 0);
> + if (retval != TEST_SUCCESS)
> + return retval;
> + } else
> + ut_params->op = process_crypto_request(ts_params-
> >valid_devs[0],
> + ut_params->op);
> + TEST_ASSERT_NOT_NULL(ut_params->op, "Crypto request failed");
> + ut_params->obuf = ut_params->op->sym->m_src;
> + ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf,
> + uint8_t *,
> + plaintext_pad_len);
> +
> + /* Validate obuf */
> + if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
> + return 0;
> + else
> + return -1;
> +
> + return 0;
> +}
> +