Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netipsec/xform_esp.c
Show First 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | |||||
* ESP input callback from the crypto driver. | * ESP input callback from the crypto driver. | ||||
*/ | */ | ||||
static int | static int | ||||
esp_input_cb(struct cryptop *crp) | esp_input_cb(struct cryptop *crp) | ||||
{ | { | ||||
IPSEC_DEBUG_DECLARE(char buf[128]); | IPSEC_DEBUG_DECLARE(char buf[128]); | ||||
u_int8_t lastthree[3], aalg[AH_HMAC_MAXHASHLEN]; | u_int8_t lastthree[3], aalg[AH_HMAC_MAXHASHLEN]; | ||||
const struct auth_hash *esph; | const struct auth_hash *esph; | ||||
const struct enc_xform *espx; | |||||
struct mbuf *m; | struct mbuf *m; | ||||
struct cryptodesc *crd; | struct cryptodesc *crd; | ||||
struct xform_data *xd; | struct xform_data *xd; | ||||
struct secasvar *sav; | struct secasvar *sav; | ||||
struct secasindex *saidx; | struct secasindex *saidx; | ||||
caddr_t ptr; | caddr_t ptr; | ||||
uint64_t cryptoid; | uint64_t cryptoid; | ||||
int hlen, skip, protoff, error, alen; | int hlen, skip, protoff, error, alen; | ||||
crd = crp->crp_desc; | crd = crp->crp_desc; | ||||
IPSEC_ASSERT(crd != NULL, ("null crypto descriptor!")); | IPSEC_ASSERT(crd != NULL, ("null crypto descriptor!")); | ||||
m = (struct mbuf *) crp->crp_buf; | m = (struct mbuf *) crp->crp_buf; | ||||
xd = (struct xform_data *) crp->crp_opaque; | xd = (struct xform_data *) crp->crp_opaque; | ||||
sav = xd->sav; | sav = xd->sav; | ||||
skip = xd->skip; | skip = xd->skip; | ||||
protoff = xd->protoff; | protoff = xd->protoff; | ||||
cryptoid = xd->cryptoid; | cryptoid = xd->cryptoid; | ||||
saidx = &sav->sah->saidx; | saidx = &sav->sah->saidx; | ||||
esph = sav->tdb_authalgxform; | esph = sav->tdb_authalgxform; | ||||
espx = sav->tdb_encalgxform; | |||||
/* Check for crypto errors */ | /* Check for crypto errors */ | ||||
if (crp->crp_etype) { | if (crp->crp_etype) { | ||||
if (crp->crp_etype == EAGAIN) { | if (crp->crp_etype == EAGAIN) { | ||||
/* Reset the session ID */ | /* Reset the session ID */ | ||||
if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) | if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) | ||||
crypto_freesession(cryptoid); | crypto_freesession(cryptoid); | ||||
xd->cryptoid = crp->crp_sid; | xd->cryptoid = crp->crp_sid; | ||||
▲ Show 20 Lines • Show All 493 Lines • Show Last 20 Lines |