ip_ipsp.h revision 1.84
1/* $OpenBSD: ip_ipsp.h,v 1.84 2001/05/01 18:31:35 fgsch Exp $ */ 2 3/* 4 * The authors of this code are John Ioannidis (ji@tla.org), 5 * Angelos D. Keromytis (kermit@csd.uch.gr), 6 * Niels Provos (provos@physnet.uni-hamburg.de) and 7 * Niklas Hallqvist (niklas@appli.se). 8 * 9 * The original version of this code was written by John Ioannidis 10 * for BSD/OS in Athens, Greece, in November 1995. 11 * 12 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, 13 * by Angelos D. Keromytis. 14 * 15 * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis 16 * and Niels Provos. 17 * 18 * Additional features in 1999 by Angelos D. Keromytis and Niklas Hallqvist. 19 * 20 * Copyright (c) 1995, 1996, 1997, 1998, 1999 by John Ioannidis, 21 * Angelos D. Keromytis and Niels Provos. 22 * Copyright (c) 1999 Niklas Hallqvist. 23 * 24 * Permission to use, copy, and modify this software without fee 25 * is hereby granted, provided that this entire notice is included in 26 * all copies of any software which is or includes a copy or 27 * modification of this software. 28 * You may use this code under the GNU public license if you so wish. Please 29 * contribute changes back to the authors under this freer than GPL license 30 * so that we may further the use of strong encryption without limitations to 31 * all. 32 * 33 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 34 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 35 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 36 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 37 * PURPOSE. 38 */ 39 40#ifndef _NETINET_IPSP_H_ 41#define _NETINET_IPSP_H_ 42 43/* 44 * IPSP global definitions. 45 */ 46 47#include <sys/types.h> 48#include <sys/queue.h> 49#include <sys/timeout.h> 50#include <netinet/in.h> 51 52union sockaddr_union 53{ 54 struct sockaddr sa; 55 struct sockaddr_in sin; 56 struct sockaddr_in6 sin6; 57}; 58 59/* HMAC key sizes */ 60#define MD5HMAC96_KEYSIZE 16 61#define SHA1HMAC96_KEYSIZE 20 62#define RIPEMD160HMAC96_KEYSIZE 20 63 64#define AH_HMAC_HASHLEN 12 /* 96 bits of authenticator */ 65#define AH_HMAC_RPLENGTH 4 /* 32 bits of replay counter */ 66#define AH_HMAC_INITIAL_RPL 1 /* Replay counter initial value */ 67 68/* Authenticator lengths */ 69#define AH_MD5_ALEN 16 70#define AH_SHA1_ALEN 20 71#define AH_RMD160_ALEN 20 72#define AH_ALEN_MAX 20 /* Keep updated */ 73 74/* Reserved SPI numbers */ 75#define SPI_LOCAL_USE 0 76#define SPI_RESERVED_MIN 1 77#define SPI_RESERVED_MAX 255 78 79/* sysctl default values */ 80#define IPSEC_DEFAULT_EMBRYONIC_SA_TIMEOUT 60 /* 1 minute */ 81#define IPSEC_DEFAULT_PFS 1 82#define IPSEC_DEFAULT_SOFT_ALLOCATIONS 0 83#define IPSEC_DEFAULT_EXP_ALLOCATIONS 0 84#define IPSEC_DEFAULT_SOFT_BYTES 0 85#define IPSEC_DEFAULT_EXP_BYTES 0 86#define IPSEC_DEFAULT_SOFT_TIMEOUT 80000 87#define IPSEC_DEFAULT_EXP_TIMEOUT 86400 88#define IPSEC_DEFAULT_SOFT_FIRST_USE 3600 89#define IPSEC_DEFAULT_EXP_FIRST_USE 7200 90#define IPSEC_DEFAULT_DEF_ENC "aes" 91#define IPSEC_DEFAULT_DEF_AUTH "hmac-sha1" 92#define IPSEC_DEFAULT_EXPIRE_ACQUIRE 30 93 94struct sockaddr_encap 95{ 96 u_int8_t sen_len; /* length */ 97 u_int8_t sen_family; /* PF_KEY */ 98 u_int16_t sen_type; /* see SENT_* */ 99 union 100 { 101 struct /* SENT_IP4 */ 102 { 103 u_int8_t Direction; 104 struct in_addr Src; 105 struct in_addr Dst; 106 u_int8_t Proto; 107 u_int16_t Sport; 108 u_int16_t Dport; 109 } Sip4; 110 111 struct /* SENT_IP6 */ 112 { 113 u_int8_t Direction; 114 struct in6_addr Src; 115 struct in6_addr Dst; 116 u_int8_t Proto; 117 u_int16_t Sport; 118 u_int16_t Dport; 119 } Sip6; 120 121 struct ipsec_policy *PolicyHead; /* SENT_IPSP */ 122 } Sen; 123}; 124 125#define IPSP_DIRECTION_IN 0x1 126#define IPSP_DIRECTION_OUT 0x2 127 128#define sen_data Sen.Data 129#define sen_ip_src Sen.Sip4.Src 130#define sen_ip_dst Sen.Sip4.Dst 131#define sen_proto Sen.Sip4.Proto 132#define sen_sport Sen.Sip4.Sport 133#define sen_dport Sen.Sip4.Dport 134#define sen_direction Sen.Sip4.Direction 135#define sen_ip6_src Sen.Sip6.Src 136#define sen_ip6_dst Sen.Sip6.Dst 137#define sen_ip6_proto Sen.Sip6.Proto 138#define sen_ip6_sport Sen.Sip6.Sport 139#define sen_ip6_dport Sen.Sip6.Dport 140#define sen_ip6_direction Sen.Sip6.Direction 141#define sen_ipsp Sen.PolicyHead 142 143/* 144 * The "type" is really part of the address as far as the routing 145 * system is concerned. By using only one bit in the type field 146 * for each type, we sort-of make sure that different types of 147 * encapsulation addresses won't be matched against the wrong type. 148 * 149 */ 150 151#define SENT_IP4 0x0001 /* data is two struct in_addr */ 152#define SENT_IPSP 0x0002 /* data as in IP4/6 plus SPI */ 153#define SENT_IP6 0x0004 154 155#define SENT_LEN sizeof(struct sockaddr_encap) 156 157struct ipsec_acquire 158{ 159 union sockaddr_union ipa_addr; 160 u_int64_t ipa_expire; 161 u_int32_t ipa_seq; 162 struct sockaddr_encap ipa_info; 163 struct sockaddr_encap ipa_mask; 164 struct mbuf *ipa_packet; 165 TAILQ_ENTRY(ipsec_acquire) ipa_next; 166}; 167 168struct ipsec_policy 169{ 170 struct sockaddr_encap ipo_addr; 171 struct sockaddr_encap ipo_mask; 172 173 union sockaddr_union ipo_src; /* Local address to use */ 174 union sockaddr_union ipo_dst; /* Remote gateway -- if it's zeroed: 175 * - on output, we try to contact the 176 * remote host directly (if needed). 177 * - on input, we accept on if the 178 * inner source is the same as the 179 * outer source address, or if transport 180 * mode was used. 181 */ 182 183 u_int64_t ipo_last_searched; /* Timestamp of last lookup */ 184 185 u_int8_t ipo_flags; /* See IPSP_POLICY_* definitions */ 186 u_int8_t ipo_type; /* USE/ACQUIRE/... */ 187 u_int8_t ipo_sproto;/* ESP, AH; if zero we use system dflts */ 188 189 struct tdb *ipo_tdb; /* Cached entry */ 190 191 u_int16_t ipo_srcid_len; 192 u_int16_t ipo_dstid_len; 193 u_int16_t ipo_srcid_type; 194 u_int16_t ipo_dstid_type; 195 196 u_int8_t *ipo_srcid; 197 u_int8_t *ipo_dstid; 198 199 TAILQ_ENTRY(ipsec_policy) ipo_tdb_next; /* List of policies on TDB */ 200 TAILQ_ENTRY(ipsec_policy) ipo_list; /* List of all policy entries */ 201}; 202 203#define IPSP_POLICY_NONE 0x0000 /* No flags set */ 204 205#define IPSP_IPSEC_USE 0 /* Use if existing, don't bother establishing */ 206#define IPSP_IPSEC_ACQUIRE 1 /* Try to acquire in parallel but let packet */ 207#define IPSP_IPSEC_REQUIRE 2 /* Require SA */ 208#define IPSP_PERMIT 3 /* Permit traffic through */ 209#define IPSP_DENY 4 /* Deny traffic */ 210#define IPSP_IPSEC_DONTACQ 5 /* Require, but don't acquire */ 211 212/* Notification types */ 213#define NOTIFY_SOFT_EXPIRE 0 /* Soft expiration of SA */ 214#define NOTIFY_HARD_EXPIRE 1 /* Hard expiration of SA */ 215#define NOTIFY_REQUEST_SA 2 /* Establish an SA */ 216 217#define NOTIFY_SATYPE_CONF 1 /* SA should do encryption */ 218#define NOTIFY_SATYPE_AUTH 2 /* SA should do authentication */ 219#define NOTIFY_SATYPE_TUNNEL 4 /* SA should use tunneling */ 220 221/* 222 * For encapsulation routes are possible not only for the destination 223 * address but also for the protocol, source and destination ports 224 * if available 225 */ 226 227struct route_enc { 228 struct rtentry *re_rt; 229 struct sockaddr_encap re_dst; 230}; 231 232struct tdb /* tunnel descriptor block */ 233{ 234 /* 235 * Each TDB is on three hash tables: one keyed on dst/spi/sproto, 236 * one keyed on dst/sproto, and one keyed on src/sproto. The first 237 * is used for finding a specific TDB, the second for finding TDBs 238 * TDBs for outgoing policy matching, and the third for incoming 239 * policy matching. The following three fields maintain the hash 240 * queues in those three tables. 241 */ 242 struct tdb *tdb_hnext; /* dst/spi/sproto table */ 243 struct tdb *tdb_anext; /* dst/sproto table */ 244 struct tdb *tdb_snext; /* src/sproto table */ 245 struct tdb *tdb_inext; 246 struct tdb *tdb_onext; 247 248 struct xformsw *tdb_xform; /* Transformation to use */ 249 struct enc_xform *tdb_encalgxform; /* Encryption algorithm xform */ 250 struct auth_hash *tdb_authalgxform; /* Authentication algorithm xform */ 251 252#define TDBF_UNIQUE 0x00001 /* This should not be used by others */ 253#define TDBF_TIMER 0x00002 /* Absolute expiration timer in use */ 254#define TDBF_BYTES 0x00004 /* Check the byte counters */ 255#define TDBF_ALLOCATIONS 0x00008 /* Check the flows counters */ 256#define TDBF_INVALID 0x00010 /* This SPI is not valid yet/anymore */ 257#define TDBF_FIRSTUSE 0x00020 /* Expire after first use */ 258#define TDBF_HALFIV 0x00040 /* Use half-length IV (ESP old only) */ 259#define TDBF_SOFT_TIMER 0x00080 /* Soft expiration */ 260#define TDBF_SOFT_BYTES 0x00100 /* Soft expiration */ 261#define TDBF_SOFT_ALLOCATIONS 0x00200 /* Soft expiration */ 262#define TDBF_SOFT_FIRSTUSE 0x00400 /* Soft expiration */ 263#define TDBF_PFS 0x00800 /* Ask for PFS from Key Mgmt. */ 264#define TDBF_TUNNELING 0x01000 /* Force IP-IP encapsulation */ 265#define TDBF_NOREPLAY 0x02000 /* No replay counter present */ 266#define TDBF_RANDOMPADDING 0x04000 /* Random data in the ESP padding */ 267 268 u_int32_t tdb_flags; /* Flags related to this TDB */ 269 270 struct timeout tdb_timer_tmo; 271 struct timeout tdb_first_tmo; 272 struct timeout tdb_stimer_tmo; 273 struct timeout tdb_sfirst_tmo; 274 275 u_int32_t tdb_exp_allocations; /* Expire after so many flows */ 276 u_int32_t tdb_soft_allocations; /* Expiration warning */ 277 u_int32_t tdb_cur_allocations; /* Total number of allocations */ 278 279 u_int64_t tdb_exp_bytes; /* Expire after so many bytes passed */ 280 u_int64_t tdb_soft_bytes; /* Expiration warning */ 281 u_int64_t tdb_cur_bytes; /* Current count of bytes */ 282 283 u_int64_t tdb_exp_timeout; /* When does the SPI expire */ 284 u_int64_t tdb_soft_timeout; /* Send a soft-expire warning */ 285 u_int64_t tdb_established; /* When was the SPI established */ 286 287 u_int64_t tdb_first_use; /* When was it first used */ 288 u_int64_t tdb_soft_first_use; /* Soft warning */ 289 u_int64_t tdb_exp_first_use; /* Expire if tdb_first_use + 290 * tdb_exp_first_use <= curtime */ 291 u_int64_t tdb_cryptoid; /* Crypto session ID */ 292 293 u_int32_t tdb_spi; /* SPI */ 294 u_int16_t tdb_amxkeylen; /* Raw authentication key length */ 295 u_int16_t tdb_emxkeylen; /* Raw encryption key length */ 296 u_int16_t tdb_ivlen; /* IV length */ 297 u_int16_t tdb_src_cred_len; /* size of tdb_src_credentials */ 298 u_int16_t tdb_dst_cred_len; /* size of tdb_dst_credentials */ 299 u_int8_t tdb_sproto; /* IPsec protocol */ 300 u_int8_t tdb_wnd; /* Replay window */ 301 u_int8_t tdb_satype; /* SA type (RFC2367, PF_KEY) */ 302 u_int8_t tdb_src_cred_type;/* type of tdb_src_credentials */ 303 u_int8_t tdb_dst_cred_type;/* type of tdb_dst_credentials */ 304 305 union sockaddr_union tdb_dst; /* Destination address for this SA */ 306 union sockaddr_union tdb_src; /* Source address for this SA */ 307 union sockaddr_union tdb_proxy; 308 309 u_int8_t *tdb_srcid; /* Source ID for this SA */ 310 u_int8_t *tdb_dstid; /* Destination ID for this SA */ 311 u_int8_t *tdb_amxkey; /* Raw authentication key */ 312 u_int8_t *tdb_emxkey; /* Raw encryption key */ 313 314 u_int32_t tdb_rpl; /* Replay counter */ 315 u_int32_t tdb_bitmap; /* Used for replay sliding window */ 316 u_int32_t tdb_initial; /* Initial replay value */ 317 318 u_int32_t tdb_epoch; /* Used by the kernfs interface */ 319 u_int16_t tdb_srcid_len; 320 u_int16_t tdb_dstid_len; 321 u_int16_t tdb_srcid_type; 322 u_int16_t tdb_dstid_type; 323 324 u_int8_t tdb_iv[4]; /* Used for HALF-IV ESP */ 325 326 caddr_t tdb_src_credentials; 327 caddr_t tdb_dst_credentials; 328 329 TAILQ_HEAD(tdb_inp_head_in, inpcb) tdb_inp_in; 330 TAILQ_HEAD(tdb_inp_head_out, inpcb) tdb_inp_out; 331 TAILQ_HEAD(tdb_policy_head, ipsec_policy) tdb_policy_head; 332}; 333 334struct tdb_ident { 335 u_int32_t spi; 336 union sockaddr_union dst; 337 u_int8_t proto; 338}; 339 340struct tdb_crypto { 341 u_int32_t tc_spi; 342 union sockaddr_union tc_dst; 343 u_int8_t tc_proto; 344 u_int32_t tc_spi2; 345 union sockaddr_union tc_dst2; 346 u_int8_t tc_proto2; 347 int tc_protoff; 348 int tc_skip; 349 caddr_t tc_ptr; 350}; 351 352struct ipsecinit 353{ 354 u_int8_t *ii_enckey; 355 u_int8_t *ii_authkey; 356 u_int16_t ii_enckeylen; 357 u_int16_t ii_authkeylen; 358 u_int8_t ii_encalg; 359 u_int8_t ii_authalg; 360}; 361 362struct xformsw 363{ 364 u_short xf_type; /* Unique ID of xform */ 365 u_short xf_flags; /* flags (see below) */ 366 char *xf_name; /* human-readable name */ 367 int (*xf_attach)(void); /* called at config time */ 368 int (*xf_init)(struct tdb *, struct xformsw *, struct ipsecinit *); 369 int (*xf_zeroize)(struct tdb *); /* termination */ 370 int (*xf_input)(struct mbuf *, struct tdb *, int, int); /* input */ 371 int (*xf_output)(struct mbuf *, struct tdb *, struct mbuf **, int, int, struct tdb *); /* output */ 372}; 373 374/* xform IDs */ 375#define XF_IP4 1 /* IP inside IP */ 376#define XF_AH 2 /* AH */ 377#define XF_ESP 3 /* ESP */ 378#define XF_TCPSIGNATURE 5 /* TCP MD5 Signature option, RFC 2358 */ 379 380/* xform attributes */ 381#define XFT_AUTH 0x0001 382#define XFT_CONF 0x0100 383 384#define IPSEC_ZEROES_SIZE 256 /* Larger than an IP6 extension hdr. */ 385#define IPSEC_KERNFS_BUFSIZE 4096 386 387#if BYTE_ORDER == LITTLE_ENDIAN 388static __inline u_int64_t 389htonq(u_int64_t q) 390{ 391 register u_int32_t u, l; 392 u = q >> 32; 393 l = (u_int32_t) q; 394 395 return htonl(u) | ((u_int64_t)htonl(l) << 32); 396} 397 398#define ntohq(_x) htonq(_x) 399 400#elif BYTE_ORDER == BIG_ENDIAN 401 402#define htonq(_x) (_x) 403#define ntohq(_x) htonq(_x) 404 405#else 406#error "Please fix <machine/endian.h>" 407#endif 408 409#ifdef _KERNEL 410 411/* 412 * Protects all tdb lists. 413 * Must at least be splsoftnet (note: do not use splsoftclock as it is 414 * special on some architectures, assuming it is always an spl lowering 415 * operation). 416 */ 417#define spltdb splsoftnet 418 419extern int encdebug; 420extern int ipsec_acl; 421extern int ipsec_keep_invalid; 422extern int ipsec_in_use; 423extern u_int64_t ipsec_last_added; 424extern int ipsec_require_pfs; 425extern int ipsec_expire_acquire; 426 427extern int ipsec_soft_allocations; 428extern int ipsec_exp_allocations; 429extern int ipsec_soft_bytes; 430extern int ipsec_exp_bytes; 431extern int ipsec_soft_timeout; 432extern int ipsec_exp_timeout; 433extern int ipsec_soft_first_use; 434extern int ipsec_exp_first_use; 435extern char ipsec_def_enc[]; 436extern char ipsec_def_auth[]; 437 438extern struct enc_xform enc_xform_des; 439extern struct enc_xform enc_xform_3des; 440extern struct enc_xform enc_xform_blf; 441extern struct enc_xform enc_xform_cast5; 442extern struct enc_xform enc_xform_skipjack; 443 444extern struct auth_hash auth_hash_hmac_md5_96; 445extern struct auth_hash auth_hash_hmac_sha1_96; 446extern struct auth_hash auth_hash_hmac_ripemd_160_96; 447 448extern TAILQ_HEAD(ipsec_policy_head, ipsec_policy) ipsec_policy_head; 449extern TAILQ_HEAD(ipsec_acquire_head, ipsec_acquire) ipsec_acquire_head; 450 451extern struct xformsw xformsw[], *xformswNXFORMSW; 452 453/* Check if a given tdb has encryption, authentication and/or tunneling */ 454#define TDB_ATTRIB(x) (((x)->tdb_encalgxform ? NOTIFY_SATYPE_CONF : 0)| \ 455 ((x)->tdb_authalgxform ? NOTIFY_SATYPE_AUTH : 0)) 456 457/* Traverse spi chain and get attributes */ 458 459#define SPI_CHAIN_ATTRIB(have, TDB_DIR, TDBP) do {\ 460 int s = spltdb(); \ 461 struct tdb *tmptdb = (TDBP); \ 462 \ 463 (have) = 0; \ 464 while (tmptdb && tmptdb->tdb_xform) { \ 465 if (tmptdb == NULL || tmptdb->tdb_flags & TDBF_INVALID) \ 466 break; \ 467 (have) |= TDB_ATTRIB(tmptdb); \ 468 tmptdb = tmptdb->TDB_DIR; \ 469 } \ 470 splx(s); \ 471} while (0) 472 473/* Misc. */ 474extern char *inet_ntoa4(struct in_addr); 475extern char *ipsp_address(union sockaddr_union); 476 477/* TDB management routines */ 478extern void tdb_add_inp(struct tdb *, struct inpcb *, int); 479extern u_int32_t reserve_spi(u_int32_t, u_int32_t, union sockaddr_union *, 480 union sockaddr_union *, u_int8_t, int *); 481extern struct tdb *gettdb(u_int32_t, union sockaddr_union *, u_int8_t); 482extern struct tdb *gettdbbyaddr(union sockaddr_union *, u_int8_t, 483 struct mbuf *, int); 484extern struct tdb *gettdbbysrc(union sockaddr_union *, u_int8_t, 485 struct mbuf *, int); 486extern void puttdb(struct tdb *); 487extern void tdb_delete(struct tdb *); 488extern struct tdb *tdb_alloc(void); 489extern int tdb_init(struct tdb *, u_int16_t, struct ipsecinit *); 490extern int tdb_walk(int (*)(struct tdb *, void *, int), void *); 491 492/* XF_IP4 */ 493extern int ipe4_attach(void); 494extern int ipe4_init(struct tdb *, struct xformsw *, struct ipsecinit *); 495extern int ipe4_zeroize(struct tdb *); 496extern int ipip_output(struct mbuf *, struct tdb *, struct mbuf **, int, int, 497 struct tdb *); 498extern void ipe4_input __P((struct mbuf *, ...)); 499extern void ipip_input __P((struct mbuf *, int)); 500 501#ifdef INET 502extern void ip4_input __P((struct mbuf *, ...)); 503#endif /* INET */ 504 505#ifdef INET6 506extern int ip4_input6 __P((struct mbuf **, int *, int)); 507#endif /* INET */ 508 509/* XF_ETHERIP */ 510extern int etherip_output(struct mbuf *, struct tdb *, struct mbuf **, 511 int, int); 512extern void etherip_input __P((struct mbuf *, ...)); 513 514/* XF_AH */ 515extern int ah_attach(void); 516extern int ah_init(struct tdb *, struct xformsw *, struct ipsecinit *); 517extern int ah_zeroize(struct tdb *); 518extern int ah_output(struct mbuf *, struct tdb *, struct mbuf **, int, int, 519 struct tdb *); 520extern int ah_output_cb(void *); 521extern int ah_input(struct mbuf *, struct tdb *, int, int); 522extern int ah_input_cb(void *); 523extern int ah_sysctl(int *, u_int, void *, size_t *, void *, size_t); 524extern int ah_massage_headers(struct mbuf **, int, int, int, int); 525 526#ifdef INET 527extern void ah4_input __P((struct mbuf *, ...)); 528extern int ah4_input_cb __P((struct mbuf *, ...)); 529#endif /* INET */ 530 531#ifdef INET6 532extern int ah6_input __P((struct mbuf **, int *, int)); 533extern int ah6_input_cb __P((struct mbuf *, int, int)); 534#endif /* INET6 */ 535 536/* XF_ESP */ 537extern int esp_attach(void); 538extern int esp_init(struct tdb *, struct xformsw *, struct ipsecinit *); 539extern int esp_zeroize(struct tdb *); 540extern int esp_output(struct mbuf *, struct tdb *, struct mbuf **, int, int, 541 struct tdb *); 542extern int esp_output_cb(void *); 543extern int esp_input(struct mbuf *, struct tdb *, int, int); 544extern int esp_input_cb(void *); 545extern int esp_sysctl(int *, u_int, void *, size_t *, void *, size_t); 546 547#ifdef INET 548extern void esp4_input __P((struct mbuf *, ...)); 549extern int esp4_input_cb __P((struct mbuf *, ...)); 550#endif /* INET */ 551 552#ifdef INET6 553extern int esp6_input __P((struct mbuf **, int *, int)); 554extern int esp6_input_cb __P((struct mbuf *, int, int)); 555#endif /* INET6 */ 556 557/* XF_TCPSIGNATURE */ 558extern int tcp_signature_tdb_attach __P((void)); 559extern int tcp_signature_tdb_init __P((struct tdb *, struct xformsw *, 560 struct ipsecinit *)); 561extern int tcp_signature_tdb_zeroize __P((struct tdb *)); 562extern int tcp_signature_tdb_input __P((struct mbuf *, struct tdb *, int, 563 int)); 564extern int tcp_signature_tdb_output __P((struct mbuf *, struct tdb *, 565 struct mbuf **, int, int, 566 struct tdb *)); 567 568/* Padding */ 569extern caddr_t m_pad(struct mbuf *, int); 570 571/* Replay window */ 572extern int checkreplaywindow32(u_int32_t, u_int32_t, u_int32_t *, u_int32_t, 573 u_int32_t *); 574 575extern unsigned char ipseczeroes[]; 576 577/* Packet processing */ 578extern int ipsp_process_packet(struct mbuf *, struct tdb *, int, int, 579 struct tdb *); 580extern int ipsp_process_done(struct mbuf *, struct tdb *, struct tdb *); 581extern struct tdb *ipsp_spd_lookup(struct mbuf *, int, int, int *, int, 582 struct tdb *, struct inpcb *); 583extern int ipsec_common_input_cb(struct mbuf *, struct tdb *, int, int); 584extern int ipsp_acquire_sa(struct ipsec_policy *, union sockaddr_union *, 585 union sockaddr_union *, struct sockaddr_encap *, 586 struct mbuf *); 587extern struct ipsec_policy *ipsec_add_policy(struct sockaddr_encap *, 588 struct sockaddr_encap *, 589 union sockaddr_union *, int, int); 590extern int ipsp_match_policy(struct tdb *, struct ipsec_policy *, 591 struct mbuf *, int); 592extern int ipsec_delete_policy(struct ipsec_policy *); 593extern void ipsp_acquire_expirations(void *); 594extern struct ipsec_acquire *ipsp_pending_acquire(union sockaddr_union *); 595extern struct ipsec_acquire *ipsec_get_acquire(u_int32_t); 596extern void ipsp_delete_acquire(struct ipsec_acquire *); 597extern void ipsp_clear_acquire(struct tdb *); 598extern void *ipsp_copy_ident(void *); 599#endif /* _KERNEL */ 600#endif /* _NETINET_IPSP_H_ */ 601