• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*	$NetBSD: pfkeyv2.h,v 1.4 2006/09/09 16:22:08 manu Exp $	*/
2 
3 #ifndef __NET_PFKEYV2_H_
4 #define __NET_PFKEYV2_H_ 1
5 
6 #include <stdint.h>
7 #include <linux/pfkeyv2.h>
8 
9 /* Private allocations for authentication algorithms */
10 #define SADB_AALG_SHA2_256		SADB_X_AALG_SHA2_256HMAC
11 #define SADB_X_AALG_SHA2_256		SADB_X_AALG_SHA2_256HMAC
12 #define SADB_AALG_SHA2_384		SADB_X_AALG_SHA2_384HMAC
13 #define SADB_X_AALG_SHA2_384		SADB_X_AALG_SHA2_384HMAC
14 #define SADB_AALG_SHA2_512		SADB_X_AALG_SHA2_512HMAC
15 #define SADB_X_AALG_SHA2_512		SADB_X_AALG_SHA2_512HMAC
16 #define SADB_AALG_RIPEMD160HMAC		SADB_X_AALG_RIPEMD160HMAC
17 #define SADB_X_AALG_MD5              249
18 #define SADB_X_AALG_SHA              250
19 
20 /* private allocations - based on RFC2407/IANA assignment */
21 #define SADB_X_EALG_CAST128CBC	5	/* SADB_X_EALG_CASTCBC? == 6 */
22 #define SADB_X_EALG_RIJNDAELCBC		SADB_X_EALG_AESCBC
23 #define SADB_X_EALG_AES			SADB_X_EALG_AESCBC
24 
25 
26 #define SADB_X_CALG_NONE	0
27 #define SADB_X_CALG_OUI		1
28 #define SADB_X_CALG_DEFLATE	2
29 #define SADB_X_CALG_LZS		3
30 #define SADB_X_CALG_MAX		4
31 
32 
33 #define SADB_X_EXT_NONE		0x0000	/* i.e. new format. */
34 #define SADB_X_EXT_OLD		0x0001	/* old format. */
35 
36 #define SADB_X_EXT_IV4B		0x0010	/* IV length of 4 bytes in use */
37 #define SADB_X_EXT_DERIV	0x0020	/* DES derived */
38 #define SADB_X_EXT_CYCSEQ	0x0040	/* allowing to cyclic sequence. */
39 
40 	/* three of followings are exclusive flags each them */
41 #define SADB_X_EXT_PSEQ		0x0000	/* sequencial padding for ESP */
42 #define SADB_X_EXT_PRAND	0x0100	/* random padding for ESP */
43 #define SADB_X_EXT_PZERO	0x0200	/* zero padding for ESP */
44 #define SADB_X_EXT_PMASK	0x0300	/* mask for padding flag */
45 
46 #define SADB_X_EXT_RAWCPI	0x0080	/* use well known CPI (IPComp) */
47 
48 
49 #define PFKEY_SOFT_LIFETIME_RATE	80
50 
51 #define SADB_X_LIFETIME_ALLOCATIONS	0
52 #define SADB_X_LIFETIME_BYTES		1
53 #define SADB_X_LIFETIME_ADDTIME		2
54 #define SADB_X_LIFETIME_USETIME		3
55 
56 
57 #define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))
58 #define	PFKEY_EXTLEN(msg) \
59 	PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len)
60 #define PFKEY_ADDR_PREFIX(ext) \
61 	(((struct sadb_address *)(ext))->sadb_address_prefixlen)
62 #define PFKEY_ADDR_PROTO(ext) \
63 	(((struct sadb_address *)(ext))->sadb_address_proto)
64 #define PFKEY_ADDR_SADDR(ext) \
65 	((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address)))
66 
67 /* in 64bits */
68 #define	PFKEY_UNUNIT64(a)	((a) << 3)
69 #define	PFKEY_UNIT64(a)		((a) >> 3)
70 
71 #endif
72