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