MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ccp_perform_3des

Function ccp_perform_3des

dpdk/drivers/crypto/ccp/ccp_crypto.c:2251–2348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2249}
2250
2251static int
2252ccp_perform_3des(struct rte_crypto_op *op,
2253 struct ccp_queue *cmd_q,
2254 struct ccp_batch_info *b_info)
2255{
2256 struct ccp_session *session;
2257 union ccp_function function;
2258 unsigned char *lsb_buf;
2259 struct ccp_passthru pst;
2260 struct ccp_desc *desc;
2261 uint32_t tail;
2262 uint8_t *iv;
2263 phys_addr_t src_addr, dest_addr, key_addr;
2264
2265 session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
2266
2267 iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
2268 switch (session->cipher.um.des_mode) {
2269 case CCP_DES_MODE_CBC:
2270 lsb_buf = &(b_info->lsb_buf[b_info->lsb_buf_idx*CCP_SB_BYTES]);
2271 b_info->lsb_buf_idx++;
2272
2273 rte_memcpy(lsb_buf + (CCP_SB_BYTES - session->iv.length),
2274 iv, session->iv.length);
2275 pst.src_addr = (phys_addr_t)rte_mem_virt2iova((void *) lsb_buf);
2276 pst.dest_addr = (phys_addr_t)(cmd_q->sb_iv * CCP_SB_BYTES);
2277 pst.len = CCP_SB_BYTES;
2278 pst.dir = 1;
2279 pst.bit_mod = CCP_PASSTHRU_BITWISE_NOOP;
2280 pst.byte_swap = CCP_PASSTHRU_BYTESWAP_256BIT;
2281 ccp_perform_passthru(&pst, cmd_q);
2282 break;
2283 case CCP_DES_MODE_CFB:
2284 case CCP_DES_MODE_ECB:
2285 CCP_LOG_ERR("Unsupported DES cipher mode");
2286 return -ENOTSUP;
2287 }
2288
2289 src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
2290 op->sym->cipher.data.offset);
2291 if (unlikely(op->sym->m_dst != NULL))
2292 dest_addr =
2293 rte_pktmbuf_iova_offset(op->sym->m_dst,
2294 op->sym->cipher.data.offset);
2295 else
2296 dest_addr = src_addr;
2297
2298 key_addr = rte_mem_virt2iova(session->cipher.key_ccp);
2299 desc = &cmd_q->qbase_desc[cmd_q->qidx];
2300
2301 memset(desc, 0, Q_DESC_SIZE);
2302
2303 /* prepare desc for des command */
2304 CCP_CMD_ENGINE(desc) = CCP_ENGINE_3DES;
2305
2306 CCP_CMD_SOC(desc) = 0;
2307 CCP_CMD_IOC(desc) = 0;
2308 CCP_CMD_INIT(desc) = 1;

Callers 1

ccp_crypto_cipherFunction · 0.85

Calls 5

ccp_perform_passthruFunction · 0.85
memsetFunction · 0.85
high32_valueFunction · 0.70
rte_memcpyFunction · 0.50
rte_mem_virt2iovaFunction · 0.50

Tested by

no test coverage detected