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

Function outb_cop_prepare

dpdk/lib/ipsec/esp_outb.c:59–133  ·  view source on GitHub ↗

* setup crypto op and crypto sym op for ESP outbound packet. */

Source from the content-addressed store, hash-verified

57 * setup crypto op and crypto sym op for ESP outbound packet.
58 */
59static inline void
60outb_cop_prepare(struct rte_crypto_op *cop,
61 const struct rte_ipsec_sa *sa, const uint64_t ivp[IPSEC_MAX_IV_QWORD],
62 const union sym_op_data *icv, uint32_t hlen, uint32_t plen)
63{
64 struct rte_crypto_sym_op *sop;
65 struct aead_gcm_iv *gcm;
66 struct aead_ccm_iv *ccm;
67 struct aead_chacha20_poly1305_iv *chacha20_poly1305;
68 struct aesctr_cnt_blk *ctr;
69 uint32_t algo;
70
71 algo = sa->algo_type;
72
73 /* fill sym op fields */
74 sop = cop->sym;
75
76 switch (algo) {
77 case ALGO_TYPE_AES_CBC:
78 /* Cipher-Auth (AES-CBC *) case */
79 case ALGO_TYPE_3DES_CBC:
80 /* Cipher-Auth (3DES-CBC *) case */
81 case ALGO_TYPE_NULL:
82 /* NULL case */
83 sop_ciph_auth_prepare(sop, sa, icv, hlen, plen);
84 break;
85 case ALGO_TYPE_AES_GMAC:
86 /* GMAC case */
87 sop_ciph_auth_prepare(sop, sa, icv, hlen, plen);
88
89 /* fill AAD IV (located inside crypto op) */
90 gcm = rte_crypto_op_ctod_offset(cop, struct aead_gcm_iv *,
91 sa->iv_ofs);
92 aead_gcm_iv_fill(gcm, ivp[0], sa->salt);
93 break;
94 case ALGO_TYPE_AES_GCM:
95 /* AEAD (AES_GCM) case */
96 sop_aead_prepare(sop, sa, icv, hlen, plen);
97
98 /* fill AAD IV (located inside crypto op) */
99 gcm = rte_crypto_op_ctod_offset(cop, struct aead_gcm_iv *,
100 sa->iv_ofs);
101 aead_gcm_iv_fill(gcm, ivp[0], sa->salt);
102 break;
103 case ALGO_TYPE_AES_CCM:
104 /* AEAD (AES_CCM) case */
105 sop_aead_prepare(sop, sa, icv, hlen, plen);
106
107 /* fill AAD IV (located inside crypto op) */
108 ccm = rte_crypto_op_ctod_offset(cop, struct aead_ccm_iv *,
109 sa->iv_ofs);
110 aead_ccm_iv_fill(ccm, ivp[0], sa->salt);
111 break;
112 case ALGO_TYPE_CHACHA20_POLY1305:
113 /* AEAD (CHACHA20_POLY) case */
114 sop_aead_prepare(sop, sa, icv, hlen, plen);
115
116 /* fill AAD IV (located inside crypto op) */

Callers 2

esp_outb_tun_prepareFunction · 0.85
esp_outb_trs_prepareFunction · 0.85

Calls 6

aead_gcm_iv_fillFunction · 0.85
aead_ccm_iv_fillFunction · 0.85
aes_ctr_cnt_blk_fillFunction · 0.85
sop_ciph_auth_prepareFunction · 0.70
sop_aead_prepareFunction · 0.70

Tested by

no test coverage detected