Changeset View
Changeset View
Standalone View
Standalone View
netipsec/xform_esp.c
Show First 20 Lines • Show All 756 Lines • ▼ Show 20 Lines | if (mo == NULL) { | ||||
goto bad; | goto bad; | ||||
} | } | ||||
/* Initialize ESP header. */ | /* Initialize ESP header. */ | ||||
bcopy((caddr_t) &sav->spi, mtod(mo, caddr_t) + roff, sizeof(u_int32_t)); | bcopy((caddr_t) &sav->spi, mtod(mo, caddr_t) + roff, sizeof(u_int32_t)); | ||||
if (sav->replay) { | if (sav->replay) { | ||||
u_int32_t replay; | u_int32_t replay; | ||||
SECASVAR_LOCK(sav); | |||||
#ifdef REGRESSION | #ifdef REGRESSION | ||||
/* Emulate replay attack when ipsec_replay is TRUE. */ | /* Emulate replay attack when ipsec_replay is TRUE. */ | ||||
if (!V_ipsec_replay) | if (!V_ipsec_replay) | ||||
#endif | #endif | ||||
sav->replay->count++; | sav->replay->count++; | ||||
replay = htonl(sav->replay->count); | replay = htonl(sav->replay->count); | ||||
SECASVAR_UNLOCK(sav); | |||||
bcopy((caddr_t) &replay, | bcopy((caddr_t) &replay, | ||||
mtod(mo, caddr_t) + roff + sizeof(u_int32_t), | mtod(mo, caddr_t) + roff + sizeof(u_int32_t), | ||||
sizeof(u_int32_t)); | sizeof(u_int32_t)); | ||||
} | } | ||||
/* | /* | ||||
* Add padding -- better to do it ourselves than use the crypto engine, | * Add padding -- better to do it ourselves than use the crypto engine, | ||||
* although if/when we support compression, we'd have to do that. | * although if/when we support compression, we'd have to do that. | ||||
▲ Show 20 Lines • Show All 242 Lines • Show Last 20 Lines |