aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorRobbie King <robking@cisco.com>2014-09-09 09:49:51 -0400
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-09-10 13:34:06 +0400
commit130a94f6a16a77e47e85b3af7399c4cbfc65d4dc (patch)
tree3ad39f4d7954173c373620b2cb97b63daa4e6c18 /helper
parent96f72fd96ce8d18a5f2894a8b7b094e435d65401 (diff)
Add helper include file with IPSec headers
Signed-off-by: Robbie King <robking@cisco.com> Tested-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-and Tested-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> Reviewed-by: Bala Manoharan <bala.manoharan@linaro.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'helper')
-rw-r--r--helper/include/odph_ipsec.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/helper/include/odph_ipsec.h b/helper/include/odph_ipsec.h
new file mode 100644
index 0000000..f547b90
--- /dev/null
+++ b/helper/include/odph_ipsec.h
@@ -0,0 +1,73 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP IPSec headers
+ */
+
+#ifndef ODPH_IPSEC_H_
+#define ODPH_IPSEC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_std_types.h>
+#include <odp_byteorder.h>
+#include <odp_align.h>
+#include <odp_debug.h>
+
+#define ODPH_ESPHDR_LEN 8 /**< IPSec ESP header length */
+#define ODPH_ESPTRL_LEN 2 /**< IPSec ESP trailer length */
+#define ODPH_AHHDR_LEN 12 /**< IPSec AH header length */
+
+/**
+ * IPSec ESP header
+ */
+typedef struct ODPH_PACKED {
+ uint32be_t spi; /**< Security Parameter Index */
+ uint32be_t seq_no; /**< Sequence Number */
+ uint8_t iv[0]; /**< Initialization vector */
+} odph_esphdr_t;
+
+/** @internal Compile time assert */
+ODP_STATIC_ASSERT(sizeof(odph_esphdr_t) == ODPH_ESPHDR_LEN, "ODPH_ESPHDR_T__SIZE_ERROR");
+
+/**
+ * IPSec ESP trailer
+ */
+typedef struct ODPH_PACKED {
+ uint8_t pad_len; /**< Padding length (0-255) */
+ uint8_t next_header; /**< Next header protocol */
+ uint8_t icv[0]; /**< Integrity Check Value (optional) */
+} odph_esptrl_t;
+
+/** @internal Compile time assert */
+ODP_STATIC_ASSERT(sizeof(odph_esptrl_t) == ODPH_ESPTRL_LEN, "ODPH_ESPTRL_T__SIZE_ERROR");
+
+/**
+ * IPSec AH header
+ */
+typedef struct ODPH_PACKED {
+ uint8_t next_header; /**< Next header protocol */
+ uint8_t ah_len; /**< AH header length */
+ uint16be_t pad; /**< Padding (must be 0) */
+ uint32be_t spi; /**< Security Parameter Index */
+ uint32be_t seq_no; /**< Sequence Number */
+ uint8_t icv[0]; /**< Integrity Check Value */
+} odph_ahhdr_t;
+
+/** @internal Compile time assert */
+ODP_STATIC_ASSERT(sizeof(odph_ahhdr_t) == ODPH_AHHDR_LEN, "ODPH_AHHDR_T__SIZE_ERROR");
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif