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

Function esp_hdrsiz

freebsd/netipsec/xform_esp.c:108–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106static int esp_output_cb(struct cryptop *crp);
107
108size_t
109esp_hdrsiz(struct secasvar *sav)
110{
111 size_t size;
112
113 if (sav != NULL) {
114 /*XXX not right for null algorithm--does it matter??*/
115 IPSEC_ASSERT(sav->tdb_encalgxform != NULL,
116 ("SA with null xform"));
117 if (sav->flags & SADB_X_EXT_OLD)
118 size = sizeof (struct esp);
119 else
120 size = sizeof (struct newesp);
121 size += sav->tdb_encalgxform->blocksize + 9;
122 /*XXX need alg check???*/
123 if (sav->tdb_authalgxform != NULL && sav->replay)
124 size += ah_hdrsiz(sav);
125 } else {
126 /*
127 * base header size
128 * + max iv length for CBC mode
129 * + max pad length
130 * + sizeof (pad length field)
131 * + sizeof (next header field)
132 * + max icv supported.
133 */
134 size = sizeof (struct newesp) + EALG_MAX_BLOCK_LEN + 9 + 16;
135 }
136 return size;
137}
138
139/*
140 * esp_init() is called when an SPI is being set up.

Callers 1

ipsec_hdrsiz_internalFunction · 0.85

Calls 1

ah_hdrsizFunction · 0.85

Tested by

no test coverage detected