Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netipsec/xform_ah.c
Show First 20 Lines • Show All 679 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* AH input callback from the crypto driver. | * AH input callback from the crypto driver. | ||||
*/ | */ | ||||
static int | static int | ||||
ah_input_cb(struct cryptop *crp) | ah_input_cb(struct cryptop *crp) | ||||
{ | { | ||||
IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]); | IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]); | ||||
unsigned char calc[AH_ALEN_MAX]; | unsigned char calc[AH_ALEN_MAX]; | ||||
const struct auth_hash *ahx; | |||||
struct mbuf *m; | struct mbuf *m; | ||||
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 authsize, rplen, error, skip, protoff; | int authsize, rplen, error, skip, protoff; | ||||
uint8_t nxt; | uint8_t nxt; | ||||
crd = crp->crp_desc; | |||||
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; | ||||
nxt = xd->nxt; | nxt = xd->nxt; | ||||
protoff = xd->protoff; | protoff = xd->protoff; | ||||
cryptoid = xd->cryptoid; | cryptoid = xd->cryptoid; | ||||
saidx = &sav->sah->saidx; | saidx = &sav->sah->saidx; | ||||
IPSEC_ASSERT(saidx->dst.sa.sa_family == AF_INET || | IPSEC_ASSERT(saidx->dst.sa.sa_family == AF_INET || | ||||
saidx->dst.sa.sa_family == AF_INET6, | saidx->dst.sa.sa_family == AF_INET6, | ||||
("unexpected protocol family %u", saidx->dst.sa.sa_family)); | ("unexpected protocol family %u", saidx->dst.sa.sa_family)); | ||||
ahx = sav->tdb_authalgxform; | |||||
/* 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 434 Lines • Show Last 20 Lines |