| 2164 | } |
| 2165 | |
| 2166 | static int |
| 2167 | ccp_perform_aes(struct rte_crypto_op *op, |
| 2168 | struct ccp_queue *cmd_q, |
| 2169 | struct ccp_batch_info *b_info) |
| 2170 | { |
| 2171 | struct ccp_session *session; |
| 2172 | union ccp_function function; |
| 2173 | uint8_t *lsb_buf; |
| 2174 | struct ccp_passthru pst = {0}; |
| 2175 | struct ccp_desc *desc; |
| 2176 | phys_addr_t src_addr, dest_addr, key_addr; |
| 2177 | uint8_t *iv; |
| 2178 | |
| 2179 | session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session); |
| 2180 | function.raw = 0; |
| 2181 | |
| 2182 | iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset); |
| 2183 | if (session->cipher.um.aes_mode != CCP_AES_MODE_ECB) { |
| 2184 | if (session->cipher.um.aes_mode == CCP_AES_MODE_CTR) { |
| 2185 | rte_memcpy(session->cipher.nonce + AES_BLOCK_SIZE, |
| 2186 | iv, session->iv.length); |
| 2187 | pst.src_addr = (phys_addr_t)session->cipher.nonce_phys; |
| 2188 | CCP_AES_SIZE(&function) = 0x1F; |
| 2189 | } else { |
| 2190 | lsb_buf = |
| 2191 | &(b_info->lsb_buf[b_info->lsb_buf_idx*CCP_SB_BYTES]); |
| 2192 | rte_memcpy(lsb_buf + |
| 2193 | (CCP_SB_BYTES - session->iv.length), |
| 2194 | iv, session->iv.length); |
| 2195 | pst.src_addr = b_info->lsb_buf_phys + |
| 2196 | (b_info->lsb_buf_idx * CCP_SB_BYTES); |
| 2197 | b_info->lsb_buf_idx++; |
| 2198 | } |
| 2199 | |
| 2200 | pst.dest_addr = (phys_addr_t)(cmd_q->sb_iv * CCP_SB_BYTES); |
| 2201 | pst.len = CCP_SB_BYTES; |
| 2202 | pst.dir = 1; |
| 2203 | pst.bit_mod = CCP_PASSTHRU_BITWISE_NOOP; |
| 2204 | pst.byte_swap = CCP_PASSTHRU_BYTESWAP_256BIT; |
| 2205 | ccp_perform_passthru(&pst, cmd_q); |
| 2206 | } |
| 2207 | |
| 2208 | desc = &cmd_q->qbase_desc[cmd_q->qidx]; |
| 2209 | |
| 2210 | src_addr = rte_pktmbuf_iova_offset(op->sym->m_src, |
| 2211 | op->sym->cipher.data.offset); |
| 2212 | if (likely(op->sym->m_dst != NULL)) |
| 2213 | dest_addr = rte_pktmbuf_iova_offset(op->sym->m_dst, |
| 2214 | op->sym->cipher.data.offset); |
| 2215 | else |
| 2216 | dest_addr = src_addr; |
| 2217 | key_addr = session->cipher.key_phys; |
| 2218 | |
| 2219 | /* prepare desc for aes command */ |
| 2220 | CCP_CMD_ENGINE(desc) = CCP_ENGINE_AES; |
| 2221 | CCP_CMD_INIT(desc) = 1; |
| 2222 | CCP_CMD_EOM(desc) = 1; |
| 2223 |
no test coverage detected