removed old FreeS/WAN cvs revision entries
[strongswan.git] / src / libfreeswan / ipsec_xform.h
1 /*
2 * Definitions relevant to IPSEC transformations
3 * Copyright (C) 1996, 1997 John Ioannidis.
4 * Copyright (C) 1998, 1999, 2000, 2001 Richard Guy Briggs.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * RCSID $Id: ipsec_xform.h,v 1.3 2004/09/29 22:26:13 as Exp $
17 */
18
19 #ifndef _IPSEC_XFORM_H_
20
21 #include <freeswan.h>
22 #include "ipsec_policy.h"
23
24 #define XF_NONE 0 /* No transform set */
25 #define XF_IP4 1 /* IPv4 inside IPv4 */
26 #define XF_AHMD5 2 /* AH MD5 */
27 #define XF_AHSHA 3 /* AH SHA */
28 #define XF_ESP3DES 5 /* ESP DES3-CBC */
29 #define XF_AHHMACMD5 6 /* AH-HMAC-MD5 with opt replay prot */
30 #define XF_AHHMACSHA1 7 /* AH-HMAC-SHA1 with opt replay prot */
31 #define XF_ESP3DESMD5 9 /* triple DES, HMAC-MD-5, 128-bits of authentication */
32 #define XF_ESP3DESMD596 10 /* triple DES, HMAC-MD-5, 96-bits of authentication */
33 #define XF_ESPNULLMD596 12 /* NULL, HMAC-MD-5 with 96-bits of authentication */
34 #define XF_ESPNULLSHA196 13 /* NULL, HMAC-SHA-1 with 96-bits of authentication */
35 #define XF_ESP3DESSHA196 14 /* triple DES, HMAC-SHA-1, 96-bits of authentication */
36 #define XF_IP6 15 /* IPv6 inside IPv6 */
37 #define XF_COMPDEFLATE 16 /* IPCOMP deflate */
38
39 #define XF_CLR 126 /* Clear SA table */
40 #define XF_DEL 127 /* Delete SA */
41
42 #define XFT_AUTH 0x0001
43 #define XFT_CONF 0x0100
44
45 /* available if CONFIG_IPSEC_DEBUG is defined */
46 #define DB_XF_INIT 0x0001
47
48 #define PROTO2TXT(x) \
49 (x) == IPPROTO_AH ? "AH" : \
50 (x) == IPPROTO_ESP ? "ESP" : \
51 (x) == IPPROTO_IPIP ? "IPIP" : \
52 (x) == IPPROTO_COMP ? "COMP" : \
53 "UNKNOWN_proto"
54 static inline const char *enc_name_id (unsigned id) {
55 static char buf[16];
56 snprintf(buf, sizeof(buf), "_ID%d", id);
57 return buf;
58 }
59 static inline const char *auth_name_id (unsigned id) {
60 static char buf[16];
61 snprintf(buf, sizeof(buf), "_ID%d", id);
62 return buf;
63 }
64 #define IPS_XFORM_NAME(x) \
65 PROTO2TXT((x)->ips_said.proto), \
66 (x)->ips_said.proto == IPPROTO_COMP ? \
67 ((x)->ips_encalg == SADB_X_CALG_DEFLATE ? \
68 "_DEFLATE" : "_UNKNOWN_comp") : \
69 (x)->ips_encalg == ESP_NONE ? "" : \
70 (x)->ips_encalg == ESP_3DES ? "_3DES" : \
71 (x)->ips_encalg == ESP_AES ? "_AES" : \
72 (x)->ips_encalg == ESP_SERPENT ? "_SERPENT" : \
73 (x)->ips_encalg == ESP_TWOFISH ? "_TWOFISH" : \
74 enc_name_id(x->ips_encalg)/* "_UNKNOWN_encr" */, \
75 (x)->ips_authalg == AH_NONE ? "" : \
76 (x)->ips_authalg == AH_MD5 ? "_HMAC_MD5" : \
77 (x)->ips_authalg == AH_SHA ? "_HMAC_SHA1" : \
78 (x)->ips_authalg == AH_SHA2_256 ? "_HMAC_SHA2_256" : \
79 (x)->ips_authalg == AH_SHA2_384 ? "_HMAC_SHA2_384" : \
80 (x)->ips_authalg == AH_SHA2_512 ? "_HMAC_SHA2_512" : \
81 auth_name_id(x->ips_authalg) /* "_UNKNOWN_auth" */ \
82
83 #define _IPSEC_XFORM_H_
84 #endif /* _IPSEC_XFORM_H_ */