Message ID | 1409937064-1036-3-git-send-email-robking@cisco.com |
---|---|
State | Superseded |
Headers | show |
On 2014-09-05 13:11, Robbie King wrote: > Signed-off-by: Robbie King <robking@cisco.com> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> > --- > helper/include/odph_ipsec.h | 73 +++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 73 insertions(+), 0 deletions(-) > create mode 100644 helper/include/odph_ipsec.h > > 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 > -- > 1.7.7.6 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
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
Signed-off-by: Robbie King <robking@cisco.com> --- helper/include/odph_ipsec.h | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 helper/include/odph_ipsec.h