| 587 | } |
| 588 | |
| 589 | static struct rte_cryptodev_sym_session* |
| 590 | session_create(const struct crosscheck_test_profile *profile, uint8_t dev_id, |
| 591 | enum crypto_op_type op_type) |
| 592 | { |
| 593 | struct crosscheck_testsuite_params *ts_params = &testsuite_params; |
| 594 | struct rte_cryptodev_sym_session *session; |
| 595 | struct rte_crypto_sym_xform xform; |
| 596 | |
| 597 | memset(&xform, 0, sizeof(xform)); |
| 598 | |
| 599 | switch (profile->xform_type) { |
| 600 | case RTE_CRYPTO_SYM_XFORM_AUTH: |
| 601 | xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 602 | xform.next = NULL; |
| 603 | xform.auth.algo = profile->algo; |
| 604 | xform.auth.op = op_type == OP_ENCRYPT ? RTE_CRYPTO_AUTH_OP_GENERATE : |
| 605 | RTE_CRYPTO_AUTH_OP_VERIFY; |
| 606 | xform.auth.digest_length = profile->digest_size; |
| 607 | xform.auth.key.length = profile->key_size; |
| 608 | xform.auth.key.data = ts_params->key.mem; |
| 609 | xform.auth.iv.length = profile->iv_size; |
| 610 | xform.auth.iv.offset = IV_OFFSET; |
| 611 | break; |
| 612 | case RTE_CRYPTO_SYM_XFORM_CIPHER: |
| 613 | xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 614 | xform.next = NULL; |
| 615 | xform.cipher.algo = profile->algo; |
| 616 | xform.cipher.op = op_type == OP_ENCRYPT ? RTE_CRYPTO_CIPHER_OP_ENCRYPT : |
| 617 | RTE_CRYPTO_CIPHER_OP_DECRYPT; |
| 618 | xform.cipher.key.length = profile->key_size; |
| 619 | xform.cipher.key.data = ts_params->key.mem; |
| 620 | xform.cipher.iv.length = profile->iv_size; |
| 621 | xform.cipher.iv.offset = IV_OFFSET; |
| 622 | break; |
| 623 | case RTE_CRYPTO_SYM_XFORM_AEAD: |
| 624 | xform.type = RTE_CRYPTO_SYM_XFORM_AEAD; |
| 625 | xform.next = NULL; |
| 626 | xform.aead.algo = profile->algo; |
| 627 | xform.aead.op = op_type == OP_ENCRYPT ? RTE_CRYPTO_AEAD_OP_ENCRYPT : |
| 628 | RTE_CRYPTO_AEAD_OP_DECRYPT; |
| 629 | xform.aead.digest_length = profile->digest_size; |
| 630 | xform.aead.key.length = profile->key_size; |
| 631 | xform.aead.key.data = ts_params->key.mem; |
| 632 | xform.aead.iv.length = profile->iv_size; |
| 633 | xform.aead.iv.offset = IV_OFFSET; |
| 634 | xform.aead.aad_length = profile->aad_size; |
| 635 | break; |
| 636 | default: |
| 637 | return NULL; |
| 638 | } |
| 639 | |
| 640 | session = rte_cryptodev_sym_session_create(dev_id, &xform, testsuite_params.session_mpool); |
| 641 | |
| 642 | return session; |
| 643 | } |
| 644 | |
| 645 | static struct rte_mbuf* |
| 646 | mbuf_create(const uint8_t *input_buf, uint16_t input_len) |
no test coverage detected