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

Function ipcomp_init

freebsd/netipsec/xform_ipcomp.c:156–179  ·  view source on GitHub ↗

* ipcomp_init() is called when an CPI is being set up. */

Source from the content-addressed store, hash-verified

154 * ipcomp_init() is called when an CPI is being set up.
155 */
156static int
157ipcomp_init(struct secasvar *sav, struct xformsw *xsp)
158{
159 const struct comp_algo *tcomp;
160 struct crypto_session_params csp;
161
162 /* NB: algorithm really comes in alg_enc and not alg_comp! */
163 tcomp = comp_algorithm_lookup(sav->alg_enc);
164 if (tcomp == NULL) {
165 DPRINTF(("%s: unsupported compression algorithm %d\n", __func__,
166 sav->alg_comp));
167 return EINVAL;
168 }
169 sav->alg_comp = sav->alg_enc; /* set for doing histogram */
170 sav->tdb_xform = xsp;
171 sav->tdb_compalgxform = tcomp;
172
173 /* Initialize crypto session */
174 memset(&csp, 0, sizeof(csp));
175 csp.csp_mode = CSP_MODE_COMPRESS;
176 csp.csp_cipher_alg = sav->tdb_compalgxform->type;
177
178 return crypto_newsession(&sav->tdb_cryptoid, &csp, V_crypto_support);
179}
180
181/*
182 * ipcomp_cleanup() used when IPCA is deleted

Callers

nothing calls this directly

Calls 3

comp_algorithm_lookupFunction · 0.85
memsetFunction · 0.85
crypto_newsessionFunction · 0.85

Tested by

no test coverage detected