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

Function ccp_perform_aes_gcm

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

Source from the content-addressed store, hash-verified

2348}
2349
2350static int
2351ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
2352{
2353 struct ccp_session *session;
2354 union ccp_function function;
2355 uint8_t *iv;
2356 struct ccp_passthru pst;
2357 struct ccp_desc *desc;
2358 uint32_t tail;
2359 uint64_t *temp;
2360 phys_addr_t src_addr, dest_addr, key_addr, aad_addr;
2361 phys_addr_t digest_dest_addr;
2362 int length, non_align_len;
2363
2364 session = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
2365 iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
2366 key_addr = session->cipher.key_phys;
2367
2368 src_addr = rte_pktmbuf_iova_offset(op->sym->m_src,
2369 op->sym->aead.data.offset);
2370 if (unlikely(op->sym->m_dst != NULL))
2371 dest_addr = rte_pktmbuf_iova_offset(op->sym->m_dst,
2372 op->sym->aead.data.offset);
2373 else
2374 dest_addr = src_addr;
2375 rte_pktmbuf_append(op->sym->m_src, session->auth.ctx_len);
2376 digest_dest_addr = op->sym->aead.digest.phys_addr;
2377 temp = (uint64_t *)(op->sym->aead.digest.data + AES_BLOCK_SIZE);
2378 *temp++ = rte_bswap64(session->auth.aad_length << 3);
2379 *temp = rte_bswap64(op->sym->aead.data.length << 3);
2380
2381 non_align_len = op->sym->aead.data.length % AES_BLOCK_SIZE;
2382 length = CCP_ALIGN(op->sym->aead.data.length, AES_BLOCK_SIZE);
2383
2384 aad_addr = op->sym->aead.aad.phys_addr;
2385
2386 /* CMD1 IV Passthru */
2387 rte_memcpy(session->cipher.nonce + AES_BLOCK_SIZE, iv,
2388 session->iv.length);
2389 pst.src_addr = session->cipher.nonce_phys;
2390 pst.dest_addr = (phys_addr_t)(cmd_q->sb_iv * CCP_SB_BYTES);
2391 pst.len = CCP_SB_BYTES;
2392 pst.dir = 1;
2393 pst.bit_mod = CCP_PASSTHRU_BITWISE_NOOP;
2394 pst.byte_swap = CCP_PASSTHRU_BYTESWAP_NOOP;
2395 ccp_perform_passthru(&pst, cmd_q);
2396
2397 /* CMD2 GHASH-AAD */
2398 function.raw = 0;
2399 CCP_AES_ENCRYPT(&function) = CCP_AES_MODE_GHASH_AAD;
2400 CCP_AES_MODE(&function) = CCP_AES_MODE_GHASH;
2401 CCP_AES_TYPE(&function) = session->cipher.ut.aes_type;
2402
2403 desc = &cmd_q->qbase_desc[cmd_q->qidx];
2404 memset(desc, 0, Q_DESC_SIZE);
2405
2406 CCP_CMD_ENGINE(desc) = CCP_ENGINE_AES;
2407 CCP_CMD_INIT(desc) = 1;

Callers 1

ccp_crypto_aeadFunction · 0.85

Calls 5

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

Tested by

no test coverage detected