1 //==========================================================================
3 // include/netinet6/ah.h
5 //==========================================================================
6 //####BSDCOPYRIGHTBEGIN####
8 // -------------------------------------------
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.
14 // Portions created by Red Hat are
15 // Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
17 // -------------------------------------------
19 //####BSDCOPYRIGHTEND####
21 /* $KAME: ah.h,v 1.16 2001/09/04 08:43:19 itojun Exp $ */
24 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
25 * All rights reserved.
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
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.
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
53 * RFC1826/2402 authentication header.
56 #ifndef _NETINET6_AH_H_
57 #define _NETINET6_AH_H_
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 */
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 */
79 struct ah_algorithm_state {
81 void* foo; /* per algorithm data - maybe */
85 int (*sumsiz) __P((struct secasvar *));
86 int (*mature) __P((struct secasvar *));
87 int keymin; /* in bits */
88 int keymax; /* in bits */
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));
95 #define AH_MAXSUMSIZE 16
97 extern const struct ah_algorithm *ah_algorithm_lookup __P((int));
100 extern int ah_hdrlen __P((struct secasvar *));
102 extern size_t ah_hdrsiz __P((struct ipsecrequest *));
103 #if (defined(__FreeBSD__) && __FreeBSD__ >= 4)
104 extern void ah4_input __P((struct mbuf *, int));
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 *));
112 #if defined(__NetBSD__) && __NetBSD_Version__ >= 105080000 /* 1.5H */
113 extern void *ah4_ctlinput __P((int, struct sockaddr *, void *));
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 *));
123 extern void ah6_ctlinput __P((int, struct sockaddr *, void *));
128 #endif /* _NETINET6_AH_H_ */