From patchwork Tue Aug 19 14:31:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 35603 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A8424201EF for ; Tue, 19 Aug 2014 14:31:48 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf54634192pad.10 for ; Tue, 19 Aug 2014 07:31:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=le79pJjcU5UOMcCJU3CU6rZhsMP3N1QrugXy09v7AZk=; b=JG6gOwb4ULTQch+a6RzOCrgyHaVo5Epb9DppHlpQfhcB+wtpaLmhJD/glIEMJyKvXw nF9rhppx5ehl+jHeKG4AH7WDL9epJLPgHe5uaGLL/WNf72Z/IYcdMm2I5SlqDtK5Hnin DvpXay83HxnnDd6cBD7VWeJwcXxQ4dKT/RVLMktpRMzYTMkR5l0uBmdAgGcZr9WrQ4+h i5T3yFXall9axb/bRyvflWzw6tSpmtOWbfYtPCFqNt3XiYt2mGz0n495CowN5WhYtIve puZqgjKrOspXJ7jNNt2OWtX2R236QadjkmonoCwNb3vbs2SgQnigIPMBpy2FOL5nFdfh oPow== X-Gm-Message-State: ALoCoQn9dHSKfKYm/5VaYi6Ljpn8CCpHK0FDcQWLO04ygo8sJRkjBeUOVUCHD+Idj9mLiWEWP6+6 X-Received: by 10.66.136.71 with SMTP id py7mr19925291pab.35.1408458700655; Tue, 19 Aug 2014 07:31:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.41 with SMTP id 38ls170252qgi.26.gmail; Tue, 19 Aug 2014 07:31:40 -0700 (PDT) X-Received: by 10.52.227.72 with SMTP id ry8mr637307vdc.64.1408458700554; Tue, 19 Aug 2014 07:31:40 -0700 (PDT) Received: from mail-vc0-x231.google.com (mail-vc0-x231.google.com [2607:f8b0:400c:c03::231]) by mx.google.com with ESMTPS id py3si8798793vdb.107.2014.08.19.07.31.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:31:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::231 as permitted sender) client-ip=2607:f8b0:400c:c03::231; Received: by mail-vc0-f177.google.com with SMTP id hy4so7498112vcb.36 for ; Tue, 19 Aug 2014 07:31:40 -0700 (PDT) X-Received: by 10.220.81.132 with SMTP id x4mr2474192vck.0.1408458700473; Tue, 19 Aug 2014 07:31:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp243442vcb; Tue, 19 Aug 2014 07:31:40 -0700 (PDT) X-Received: by 10.140.82.242 with SMTP id h105mr63643675qgd.98.1408458699835; Tue, 19 Aug 2014 07:31:39 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id m89si29202592qge.51.2014.08.19.07.31.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:31:39 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XJkRm-0003l7-LY; Tue, 19 Aug 2014 14:31:38 +0000 Received: from rcdn-iport-4.cisco.com ([173.37.86.75]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XJkRT-0003kD-HV for lng-odp@lists.linaro.org; Tue, 19 Aug 2014 14:31:19 +0000 X-IronPort-AV: E=Sophos;i="5.01,894,1400025600"; d="scan'208";a="348724576" Received: from alln-core-2.cisco.com ([173.36.13.135]) by rcdn-iport-4.cisco.com with ESMTP; 19 Aug 2014 14:31:14 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by alln-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id s7JEVDxU007477 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Aug 2014 14:31:14 GMT Received: from cpp-rtpbld-55.cisco.com (localhost.localdomain [127.0.0.1]) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8) with ESMTP id s7JEVDt8020799; Tue, 19 Aug 2014 10:31:13 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s7JEVDMP020787; Tue, 19 Aug 2014 10:31:13 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Tue, 19 Aug 2014 10:31:12 -0400 Message-Id: <1408458672-20741-3-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1408458672-20741-1-git-send-email-robking@cisco.com> References: <1408458672-20741-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv2 2/2] Add helper include file with IPSec headers X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Original-Sender: robking@cisco.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::231 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=fail header.i=@cisco.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Robbie King --- include/helper/odp_ipsec.h | 73 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 include/helper/odp_ipsec.h diff --git a/include/helper/odp_ipsec.h b/include/helper/odp_ipsec.h new file mode 100644 index 0000000..4cb81a1 --- /dev/null +++ b/include/helper/odp_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 ODP_IPSEC_H_ +#define ODP_IPSEC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#define ODP_ESPHDR_LEN 8 /**< IPSec ESP header length */ +#define ODP_ESPTRL_LEN 2 /**< IPSec ESP trailer length */ +#define ODP_AHHDR_LEN 12 /**< IPSec AH header length */ + +/** + * IPSec ESP header + */ +typedef struct ODP_PACKED { + uint32be_t spi; /**< Security Parameter Index */ + uint32be_t seq_no; /**< Sequence Number */ + uint8_t iv[0]; /**< Initialization vector */ +} odp_esphdr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odp_esphdr_t) == ODP_ESPHDR_LEN, "ODP_ESPHDR_T__SIZE_ERROR"); + +/** + * IPSec ESP trailer + */ +typedef struct ODP_PACKED { + uint8_t pad_len; /**< Padding length (0-255) */ + uint8_t next_header; /**< Next header protocol */ + uint8_t icv[0]; /**< Integrity Check Value (optional) */ +} odp_esptrl_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odp_esptrl_t) == ODP_ESPTRL_LEN, "ODP_ESPTRL_T__SIZE_ERROR"); + +/** + * IPSec AH header + */ +typedef struct ODP_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 */ +} odp_ahhdr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odp_ahhdr_t) == ODP_AHHDR_LEN, "ODP_AHHDR_T__SIZE_ERROR"); + +#ifdef __cplusplus +} +#endif + +#endif