summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ah_encrypt.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-06-24 22:49:55 +0200
committerKlement Sekera <ksekera@cisco.com>2018-06-24 22:53:37 +0200
commit31da2e30317bc1fcb4586e1dc0d560600d9b29d3 (patch)
tree4c025f26e8aa9e4f6499144deea9028154b63fe0 /src/vnet/ipsec/ah_encrypt.c
parent2a8d02df15e71881754bab0bb16b85ccd65f8f74 (diff)
Revert "Revert "ipsec: VPP-1316 calculate IP/TCP/UDP inner checksums""
This reverts commit e0d2bd6bd7fc59c0c6ac48195d7f825dc99bfd91. Change-Id: If491e16f9ea66b2493a6a7c7f3c684ed585f8f51 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/ah_encrypt.c')
-rw-r--r--src/vnet/ipsec/ah_encrypt.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/vnet/ipsec/ah_encrypt.c b/src/vnet/ipsec/ah_encrypt.c
index 6619d872013..898c0f27547 100644
--- a/src/vnet/ipsec/ah_encrypt.c
+++ b/src/vnet/ipsec/ah_encrypt.c
@@ -263,19 +263,17 @@ ah_encrypt_node_fn (vlib_main_t * vm,
u8 sig[64];
memset (sig, 0, sizeof (sig));
- u8 *digest = NULL;
- {
- digest = vlib_buffer_get_current (i_b0) + ip_hdr_size + icv_size;
- memset (digest, 0, icv_size);
- }
+ u8 *digest =
+ vlib_buffer_get_current (i_b0) + ip_hdr_size + icv_size;
+ memset (digest, 0, icv_size);
- hmac_calc (sa0->integ_alg, sa0->integ_key,
- sa0->integ_key_len,
- (u8 *) vlib_buffer_get_current (i_b0),
- i_b0->current_length, sig, sa0->use_esn, sa0->seq_hi);
-
- memcpy (digest, (char *) &sig[0], 12);
+ unsigned size = hmac_calc (sa0->integ_alg, sa0->integ_key,
+ sa0->integ_key_len,
+ vlib_buffer_get_current (i_b0),
+ i_b0->current_length, sig, sa0->use_esn,
+ sa0->seq_hi);
+ memcpy (digest, sig, size);
if (PREDICT_FALSE (is_ipv6))
{
}
@@ -287,7 +285,7 @@ ah_encrypt_node_fn (vlib_main_t * vm,
}
if (transport_mode)
- vlib_buffer_advance (i_b0, -sizeof (ethernet_header_t));;
+ vlib_buffer_advance (i_b0, -sizeof (ethernet_header_t));
trace:
if (PREDICT_FALSE (i_b0->flags & VLIB_BUFFER_IS_TRACED))