From patchwork Thu Aug 21 19:10:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 35782 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 10F5A20540 for ; Thu, 21 Aug 2014 19:10:30 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id v1sf32118938yhn.4 for ; Thu, 21 Aug 2014 12:10:29 -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=M7moR7FxBEqY22Ol/OuKkbtuS+Y2wtRPO7p+mcF1y+43dJqmxjZOnDuM3Ts4fHRY0k MLCIvh8yWdghdL3T5hOMceKSe/gnRd/dGr2LAtsp45q4kZzU0F7EucqC9D/xW2J2fg22 ts0L/GX+vGV5QXr0BN+efnDn3RjAmXmnAK2qTOd/Nw+v1qMMmYAFQYiBtE3s9jKWLKZ4 xD01cR3UlXOSq3HjpykYOzpd5uvz8Jcf0Pt1l3OxqBxCzSN+2z2X4j4E/k5xVCtY1msa yZTSIDI6yyVO3e3AeQuTWyENjn1rY8zdxsoOARyuMOB/ntpRFKkP9nVBXVP4ZoEY77mr dG+g== X-Gm-Message-State: ALoCoQmdHquhDNo3Oz4ctsSNwtydXZuR09nF8q+k7W2YaTOZ+9vwMa1A4PrkQ4pKj/YcWIk+CINf X-Received: by 10.236.65.131 with SMTP id f3mr420677yhd.8.1408648229858; Thu, 21 Aug 2014 12:10:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.6 with SMTP id t6ls831918qge.32.gmail; Thu, 21 Aug 2014 12:10:29 -0700 (PDT) X-Received: by 10.52.27.16 with SMTP id p16mr368830vdg.14.1408648229769; Thu, 21 Aug 2014 12:10:29 -0700 (PDT) Received: from mail-vc0-x22f.google.com (mail-vc0-x22f.google.com [2607:f8b0:400c:c03::22f]) by mx.google.com with ESMTPS id s2si12693547vco.17.2014.08.21.12.10.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Aug 2014 12:10:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22f as permitted sender) client-ip=2607:f8b0:400c:c03::22f; Received: by mail-vc0-f175.google.com with SMTP id ik5so11311219vcb.34 for ; Thu, 21 Aug 2014 12:10:29 -0700 (PDT) X-Received: by 10.220.49.10 with SMTP id t10mr389427vcf.34.1408648229666; Thu, 21 Aug 2014 12:10:29 -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.45.67 with SMTP id uj3csp160323vcb; Thu, 21 Aug 2014 12:10:29 -0700 (PDT) X-Received: by 10.140.51.166 with SMTP id u35mr930972qga.68.1408648228855; Thu, 21 Aug 2014 12:10:28 -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 k90si39715576qgf.75.2014.08.21.12.10.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 21 Aug 2014 12:10:28 -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 1XKXkh-00010q-Rk; Thu, 21 Aug 2014 19:10:27 +0000 Received: from rcdn-iport-2.cisco.com ([173.37.86.73]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XKXka-0000zP-NS for lng-odp@lists.linaro.org; Thu, 21 Aug 2014 19:10:20 +0000 X-IronPort-AV: E=Sophos;i="5.04,374,1406592000"; d="scan'208";a="349289228" Received: from alln-core-7.cisco.com ([173.36.13.140]) by rcdn-iport-2.cisco.com with ESMTP; 21 Aug 2014 19:10:15 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by alln-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id s7LJAFQx009638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Aug 2014 19:10:15 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 s7LJAEJl017278; Thu, 21 Aug 2014 15:10:14 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s7LJAEfE017262; Thu, 21 Aug 2014 15:10:14 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Thu, 21 Aug 2014 15:10:09 -0400 Message-Id: <1408648211-9995-3-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1408648211-9995-1-git-send-email-robking@cisco.com> References: <1408648211-9995-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv2 2/4] 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::22f 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