| 2819 | } |
| 2820 | |
| 2821 | static int |
| 2822 | ccp_prepare_ops(struct ccp_qp *qp, |
| 2823 | struct rte_crypto_op **op_d, |
| 2824 | struct ccp_batch_info *b_info, |
| 2825 | uint16_t nb_ops) |
| 2826 | { |
| 2827 | int i, min_ops; |
| 2828 | struct ccp_session *session; |
| 2829 | |
| 2830 | EVP_MD_CTX *auth_ctx = NULL; |
| 2831 | |
| 2832 | auth_ctx = EVP_MD_CTX_create(); |
| 2833 | if (unlikely(!auth_ctx)) { |
| 2834 | CCP_LOG_ERR("Unable to create auth ctx"); |
| 2835 | return 0; |
| 2836 | } |
| 2837 | min_ops = RTE_MIN(nb_ops, b_info->opcnt); |
| 2838 | |
| 2839 | for (i = b_info->b_idx; i < min_ops; i++) { |
| 2840 | op_d[i] = b_info->op[b_info->b_idx + b_info->op_idx++]; |
| 2841 | session = CRYPTODEV_GET_SYM_SESS_PRIV(op_d[i]->sym->session); |
| 2842 | switch (session->cmd_id) { |
| 2843 | case CCP_CMD_CIPHER: |
| 2844 | op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS; |
| 2845 | break; |
| 2846 | case CCP_CMD_AUTH: |
| 2847 | if (session->auth_opt == 0) |
| 2848 | ccp_auth_dq_prepare(op_d[i]); |
| 2849 | break; |
| 2850 | case CCP_CMD_CIPHER_HASH: |
| 2851 | if (session->auth_opt) |
| 2852 | cpu_crypto_auth(qp, op_d[i], |
| 2853 | session, auth_ctx); |
| 2854 | else |
| 2855 | ccp_auth_dq_prepare(op_d[i]); |
| 2856 | break; |
| 2857 | case CCP_CMD_HASH_CIPHER: |
| 2858 | if (session->auth_opt) |
| 2859 | op_d[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS; |
| 2860 | else |
| 2861 | ccp_auth_dq_prepare(op_d[i]); |
| 2862 | break; |
| 2863 | case CCP_CMD_COMBINED: |
| 2864 | ccp_auth_dq_prepare(op_d[i]); |
| 2865 | break; |
| 2866 | default: |
| 2867 | CCP_LOG_ERR("Unsupported cmd_id"); |
| 2868 | } |
| 2869 | } |
| 2870 | |
| 2871 | EVP_MD_CTX_destroy(auth_ctx); |
| 2872 | b_info->opcnt -= min_ops; |
| 2873 | return min_ops; |
| 2874 | } |
| 2875 | |
| 2876 | int |
| 2877 | process_ops_to_dequeue(struct ccp_qp *qp, |
no test coverage detected