flow: add vnet/flow formal API
[vpp.git] / src / vnet / ipsec / esp_encrypt.c
index e9feb8b..8b722ef 100644 (file)
@@ -118,7 +118,7 @@ esp_add_footer_and_icv (vlib_main_t * vm, vlib_buffer_t ** last,
 {
   static const u8 pad_data[ESP_MAX_BLOCK_SIZE] = {
     0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
-    0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x00, 0x00,
+    0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00,
   };
 
   u16 min_length = total_len + sizeof (esp_footer_t);
@@ -695,18 +695,10 @@ esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
 
       if (n_bufs > 1)
        {
-         crypto_ops = &ptd->chained_crypto_ops;
-         integ_ops = &ptd->chained_integ_ops;
-
          /* find last buffer in the chain */
          while (lb->flags & VLIB_BUFFER_NEXT_PRESENT)
            lb = vlib_get_buffer (vm, lb->next_buffer);
        }
-      else
-       {
-         crypto_ops = &ptd->crypto_ops;
-         integ_ops = &ptd->integ_ops;
-       }
 
       if (PREDICT_FALSE (esp_seq_advance (sa0)))
        {
@@ -879,6 +871,17 @@ esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          next[0] = ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT;
        }
 
+      if (lb != b[0])
+       {
+         crypto_ops = &ptd->chained_crypto_ops;
+         integ_ops = &ptd->chained_integ_ops;
+       }
+      else
+       {
+         crypto_ops = &ptd->crypto_ops;
+         integ_ops = &ptd->integ_ops;
+       }
+
       esp->spi = spi;
       esp->seq = clib_net_to_host_u32 (sa0->seq);