MCPcopy Create free account
hub / github.com/F-Stack/f-stack / operation_create

Function operation_create

dpdk/app/test/test_cryptodev_crosscheck.c:673–739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673static struct rte_crypto_op*
674operation_create(const struct crosscheck_test_profile *profile,
675 struct rte_mbuf *ibuf, enum crypto_op_type op_type)
676{
677 struct crosscheck_testsuite_params *ts_params = &testsuite_params;
678 uint8_t *digest_data = NULL, *aad_data = NULL, *iv_ptr = NULL;
679 uint16_t aad_size, digest_size, plaintext_len;
680 struct rte_crypto_sym_op *sym_op;
681 struct rte_crypto_op *op;
682
683 op = rte_crypto_op_alloc(ts_params->op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
684 if (op == NULL) {
685 RTE_LOG(ERR, USER1, "Failed to allocate symmetric crypto operation struct");
686 return NULL;
687 }
688
689 plaintext_len = profile->input_buf_len;
690 aad_size = profile->aad_size;
691 digest_size = profile->digest_size;
692
693 if (aad_size) {
694 aad_data = ts_params->aad.mem;
695 if (op_type == OP_ENCRYPT)
696 pattern_fill(aad_data, "This is an aad.", aad_size);
697 }
698
699 if (digest_size) {
700 digest_data = ts_params->digest.mem;
701 if (op_type == OP_ENCRYPT)
702 memset(digest_data, 0, sizeof(digest_size));
703 }
704
705 sym_op = op->sym;
706 memset(sym_op, 0, sizeof(*sym_op));
707
708 iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET);
709 rte_memcpy(iv_ptr, ts_params->iv.mem, profile->iv_size);
710
711 switch (profile->xform_type) {
712 case RTE_CRYPTO_SYM_XFORM_AUTH:
713 sym_op->auth.digest.data = digest_data;
714 sym_op->auth.digest.phys_addr = rte_malloc_virt2iova(sym_op->auth.digest.data);
715 sym_op->auth.data.length = plaintext_len;
716 break;
717 case RTE_CRYPTO_SYM_XFORM_CIPHER:
718 sym_op->cipher.data.length = plaintext_len;
719 break;
720 case RTE_CRYPTO_SYM_XFORM_AEAD:
721 sym_op->aead.aad.data = aad_data;
722 sym_op->aead.aad.phys_addr = rte_malloc_virt2iova(sym_op->aead.aad.data);
723 sym_op->aead.digest.data = digest_data;
724 sym_op->aead.digest.phys_addr = rte_malloc_virt2iova(sym_op->aead.digest.data);
725 sym_op->aead.data.offset = 0;
726 sym_op->aead.data.length = plaintext_len;
727 break;
728 default:
729 goto error;
730 }

Callers 1

single_dev_processFunction · 0.85

Calls 6

rte_crypto_op_allocFunction · 0.85
pattern_fillFunction · 0.85
memsetFunction · 0.85
rte_malloc_virt2iovaFunction · 0.85
rte_crypto_op_freeFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected