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

Function outb_pkt_xprepare

dpdk/lib/ipsec/esp_outb.c:243–286  ·  view source on GitHub ↗

* for pure cryptodev (lookaside none) depending on SA settings, * we might have to write some extra data to the packet. */

Source from the content-addressed store, hash-verified

241 * we might have to write some extra data to the packet.
242 */
243static inline void
244outb_pkt_xprepare(const struct rte_ipsec_sa *sa, rte_be64_t sqc,
245 const union sym_op_data *icv)
246{
247 uint32_t *psqh;
248 struct aead_gcm_aad *gaad;
249 struct aead_ccm_aad *caad;
250 struct aead_chacha20_poly1305_aad *chacha20_poly1305_aad;
251
252 /* insert SQN.hi between ESP trailer and ICV */
253 if (sa->sqh_len != 0) {
254 psqh = (uint32_t *)(icv->va - sa->sqh_len);
255 psqh[0] = sqn_hi32(sqc);
256 }
257
258 /*
259 * fill IV and AAD fields, if any (aad fields are placed after icv),
260 * right now we support only one AEAD algorithm: AES-GCM .
261 */
262 switch (sa->algo_type) {
263 case ALGO_TYPE_AES_GCM:
264 if (sa->aad_len != 0) {
265 gaad = (struct aead_gcm_aad *)(icv->va + sa->icv_len);
266 aead_gcm_aad_fill(gaad, sa->spi, sqc, IS_ESN(sa));
267 }
268 break;
269 case ALGO_TYPE_AES_CCM:
270 if (sa->aad_len != 0) {
271 caad = (struct aead_ccm_aad *)(icv->va + sa->icv_len);
272 aead_ccm_aad_fill(caad, sa->spi, sqc, IS_ESN(sa));
273 }
274 break;
275 case ALGO_TYPE_CHACHA20_POLY1305:
276 if (sa->aad_len != 0) {
277 chacha20_poly1305_aad = (struct aead_chacha20_poly1305_aad *)
278 (icv->va + sa->icv_len);
279 aead_chacha20_poly1305_aad_fill(chacha20_poly1305_aad,
280 sa->spi, sqc, IS_ESN(sa));
281 }
282 break;
283 default:
284 break;
285 }
286}
287
288/*
289 * setup/update packets and crypto ops for ESP outbound tunnel case.

Callers 3

esp_outb_tun_prepareFunction · 0.85
esp_outb_trs_prepareFunction · 0.85
cpu_outb_pkt_prepareFunction · 0.85

Calls 4

sqn_hi32Function · 0.85
aead_gcm_aad_fillFunction · 0.85
aead_ccm_aad_fillFunction · 0.85

Tested by

no test coverage detected