| 755 | } |
| 756 | |
| 757 | static void * |
| 758 | cperf_create_session(struct rte_mempool *sess_mp, |
| 759 | uint8_t dev_id, |
| 760 | const struct cperf_options *options, |
| 761 | const struct cperf_test_vector *test_vector, |
| 762 | uint16_t iv_offset) |
| 763 | { |
| 764 | struct rte_crypto_sym_xform cipher_xform; |
| 765 | struct rte_crypto_sym_xform auth_xform; |
| 766 | struct rte_crypto_sym_xform aead_xform; |
| 767 | void *sess = NULL; |
| 768 | void *asym_sess = NULL; |
| 769 | struct rte_crypto_asym_xform xform = {0}; |
| 770 | int ret; |
| 771 | |
| 772 | if (options->op_type == CPERF_ASYM_MODEX) { |
| 773 | xform.next = NULL; |
| 774 | xform.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX; |
| 775 | xform.modex.modulus.data = options->modex_data->modulus.data; |
| 776 | xform.modex.modulus.length = options->modex_data->modulus.len; |
| 777 | xform.modex.exponent.data = options->modex_data->exponent.data; |
| 778 | xform.modex.exponent.length = options->modex_data->exponent.len; |
| 779 | |
| 780 | ret = rte_cryptodev_asym_session_create(dev_id, &xform, |
| 781 | sess_mp, &asym_sess); |
| 782 | if (ret < 0) { |
| 783 | RTE_LOG(ERR, USER1, "Asym session create failed\n"); |
| 784 | return NULL; |
| 785 | } |
| 786 | return asym_sess; |
| 787 | } |
| 788 | #ifdef RTE_LIB_SECURITY |
| 789 | /* |
| 790 | * security only |
| 791 | */ |
| 792 | if (options->op_type == CPERF_PDCP) { |
| 793 | /* Setup Cipher Parameters */ |
| 794 | cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 795 | cipher_xform.next = NULL; |
| 796 | cipher_xform.cipher.algo = options->cipher_algo; |
| 797 | cipher_xform.cipher.op = options->cipher_op; |
| 798 | cipher_xform.cipher.iv.offset = iv_offset; |
| 799 | cipher_xform.cipher.iv.length = 4; |
| 800 | |
| 801 | /* cipher different than null */ |
| 802 | if (options->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { |
| 803 | cipher_xform.cipher.key.data = test_vector->cipher_key.data; |
| 804 | cipher_xform.cipher.key.length = test_vector->cipher_key.length; |
| 805 | } else { |
| 806 | cipher_xform.cipher.key.data = NULL; |
| 807 | cipher_xform.cipher.key.length = 0; |
| 808 | } |
| 809 | |
| 810 | /* Setup Auth Parameters */ |
| 811 | if (options->auth_algo != 0) { |
| 812 | auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 813 | auth_xform.next = NULL; |
| 814 | auth_xform.auth.algo = options->auth_algo; |
nothing calls this directly
no test coverage detected