1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/netinet6/ah.h
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
// ####BSDCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
9 |
|
|
//
|
10 |
|
|
// Portions of this software may have been derived from FreeBSD
|
11 |
|
|
// or other sources, and if so are covered by the appropriate copyright
|
12 |
|
|
// and license included herein.
|
13 |
|
|
//
|
14 |
|
|
// Portions created by the Free Software Foundation are
|
15 |
|
|
// Copyright (C) 2002 Free Software Foundation, Inc.
|
16 |
|
|
// -------------------------------------------
|
17 |
|
|
// ####BSDCOPYRIGHTEND####
|
18 |
|
|
|
19 |
|
|
/* $KAME: ah.h,v 1.16 2001/09/04 08:43:19 itojun Exp $ */
|
20 |
|
|
|
21 |
|
|
/*
|
22 |
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
23 |
|
|
* All rights reserved.
|
24 |
|
|
*
|
25 |
|
|
* Redistribution and use in source and binary forms, with or without
|
26 |
|
|
* modification, are permitted provided that the following conditions
|
27 |
|
|
* are met:
|
28 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
29 |
|
|
* notice, this list of conditions and the following disclaimer.
|
30 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
31 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
32 |
|
|
* documentation and/or other materials provided with the distribution.
|
33 |
|
|
* 3. Neither the name of the project nor the names of its contributors
|
34 |
|
|
* may be used to endorse or promote products derived from this software
|
35 |
|
|
* without specific prior written permission.
|
36 |
|
|
*
|
37 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
38 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
39 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
40 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
41 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
42 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
43 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
44 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
45 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
46 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
47 |
|
|
* SUCH DAMAGE.
|
48 |
|
|
*/
|
49 |
|
|
|
50 |
|
|
/*
|
51 |
|
|
* RFC1826/2402 authentication header.
|
52 |
|
|
*/
|
53 |
|
|
|
54 |
|
|
#ifndef _NETINET6_AH_H_
|
55 |
|
|
#define _NETINET6_AH_H_
|
56 |
|
|
|
57 |
|
|
struct ah {
|
58 |
|
|
u_int8_t ah_nxt; /* Next Header */
|
59 |
|
|
u_int8_t ah_len; /* Length of data, in 32bit */
|
60 |
|
|
u_int16_t ah_reserve; /* Reserved for future use */
|
61 |
|
|
u_int32_t ah_spi; /* Security parameter index */
|
62 |
|
|
/* variable size, 32bit bound*/ /* Authentication data */
|
63 |
|
|
};
|
64 |
|
|
|
65 |
|
|
struct newah {
|
66 |
|
|
u_int8_t ah_nxt; /* Next Header */
|
67 |
|
|
u_int8_t ah_len; /* Length of data + 1, in 32bit */
|
68 |
|
|
u_int16_t ah_reserve; /* Reserved for future use */
|
69 |
|
|
u_int32_t ah_spi; /* Security parameter index */
|
70 |
|
|
u_int32_t ah_seq; /* Sequence number field */
|
71 |
|
|
/* variable size, 32bit bound*/ /* Authentication data */
|
72 |
|
|
};
|
73 |
|
|
|
74 |
|
|
#ifdef _KERNEL
|
75 |
|
|
struct secasvar;
|
76 |
|
|
|
77 |
|
|
struct ah_algorithm_state {
|
78 |
|
|
struct secasvar *sav;
|
79 |
|
|
void* foo; /* per algorithm data - maybe */
|
80 |
|
|
};
|
81 |
|
|
|
82 |
|
|
struct ah_algorithm {
|
83 |
|
|
int (*sumsiz) __P((struct secasvar *));
|
84 |
|
|
int (*mature) __P((struct secasvar *));
|
85 |
|
|
int keymin; /* in bits */
|
86 |
|
|
int keymax; /* in bits */
|
87 |
|
|
const char *name;
|
88 |
|
|
int (*init) __P((struct ah_algorithm_state *, struct secasvar *));
|
89 |
|
|
void (*update) __P((struct ah_algorithm_state *, caddr_t, size_t));
|
90 |
|
|
void (*result) __P((struct ah_algorithm_state *, caddr_t));
|
91 |
|
|
};
|
92 |
|
|
|
93 |
|
|
#define AH_MAXSUMSIZE 16
|
94 |
|
|
|
95 |
|
|
extern const struct ah_algorithm *ah_algorithm_lookup __P((int));
|
96 |
|
|
|
97 |
|
|
/* cksum routines */
|
98 |
|
|
extern int ah_hdrlen __P((struct secasvar *));
|
99 |
|
|
|
100 |
|
|
extern size_t ah_hdrsiz __P((struct ipsecrequest *));
|
101 |
|
|
#if (defined(__FreeBSD__) && __FreeBSD__ >= 4)
|
102 |
|
|
extern void ah4_input __P((struct mbuf *, int));
|
103 |
|
|
#else
|
104 |
|
|
extern void ah4_input __P((struct mbuf *, ...));
|
105 |
|
|
#endif /* (defined(__FreeBSD__) && __FreeBSD__ >= 4) */
|
106 |
|
|
extern int ah4_output __P((struct mbuf *, struct ipsecrequest *));
|
107 |
|
|
extern int ah4_calccksum __P((struct mbuf *, caddr_t, size_t,
|
108 |
|
|
const struct ah_algorithm *, struct secasvar *));
|
109 |
|
|
|
110 |
|
|
#if defined(__NetBSD__) && __NetBSD_Version__ >= 105080000 /* 1.5H */
|
111 |
|
|
extern void *ah4_ctlinput __P((int, struct sockaddr *, void *));
|
112 |
|
|
#endif
|
113 |
|
|
|
114 |
|
|
#ifdef INET6
|
115 |
|
|
extern int ah6_input __P((struct mbuf **, int *, int));
|
116 |
|
|
extern int ah6_output __P((struct mbuf *, u_char *, struct mbuf *,
|
117 |
|
|
struct ipsecrequest *));
|
118 |
|
|
extern int ah6_calccksum __P((struct mbuf *, caddr_t, size_t,
|
119 |
|
|
const struct ah_algorithm *, struct secasvar *));
|
120 |
|
|
|
121 |
|
|
extern void ah6_ctlinput __P((int, struct sockaddr *, void *));
|
122 |
|
|
#endif /* INET6 */
|
123 |
|
|
|
124 |
|
|
#endif /* _KERNEL */
|
125 |
|
|
|
126 |
|
|
#endif /* _NETINET6_AH_H_ */
|