From patchwork Fri Sep 5 17:11:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 36875 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A8FF202E4 for ; Fri, 5 Sep 2014 17:12:44 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf11795048pde.10 for ; Fri, 05 Sep 2014 10:12:43 -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=M+JJ0wGb/H/oWixo0EwZZF+nTvvpWk5lx07nPksmn+w=; b=enkBu9jjhONY2TN3ll6/B3crbrArqiloWcTOW3yQSugENI3nNfQnsaFkIZJtfk366h 3AC3UE5LcrQnBNTHbP/tN07QftmO9bya1+4qLmrm55UB55LhiOGB1a6NQkt0T4QejT6Y NctKEMg2amS7kAMmDf1HWlyNTZSxZVath57Pxi+8oEWh/PfVHJnPQExkTuEfsMT88mx9 zPQc/vHQLtTavXIpuTlkDPGBsTHv8mZmi3UBoioBTMBoC0hDv5Q1gZ4owEogiqpJbxRD Y0Rt4UEU6ciw2y9EM3oPxaPLqOe0a5vyHOmqQBno+oijEXijPFxv2jPOdePsG/umY6HX KovQ== X-Gm-Message-State: ALoCoQnzLkd9D3aQntSVz9X37I4fJ9AdnF4UotSzOTnpIB1mlVAXM0H7JtxofA0rCSj8c+QVmP2S X-Received: by 10.66.241.104 with SMTP id wh8mr7554790pac.33.1409937163683; Fri, 05 Sep 2014 10:12:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.6 with SMTP id s6ls822130qgd.22.gmail; Fri, 05 Sep 2014 10:12:43 -0700 (PDT) X-Received: by 10.52.138.210 with SMTP id qs18mr9967335vdb.18.1409937163517; Fri, 05 Sep 2014 10:12:43 -0700 (PDT) Received: from mail-vc0-x235.google.com (mail-vc0-x235.google.com [2607:f8b0:400c:c03::235]) by mx.google.com with ESMTPS id qw8si1170191vcb.89.2014.09.05.10.12.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 10:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::235 as permitted sender) client-ip=2607:f8b0:400c:c03::235; Received: by mail-vc0-f181.google.com with SMTP id le20so1304257vcb.12 for ; Fri, 05 Sep 2014 10:12:43 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr9927716vdb.27.1409937163420; Fri, 05 Sep 2014 10:12:43 -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 uj3csp113560vcb; Fri, 5 Sep 2014 10:12:42 -0700 (PDT) X-Received: by 10.224.125.69 with SMTP id x5mr19969346qar.35.1409937162355; Fri, 05 Sep 2014 10:12:42 -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 g7si2387631qcu.34.2014.09.05.10.12.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 10:12:42 -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 1XPx3w-0002eJ-QA; Fri, 05 Sep 2014 17:12:40 +0000 Received: from alln-iport-2.cisco.com ([173.37.142.89]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPx3R-0002cf-Mg for lng-odp@lists.linaro.org; Fri, 05 Sep 2014 17:12:09 +0000 X-IronPort-AV: E=Sophos;i="5.04,474,1406592000"; d="scan'208";a="75346430" Received: from rcdn-core-9.cisco.com ([173.37.93.145]) by alln-iport-2.cisco.com with ESMTP; 05 Sep 2014 17:12:03 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by rcdn-core-9.cisco.com (8.14.5/8.14.5) with ESMTP id s85HC1FE026220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 5 Sep 2014 17:12:02 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 s85HC1b0001185; Fri, 5 Sep 2014 13:12:01 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s85HC1CL001184; Fri, 5 Sep 2014 13:12:01 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Fri, 5 Sep 2014 13:11:02 -0400 Message-Id: <1409937064-1036-3-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1409937064-1036-1-git-send-email-robking@cisco.com> References: <1409937064-1036-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv6 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::235 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 Reviewed-by: Anders Roxell --- 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 +#include +#include +#include + +#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