1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/netinet/ip_esp.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
//####BSDCOPYRIGHTBEGIN####
|
9 |
|
|
//
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
//
|
12 |
|
|
// Portions of this software may have been derived from OpenBSD or other sources,
|
13 |
|
|
// and are covered by the appropriate copyright disclaimers included herein.
|
14 |
|
|
//
|
15 |
|
|
// -------------------------------------------
|
16 |
|
|
//
|
17 |
|
|
//####BSDCOPYRIGHTEND####
|
18 |
|
|
//==========================================================================
|
19 |
|
|
//#####DESCRIPTIONBEGIN####
|
20 |
|
|
//
|
21 |
|
|
// Author(s): gthomas
|
22 |
|
|
// Contributors: gthomas
|
23 |
|
|
// Date: 2000-01-10
|
24 |
|
|
// Purpose:
|
25 |
|
|
// Description:
|
26 |
|
|
//
|
27 |
|
|
//
|
28 |
|
|
//####DESCRIPTIONEND####
|
29 |
|
|
//
|
30 |
|
|
//==========================================================================
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
/* $OpenBSD: ip_esp.h,v 1.26 1999/12/09 00:33:29 angelos Exp $ */
|
34 |
|
|
|
35 |
|
|
/*
|
36 |
|
|
* The authors of this code are John Ioannidis (ji@tla.org),
|
37 |
|
|
* Angelos D. Keromytis (kermit@csd.uch.gr) and
|
38 |
|
|
* Niels Provos (provos@physnet.uni-hamburg.de).
|
39 |
|
|
*
|
40 |
|
|
* This code was written by John Ioannidis for BSD/OS in Athens, Greece,
|
41 |
|
|
* in November 1995.
|
42 |
|
|
*
|
43 |
|
|
* Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
|
44 |
|
|
* by Angelos D. Keromytis.
|
45 |
|
|
*
|
46 |
|
|
* Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
|
47 |
|
|
* and Niels Provos.
|
48 |
|
|
*
|
49 |
|
|
* Additional features in 1999 by Angelos D. Keromytis.
|
50 |
|
|
*
|
51 |
|
|
* Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
|
52 |
|
|
* Angelos D. Keromytis and Niels Provos.
|
53 |
|
|
*
|
54 |
|
|
* Permission to use, copy, and modify this software without fee
|
55 |
|
|
* is hereby granted, provided that this entire notice is included in
|
56 |
|
|
* all copies of any software which is or includes a copy or
|
57 |
|
|
* modification of this software.
|
58 |
|
|
* You may use this code under the GNU public license if you so wish. Please
|
59 |
|
|
* contribute changes back to the authors under this freer than GPL license
|
60 |
|
|
* so that we may further the use of strong encryption without limitations to
|
61 |
|
|
* all.
|
62 |
|
|
*
|
63 |
|
|
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
|
64 |
|
|
* IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
|
65 |
|
|
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
|
66 |
|
|
* MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
|
67 |
|
|
* PURPOSE.
|
68 |
|
|
*/
|
69 |
|
|
|
70 |
|
|
#ifndef _NETINET_IP_ESP_H_
|
71 |
|
|
#define _NETINET_IP_ESP_H_
|
72 |
|
|
|
73 |
|
|
/*
|
74 |
|
|
* Encapsulation Security Payload Processing
|
75 |
|
|
* Per RFC1827 (Atkinson, 1995)
|
76 |
|
|
*/
|
77 |
|
|
|
78 |
|
|
/* Various defines for the "new" ESP */
|
79 |
|
|
#define ESP_NEW_ALEN 12 /* 96bits authenticator */
|
80 |
|
|
|
81 |
|
|
struct esp_old
|
82 |
|
|
{
|
83 |
|
|
u_int32_t esp_spi; /* Security Parameters Index */
|
84 |
|
|
u_int8_t esp_iv[8]; /* iv[4] may actually be data! */
|
85 |
|
|
};
|
86 |
|
|
|
87 |
|
|
#define ESP_OLD_FLENGTH 12
|
88 |
|
|
#define ESP_NEW_FLENGTH 16
|
89 |
|
|
|
90 |
|
|
struct esp_new
|
91 |
|
|
{
|
92 |
|
|
u_int32_t esp_spi; /* Security Parameter Index */
|
93 |
|
|
u_int32_t esp_rpl; /* Sequence Number, Replay Counter */
|
94 |
|
|
u_int8_t esp_iv[8]; /* Data may start already at iv[0]! */
|
95 |
|
|
};
|
96 |
|
|
|
97 |
|
|
struct espstat
|
98 |
|
|
{
|
99 |
|
|
u_int32_t esps_hdrops; /* packet shorter than header shows */
|
100 |
|
|
u_int32_t esps_notdb;
|
101 |
|
|
u_int32_t esps_badkcr;
|
102 |
|
|
u_int32_t esps_qfull;
|
103 |
|
|
u_int32_t esps_noxform;
|
104 |
|
|
u_int32_t esps_badilen;
|
105 |
|
|
u_int32_t esps_wrap; /* Replay counter wrapped around */
|
106 |
|
|
u_int32_t esps_badenc; /* Bad encryption detected */
|
107 |
|
|
u_int32_t esps_badauth; /* Only valid for transforms with auth */
|
108 |
|
|
u_int32_t esps_replay; /* Possible packet replay detected */
|
109 |
|
|
u_int32_t esps_input; /* Input ESP packets */
|
110 |
|
|
u_int32_t esps_output; /* Output ESP packets */
|
111 |
|
|
u_int32_t esps_invalid; /* Trying to use an invalid TDB */
|
112 |
|
|
u_int64_t esps_ibytes; /* input bytes */
|
113 |
|
|
u_int64_t esps_obytes; /* output bytes */
|
114 |
|
|
u_int32_t esps_toobig; /* packet got larger than IP_MAXPACKET */
|
115 |
|
|
u_int32_t esps_pdrops; /* packet blocked due to policy */
|
116 |
|
|
};
|
117 |
|
|
|
118 |
|
|
/*
|
119 |
|
|
* Names for ESP sysctl objects
|
120 |
|
|
*/
|
121 |
|
|
#define ESPCTL_ENABLE 1 /* Enable ESP processing */
|
122 |
|
|
#define ESPCTL_MAXID 2
|
123 |
|
|
|
124 |
|
|
#define ESPCTL_NAMES { \
|
125 |
|
|
{ 0, 0 }, \
|
126 |
|
|
{ "enable", CTLTYPE_INT }, \
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
#ifdef _KERNEL
|
130 |
|
|
void esp_input __P((struct mbuf *, ...));
|
131 |
|
|
int esp_output __P((struct mbuf *, struct tdb *, struct mbuf **));
|
132 |
|
|
int esp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
|
133 |
|
|
|
134 |
|
|
#ifdef INET6
|
135 |
|
|
void esp6_input __P((struct mbuf *, ...));
|
136 |
|
|
#endif /* INET6 */
|
137 |
|
|
|
138 |
|
|
extern int esp_enable;
|
139 |
|
|
struct espstat espstat;
|
140 |
|
|
#endif /* _Kernel */
|
141 |
|
|
|
142 |
|
|
#endif // _NETINET_IP_ESP_H_
|