removed old FreeS/WAN cvs revision entries
[strongswan.git] / src / libfreeswan / ipsec_esp.h
1 /*
2 * Copyright (C) 1996, 1997 John Ioannidis.
3 * Copyright (C) 1998, 1999, 2000, 2001 Richard Guy Briggs.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * RCSID $Id: ipsec_esp.h,v 1.2 2004/03/22 21:53:18 as Exp $
16 */
17
18 #include "freeswan/ipsec_md5h.h"
19 #include "freeswan/ipsec_sha1.h"
20
21 #include "crypto/des.h"
22
23 #ifndef IPPROTO_ESP
24 #define IPPROTO_ESP 50
25 #endif /* IPPROTO_ESP */
26
27 #define ESP_HEADER_LEN 8 /* 64 bits header (spi+rpl)*/
28
29 #define EMT_ESPDESCBC_ULEN 20 /* coming from user mode */
30 #define EMT_ESPDES_KMAX 64 /* 512 bit secret key enough? */
31 #define EMT_ESPDES_KEY_SZ 8 /* 56 bit secret key with parity = 64 bits */
32 #define EMT_ESP3DES_KEY_SZ 24 /* 168 bit secret key with parity = 192 bits */
33 #define EMT_ESPDES_IV_SZ 8 /* IV size */
34 #define ESP_DESCBC_BLKLEN 8 /* DES-CBC block size */
35
36 #define ESP_IV_MAXSZ 16 /* This is _critical_ */
37 #define ESP_IV_MAXSZ_INT (ESP_IV_MAXSZ/sizeof(int))
38
39 #define DB_ES_PKTRX 0x0001
40 #define DB_ES_PKTRX2 0x0002
41 #define DB_ES_IPSA 0x0010
42 #define DB_ES_XF 0x0020
43 #define DB_ES_IPAD 0x0040
44 #define DB_ES_INAU 0x0080
45 #define DB_ES_OINFO 0x0100
46 #define DB_ES_OINFO2 0x0200
47 #define DB_ES_OH 0x0400
48 #define DB_ES_REPLAY 0x0800
49
50 #ifdef __KERNEL__
51 struct des_eks {
52 des_key_schedule ks;
53 };
54
55 extern struct inet_protocol esp_protocol;
56
57 struct options;
58
59 extern int
60 esp_rcv(struct sk_buff *skb,
61 struct device *dev,
62 struct options *opt,
63 __u32 daddr,
64 unsigned short len,
65 __u32 saddr,
66 int redo,
67 struct inet_protocol *protocol);
68
69 /* Only for 64 bits IVs, eg. ESP_3DES :P */
70 struct esphdr
71 {
72 __u32 esp_spi; /* Security Parameters Index */
73 __u32 esp_rpl; /* Replay counter */
74 __u8 esp_iv[8]; /* iv */
75 };
76
77 #ifdef CONFIG_IPSEC_DEBUG
78 extern int debug_esp;
79 #endif /* CONFIG_IPSEC_DEBUG */
80 #endif /* __KERNEL__ */