{
u32 sa_index;
u32 spi;
- u32 seq_lo;
- u32 seq_hi;
+ u64 seq;
ipsec_integ_alg_t integ_alg;
} ah_encrypt_trace_t;
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
ah_encrypt_trace_t *t = va_arg (*args, ah_encrypt_trace_t *);
- s = format (s, "ah: sa-index %d spi %u (0x%08x) seq %u:%u integrity %U",
- t->sa_index, t->spi, t->spi, t->seq_hi, t->seq_lo,
- format_ipsec_integ_alg, t->integ_alg);
+ s = format (s, "ah: sa-index %d spi %u (0x%08x) seq %lu integrity %U",
+ t->sa_index, t->spi, t->spi, t->seq, format_ipsec_integ_alg,
+ t->integ_alg);
return s;
}
oh6_0->ah.reserved = 0;
oh6_0->ah.nexthdr = next_hdr_type;
oh6_0->ah.spi = ort->spi_be;
- oh6_0->ah.seq_no = clib_net_to_host_u32 (ort->seq);
+ oh6_0->ah.seq_no = clib_net_to_host_u32 (ort->seq64);
oh6_0->ip6.payload_length =
clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b[0]) -
sizeof (ip6_header_t));
oh0->ip4.length =
clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b[0]));
oh0->ah.spi = ort->spi_be;
- oh0->ah.seq_no = clib_net_to_host_u32 (ort->seq);
+ oh0->ah.seq_no = clib_net_to_host_u32 (ort->seq64);
oh0->ah.nexthdr = next_hdr_type;
oh0->ah.hdrlen =
(sizeof (ah_header_t) + icv_size + padding_len) / 4 - 2;
op->user_data = b - bufs;
if (ort->use_esn)
{
- u32 seq_hi = clib_host_to_net_u32 (ort->seq_hi);
-
- op->len += sizeof (seq_hi);
- clib_memcpy (op->src + b[0]->current_length, &seq_hi,
- sizeof (seq_hi));
+ *(u32u *) (op->src + b[0]->current_length) =
+ clib_host_to_net_u32 (ort->seq64 >> 32);
+ op->len += sizeof (u32);
}
}
ah_encrypt_trace_t *tr =
vlib_add_trace (vm, node, b[0], sizeof (*tr));
tr->spi = sa->spi;
- tr->seq_lo = ort->seq;
- tr->seq_hi = ort->seq_hi;
+ tr->seq = ort->seq64;
tr->integ_alg = sa->integ_alg;
tr->sa_index = pd->sa_index;
}
{
u32 sa_index;
u32 spi;
- u32 seq;
- u32 sa_seq_hi;
+ u64 seq;
u8 udp_encap;
ipsec_crypto_alg_t crypto_alg;
ipsec_integ_alg_t integ_alg;
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
esp_encrypt_trace_t *t = va_arg (*args, esp_encrypt_trace_t *);
- s =
- format (s,
- "esp: sa-index %d spi %u (0x%08x) seq %u sa-seq-hi %u crypto %U integrity %U%s",
- t->sa_index, t->spi, t->spi, t->seq, t->sa_seq_hi,
- format_ipsec_crypto_alg,
- t->crypto_alg, format_ipsec_integ_alg, t->integ_alg,
- t->udp_encap ? " udp-encap-enabled" : "");
+ s = format (
+ s, "esp: sa-index %d spi %u (0x%08x) seq %lu crypto %U integrity %U%s",
+ t->sa_index, t->spi, t->spi, t->seq, format_ipsec_crypto_alg,
+ t->crypto_alg, format_ipsec_integ_alg, t->integ_alg,
+ t->udp_encap ? " udp-encap-enabled" : "");
return s;
}
total_len += ch->len = cb->current_length - icv_sz;
if (ort->use_esn)
{
- u32 seq_hi = clib_net_to_host_u32 (ort->seq_hi);
- clib_memcpy_fast (digest, &seq_hi, sizeof (seq_hi));
- ch->len += sizeof (seq_hi);
- total_len += sizeof (seq_hi);
+ *(u32u *) digest = clib_net_to_host_u32 (ort->seq64 >> 32);
+ ch->len += sizeof (u32);
+ total_len += sizeof (u32);
}
}
else
{
/* constuct aad in a scratch space in front of the nonce */
aad = (u8 *) nonce - sizeof (esp_aead_t);
- esp_aad_fill (aad, esp, ort->use_esn, ort->seq_hi);
+ esp_aad_fill (aad, esp, ort->use_esn, ort->seq64 >> 32);
if (PREDICT_FALSE (ort->is_null_gmac))
{
/* RFC-4543 ENCR_NULL_AUTH_AES_GMAC: IV is part of AAD */
}
else if (ort->use_esn)
{
- u32 seq_hi = clib_net_to_host_u32 (ort->seq_hi);
- clib_memcpy_fast (tag, &seq_hi, sizeof (seq_hi));
- integ_total_len += sizeof (seq_hi);
+ *(u32u *) tag = clib_net_to_host_u32 (ort->seq64 >> 32);
+ integ_total_len += sizeof (u32);
}
}
}
esp->spi = spi;
- esp->seq = clib_net_to_host_u32 (ort->seq);
+ esp->seq = clib_net_to_host_u32 (ort->seq64);
if (is_async)
{
async_next_node, lb);
}
else
- esp_prepare_sync_op (vm, ptd, crypto_ops, integ_ops, ort, ort->seq_hi,
- payload, payload_len, iv_sz, icv_sz, n_sync, b,
- lb, hdr_len, esp);
+ esp_prepare_sync_op (vm, ptd, crypto_ops, integ_ops, ort,
+ ort->seq64 >> 32, payload, payload_len, iv_sz,
+ icv_sz, n_sync, b, lb, hdr_len, esp);
vlib_buffer_advance (b[0], 0LL - hdr_len);
ipsec_sa_t *sa = ipsec_sa_get (sa_index0);
tr->sa_index = sa_index0;
tr->spi = sa->spi;
- tr->seq = ort->seq;
- tr->sa_seq_hi = ort->seq_hi;
+ tr->seq = ort->seq64;
tr->udp_encap = ort->udp_encap;
tr->crypto_alg = sa->crypto_alg;
tr->integ_alg = sa->integ_alg;