source: azure_iot_hub/trunk/asp3_dcre/tinet/netinet6/esp.h@ 388

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

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 5.9 KB
Line 
1/*
2 * TINET (TCP/IP Protocol Stack)
3 *
4 * Copyright (C) 2001-2017 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 388 2019-05-22 11:25:18Z 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/*
83 * RFC2406 暗号化ヘッダ
84 */
85
86typedef struct t_esp_hdr {
87 int32_t spi; /* Security Parameter Index (SPI) */
88 int32_t seq; /* シーケンス番号 */
89 } __attribute__((packed, aligned(2)))T_ESP_HDR;
90
91typedef struct t_esp_tail {
92 int8_t padlen; /* パディング長 */
93 int8_t next; /* Next Header */
94 } __attribute__((packed, aligned(2)))T_ESP_TAIL;
95
96struct t_secas_var;
97
98struct t_esp_algorithm {
99 size_t padbound; /* pad boundary, in byte */
100 int_t ivlenval; /* iv length, in byte */
101 int_t (*mature) (struct t_secas_var *);
102 int_t keymin; /* in bits */
103 int_t keymax; /* in bits */
104 //int_t (*schedlen) (const struct t_esp_algorithm *);
105 int32_t (*schedlen) (const struct t_esp_algorithm *);
106 const char *name;
107 int_t (*ivlen) (const struct t_esp_algorithm *, struct t_secas_var *);
108 int_t (*decrypt) (T_NET_BUF *, size_t,
109 struct t_secas_var *, const struct t_esp_algorithm *, int_t,
110 T_NET_BUF *, size_t);
111 int_t (*encrypt) (T_NET_BUF *, size_t, size_t, int8_t*,
112 struct t_secas_var *, const struct t_esp_algorithm *, int_t,
113 T_NET_BUF *, size_t);
114 /* not supposed to be called directly */
115 int_t (*schedule) (const struct t_esp_algorithm *, struct t_secas_var *);
116 int_t (*blockdecrypt) (const struct t_esp_algorithm *,
117 struct t_secas_var *, int8_t *, int8_t *);
118 int_t (*blockencrypt) (const struct t_esp_algorithm *,
119 struct t_secas_var *, int8_t *, int8_t *);
120};
121
122typedef struct t_esp_algorithm T_ESP_ALGORITHM;
123
124#define MAXIVLEN 16
125
126/*
127 * 関数
128 */
129
130extern const struct t_esp_algorithm *esp_algorithm_lookup (int_t);
131extern int_t esp_max_ivlen (void);
132extern int_t esp_schedule (const struct t_esp_algorithm *, struct t_secas_var *);
133extern int_t esp4_input(T_NET_BUF **inputp, uint_t *offp, uint_t *nextp);
134
135#ifdef T_IPSEC_REQUEST_DEFINED
136
137extern int_t esp4_output(T_NET_BUF *m, T_IPSEC_REQUEST *isr, T_NET_BUF** result);
138
139#endif /* of #ifdef T_IPSEC_REQUEST_DEFINED */
140
141#endif /* of #ifndef _ESP_H_ */
Note: See TracBrowser for help on using the repository browser.