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