Changeset View
Changeset View
Standalone View
Standalone View
sys/netipsec/xform_ah.c
Show First 20 Lines • Show All 659 Lines • ▼ Show 20 Lines | ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) | ||||
crp->crp_flags = CRYPTO_F_CBIFSYNC; | crp->crp_flags = CRYPTO_F_CBIFSYNC; | ||||
if (V_async_crypto) | if (V_async_crypto) | ||||
crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; | crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; | ||||
crp->crp_mbuf = m; | crp->crp_mbuf = m; | ||||
crp->crp_buf_type = CRYPTO_BUF_MBUF; | crp->crp_buf_type = CRYPTO_BUF_MBUF; | ||||
crp->crp_callback = ah_input_cb; | crp->crp_callback = ah_input_cb; | ||||
crp->crp_opaque = xd; | crp->crp_opaque = xd; | ||||
if (sav->flags & SADB_X_SAFLAGS_ESN && | |||||
sav->replay != NULL && sav->replay->wsize != 0) { | |||||
seqh = htonl(seqh); | |||||
memcpy(crp->crp_esn, &seqh, 4); | |||||
gnn: Please change the magic number (4) to either a #define or sizeof(seqh) | |||||
crp->crp_flags |= CRYPTO_F_ESN; | |||||
} | |||||
/* These are passed as-is to the callback. */ | /* These are passed as-is to the callback. */ | ||||
xd->sav = sav; | xd->sav = sav; | ||||
xd->nxt = hl; | xd->nxt = hl; | ||||
xd->protoff = protoff; | xd->protoff = protoff; | ||||
xd->skip = skip; | xd->skip = skip; | ||||
xd->cryptoid = cryptoid; | xd->cryptoid = cryptoid; | ||||
xd->vnet = curvnet; | xd->vnet = curvnet; | ||||
return (crypto_dispatch(crp)); | return (crypto_dispatch(crp)); | ||||
▲ Show 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | ah_output(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, | ||||
struct xform_data *xd; | struct xform_data *xd; | ||||
struct mbuf *mi; | struct mbuf *mi; | ||||
struct cryptop *crp; | struct cryptop *crp; | ||||
struct newah *ah; | struct newah *ah; | ||||
crypto_session_t cryptoid; | crypto_session_t cryptoid; | ||||
uint16_t iplen; | uint16_t iplen; | ||||
int error, rplen, authsize, ahsize, maxpacketsize, roff; | int error, rplen, authsize, ahsize, maxpacketsize, roff; | ||||
uint8_t prot; | uint8_t prot; | ||||
uint32_t seqh; | |||||
IPSEC_ASSERT(sav != NULL, ("null SA")); | IPSEC_ASSERT(sav != NULL, ("null SA")); | ||||
ahx = sav->tdb_authalgxform; | ahx = sav->tdb_authalgxform; | ||||
IPSEC_ASSERT(ahx != NULL, ("null authentication xform")); | IPSEC_ASSERT(ahx != NULL, ("null authentication xform")); | ||||
AHSTAT_INC(ahs_output); | AHSTAT_INC(ahs_output); | ||||
/* Figure out header size. */ | /* Figure out header size. */ | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | #endif /* INET6 */ | ||||
crp->crp_op = CRYPTO_OP_COMPUTE_DIGEST; | crp->crp_op = CRYPTO_OP_COMPUTE_DIGEST; | ||||
crp->crp_flags = CRYPTO_F_CBIFSYNC; | crp->crp_flags = CRYPTO_F_CBIFSYNC; | ||||
if (V_async_crypto) | if (V_async_crypto) | ||||
crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; | crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; | ||||
crp->crp_mbuf = m; | crp->crp_mbuf = m; | ||||
crp->crp_buf_type = CRYPTO_BUF_MBUF; | crp->crp_buf_type = CRYPTO_BUF_MBUF; | ||||
crp->crp_callback = ah_output_cb; | crp->crp_callback = ah_output_cb; | ||||
crp->crp_opaque = xd; | crp->crp_opaque = xd; | ||||
if (sav->flags & SADB_X_SAFLAGS_ESN && sav->replay != NULL) { | |||||
seqh = htonl((uint32_t)(sav->replay->count >> 32)); | |||||
memcpy(crp->crp_esn, &seqh, 4); | |||||
Done Inline ActionsSame as previous memcpy gnn: Same as previous memcpy | |||||
crp->crp_flags |= CRYPTO_F_ESN; | |||||
} | |||||
/* These are passed as-is to the callback. */ | /* These are passed as-is to the callback. */ | ||||
xd->sp = sp; | xd->sp = sp; | ||||
xd->sav = sav; | xd->sav = sav; | ||||
xd->skip = skip; | xd->skip = skip; | ||||
xd->idx = idx; | xd->idx = idx; | ||||
xd->cryptoid = cryptoid; | xd->cryptoid = cryptoid; | ||||
xd->vnet = curvnet; | xd->vnet = curvnet; | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |
Please change the magic number (4) to either a #define or sizeof(seqh)