| 15424 | } |
| 15425 | |
| 15426 | static int |
| 15427 | create_aead_operation_SGL(enum rte_crypto_aead_operation op, |
| 15428 | const struct aead_test_data *tdata, |
| 15429 | void *digest_mem, uint64_t digest_phys) |
| 15430 | { |
| 15431 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 15432 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 15433 | |
| 15434 | const unsigned int auth_tag_len = tdata->auth_tag.len; |
| 15435 | const unsigned int iv_len = tdata->iv.len; |
| 15436 | unsigned int aad_len = tdata->aad.len; |
| 15437 | unsigned int aad_len_pad = 0; |
| 15438 | |
| 15439 | /* Generate Crypto op data structure */ |
| 15440 | ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, |
| 15441 | RTE_CRYPTO_OP_TYPE_SYMMETRIC); |
| 15442 | TEST_ASSERT_NOT_NULL(ut_params->op, |
| 15443 | "Failed to allocate symmetric crypto operation struct"); |
| 15444 | |
| 15445 | struct rte_crypto_sym_op *sym_op = ut_params->op->sym; |
| 15446 | |
| 15447 | sym_op->aead.digest.data = digest_mem; |
| 15448 | |
| 15449 | TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data, |
| 15450 | "no room to append digest"); |
| 15451 | |
| 15452 | sym_op->aead.digest.phys_addr = digest_phys; |
| 15453 | |
| 15454 | if (op == RTE_CRYPTO_AEAD_OP_DECRYPT) { |
| 15455 | rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data, |
| 15456 | auth_tag_len); |
| 15457 | debug_hexdump(stdout, "digest:", |
| 15458 | sym_op->aead.digest.data, |
| 15459 | auth_tag_len); |
| 15460 | } |
| 15461 | |
| 15462 | /* Append aad data */ |
| 15463 | if (tdata->algo == RTE_CRYPTO_AEAD_AES_CCM) { |
| 15464 | uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, |
| 15465 | uint8_t *, IV_OFFSET); |
| 15466 | |
| 15467 | /* Copy IV 1 byte after the IV pointer, according to the API */ |
| 15468 | rte_memcpy(iv_ptr + 1, tdata->iv.data, iv_len); |
| 15469 | |
| 15470 | aad_len = RTE_ALIGN_CEIL(aad_len + 18, 16); |
| 15471 | |
| 15472 | sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend( |
| 15473 | ut_params->ibuf, aad_len); |
| 15474 | TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, |
| 15475 | "no room to prepend aad"); |
| 15476 | sym_op->aead.aad.phys_addr = rte_pktmbuf_iova( |
| 15477 | ut_params->ibuf); |
| 15478 | |
| 15479 | memset(sym_op->aead.aad.data, 0, aad_len); |
| 15480 | /* Copy AAD 18 bytes after the AAD pointer, according to the API */ |
| 15481 | rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len); |
| 15482 | |
| 15483 | debug_hexdump(stdout, "iv:", iv_ptr, iv_len); |
no test coverage detected