aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-04-10 17:24:29 +0000
committerDamjan Marion <dmarion@me.com>2019-04-11 19:42:34 +0000
commit49e7ef60cb38d9f539d70d7a1e85cea5d350a203 (patch)
treedee348f6329d5e5df654256e6eb1a500dc61e52e /src/vnet
parent11a73973c98a5a10b78f7200e5681859354bb29a (diff)
IPSEC: ESP with ESN tests and fixes
Change-Id: Ie42b26e6d5cdb7b23f370ea2933c65079e8d1089 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ipsec/esp_decrypt.c6
-rw-r--r--src/vnet/ipsec/esp_encrypt.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/vnet/ipsec/esp_decrypt.c b/src/vnet/ipsec/esp_decrypt.c
index fc4a99a873d..1386f4c79fc 100644
--- a/src/vnet/ipsec/esp_decrypt.c
+++ b/src/vnet/ipsec/esp_decrypt.c
@@ -177,7 +177,7 @@ esp_decrypt_inline (vlib_main_t * vm,
payload = b[0]->data + pd->current_data;
/* we need 4 extra bytes for HMAC calculation when ESN are used */
- if ((sa0->flags & IPSEC_SA_FLAG_USE_ESN) && pd->icv_sz &&
+ if (ipsec_sa_is_set_USE_ESN (sa0) && pd->icv_sz &&
(pd->current_data + pd->current_length + 4 > buffer_data_size))
{
b[0]->error = node->errors[ESP_DECRYPT_ERROR_NO_TAIL_SPACE];
@@ -211,7 +211,7 @@ esp_decrypt_inline (vlib_main_t * vm,
op->digest = payload + len;
op->digest_len = cpd.icv_sz;
op->len = len;
- if (PREDICT_TRUE (sa0->flags & IPSEC_SA_FLAG_USE_ESN))
+ if (ipsec_sa_is_set_USE_ESN (sa0))
{
/* shift ICV for 4 bytes to insert ESN */
u8 tmp[ESP_MAX_ICV_SIZE], sz = sizeof (sa0->seq_hi);
@@ -219,7 +219,7 @@ esp_decrypt_inline (vlib_main_t * vm,
clib_memcpy_fast (payload + len, &sa0->seq_hi, sz);
clib_memcpy_fast (payload + len + sz, tmp, ESP_MAX_ICV_SIZE);
op->len += sz;
- op->dst += sz;
+ op->digest += sz;
}
}
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index bb1effda68b..fbc5166b946 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -453,7 +453,7 @@ esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (ipsec_sa_is_set_USE_ESN (sa0))
{
u32 seq_hi = clib_net_to_host_u32 (sa0->seq_hi);
- clib_memcpy_fast (op->dst, &seq_hi, sizeof (seq_hi));
+ clib_memcpy_fast (op->digest, &seq_hi, sizeof (seq_hi));
op->len += sizeof (seq_hi);
}
}