source: EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/esp.h@ 270

Last change on this file since 270 was 270, checked in by coas-nagasima, 7 years ago

mruby版ECNLプロトタイピング・ツールを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 6.0 KB
Line 
1/*
2 * TINET (TCP/IP Protocol Stack)
3 *
4 * Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
5 * Tomakomai National College of Technology, JAPAN
6 * Copyright (C) 2008-2009 by Hokkaido Industrial Research Institute, JAPAN
7 *
8 * 上記著作権者
9は,以下の (1)~(4) の条件か,Free Software Foundation
10 * によってå…
11¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
12 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
13 * を改変したものを含む.以下同じ)を使用・複製・改変・再é…
14å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
15 * 利用と呼ぶ)することを無償で許諾する.
16 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
17 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
18 * スコード中に含まれていること.
19 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
20 * 用できる形で再é…
21å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
22å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
23 * 者
24マニュアルなど)に,上記の著作権表示,この利用条件および下記
25 * の無保証規定を掲載すること.
26 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
27 * 用できない形で再é…
28å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®æ¡ä»¶ã‚’満たすこと.
29 * (a) 再é…
30å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
31マニュアルなど)に,上記の著
32 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
33 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
34 * 害からも,上記著作権者
35およびTOPPERSプロジェクトをå…
36è²¬ã™ã‚‹ã“と.
37 *
38 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
39お
40 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
41 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
42 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
43 *
44 * @(#) $Id: esp.h 270 2017-02-09 04:03:47Z coas-nagasima $
45 */
46
47/* $FreeBSD: src/sys/netinet6/esp.h,v 1.6 2002/04/19 04:46:22 suz Exp $ */
48/* $KAME: esp.h,v 1.19 2001/09/04 08:43:19 itojun Exp $ */
49
50/*
51 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
52 * All rights reserved.
53 *
54 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions
56 * are met:
57 * 1. Redistributions of source code must retain the above copyright
58 * notice, this list of conditions and the following disclaimer.
59 * 2. Redistributions in binary form must reproduce the above copyright
60 * notice, this list of conditions and the following disclaimer in the
61 * documentation and/or other materials provided with the distribution.
62 * 3. Neither the name of the project nor the names of its contributors
63 * may be used to endorse or promote products derived from this software
64 * without specific prior written permission.
65 *
66 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
67 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
68 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
69 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
70 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
71 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
72 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
73 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
74 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
75 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
76 * SUCH DAMAGE.
77 */
78
79#ifndef _ESP_H_
80#define _ESP_H_
81
82#if defined(SUPPORT_INET6) || defined(SUPPORT_IPSEC)
83
84/*
85 * RFC2406 暗号化ヘッダ
86 */
87
88typedef struct t_esp_hdr {
89 int32_t spi; /* Security Parameter Index (SPI) */
90 int32_t seq; /* シーケンス番号 */
91 } __attribute__((packed, aligned(2)))T_ESP_HDR;
92
93typedef struct t_esp_tail {
94 int8_t padlen; /* パディング長 */
95 int8_t next; /* Next Header */
96 } __attribute__((packed, aligned(2)))T_ESP_TAIL;
97
98struct t_secas_var;
99
100struct t_esp_algorithm {
101 size_t padbound; /* pad boundary, in byte */
102 int_t ivlenval; /* iv length, in byte */
103 int_t (*mature) (struct t_secas_var *);
104 int_t keymin; /* in bits */
105 int_t keymax; /* in bits */
106 //int_t (*schedlen) (const struct t_esp_algorithm *);
107 int32_t (*schedlen) (const struct t_esp_algorithm *);
108 const char *name;
109 int_t (*ivlen) (const struct t_esp_algorithm *, struct t_secas_var *);
110 int_t (*decrypt) (T_NET_BUF *, size_t,
111 struct t_secas_var *, const struct t_esp_algorithm *, int_t,
112 T_NET_BUF *, size_t);
113 int_t (*encrypt) (T_NET_BUF *, size_t, size_t, int8_t*,
114 struct t_secas_var *, const struct t_esp_algorithm *, int_t,
115 T_NET_BUF *, size_t);
116 /* not supposed to be called directly */
117 int_t (*schedule) (const struct t_esp_algorithm *, struct t_secas_var *);
118 int_t (*blockdecrypt) (const struct t_esp_algorithm *,
119 struct t_secas_var *, int8_t *, int8_t *);
120 int_t (*blockencrypt) (const struct t_esp_algorithm *,
121 struct t_secas_var *, int8_t *, int8_t *);
122};
123
124typedef struct t_esp_algorithm T_ESP_ALGORITHM;
125
126#define MAXIVLEN 16
127
128/*
129 * 関数
130 */
131
132extern const struct t_esp_algorithm *esp_algorithm_lookup (int_t);
133extern int_t esp_max_ivlen (void);
134extern int_t esp_schedule (const struct t_esp_algorithm *, struct t_secas_var *);
135extern int_t esp4_input(T_NET_BUF **inputp, uint_t *offp, uint_t *nextp);
136
137#ifdef T_IPSEC_REQUEST_DEFINED
138
139extern int_t esp4_output(T_NET_BUF *m, T_IPSEC_REQUEST *isr, T_NET_BUF** result);
140
141#endif /* of #ifdef T_IPSEC_REQUEST_DEFINED */
142
143#endif /* defined(SUPPORT_INET6) || defined(SUPPORT_IPSEC) */
144
145#endif /* of #ifndef _ESP_H_ */
Note: See TracBrowser for help on using the repository browser.