| 637 | } |
| 638 | |
| 639 | static void * |
| 640 | create_ipsec_session(struct rte_mempool *sess_mp, |
| 641 | uint8_t dev_id, |
| 642 | const struct cperf_options *options, |
| 643 | const struct cperf_test_vector *test_vector, |
| 644 | uint16_t iv_offset) |
| 645 | { |
| 646 | struct rte_crypto_sym_xform auth_xform = {0}; |
| 647 | struct rte_crypto_sym_xform *crypto_xform; |
| 648 | struct rte_crypto_sym_xform xform = {0}; |
| 649 | |
| 650 | if (options->aead_algo != 0) { |
| 651 | /* Setup AEAD Parameters */ |
| 652 | xform.type = RTE_CRYPTO_SYM_XFORM_AEAD; |
| 653 | xform.next = NULL; |
| 654 | xform.aead.algo = options->aead_algo; |
| 655 | xform.aead.op = options->aead_op; |
| 656 | xform.aead.iv.offset = iv_offset; |
| 657 | xform.aead.key.data = test_vector->aead_key.data; |
| 658 | xform.aead.key.length = test_vector->aead_key.length; |
| 659 | xform.aead.iv.length = test_vector->aead_iv.length; |
| 660 | xform.aead.digest_length = options->digest_sz; |
| 661 | xform.aead.aad_length = options->aead_aad_sz; |
| 662 | crypto_xform = &xform; |
| 663 | } else if (options->cipher_algo != 0 && options->auth_algo != 0) { |
| 664 | /* Setup Cipher Parameters */ |
| 665 | xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 666 | xform.cipher.algo = options->cipher_algo; |
| 667 | xform.cipher.op = options->cipher_op; |
| 668 | xform.cipher.iv.offset = iv_offset; |
| 669 | xform.cipher.iv.length = test_vector->cipher_iv.length; |
| 670 | /* cipher different than null */ |
| 671 | if (options->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { |
| 672 | xform.cipher.key.data = test_vector->cipher_key.data; |
| 673 | xform.cipher.key.length = |
| 674 | test_vector->cipher_key.length; |
| 675 | } else { |
| 676 | xform.cipher.key.data = NULL; |
| 677 | xform.cipher.key.length = 0; |
| 678 | } |
| 679 | |
| 680 | /* Setup Auth Parameters */ |
| 681 | auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 682 | auth_xform.auth.algo = options->auth_algo; |
| 683 | auth_xform.auth.op = options->auth_op; |
| 684 | auth_xform.auth.iv.offset = iv_offset + |
| 685 | xform.cipher.iv.length; |
| 686 | /* auth different than null */ |
| 687 | if (options->auth_algo != RTE_CRYPTO_AUTH_NULL) { |
| 688 | auth_xform.auth.digest_length = options->digest_sz; |
| 689 | auth_xform.auth.key.length = |
| 690 | test_vector->auth_key.length; |
| 691 | auth_xform.auth.key.data = test_vector->auth_key.data; |
| 692 | auth_xform.auth.iv.length = test_vector->auth_iv.length; |
| 693 | } else { |
| 694 | auth_xform.auth.digest_length = 0; |
| 695 | auth_xform.auth.key.length = 0; |
| 696 | auth_xform.auth.key.data = NULL; |
no test coverage detected