ip_ipsp.h revision 1.172
1/* $OpenBSD: ip_ipsp.h,v 1.172 2015/08/25 11:50:14 deraadt Exp $ */ 2/* 3 * The authors of this code are John Ioannidis (ji@tla.org), 4 * Angelos D. Keromytis (kermit@csd.uch.gr), 5 * Niels Provos (provos@physnet.uni-hamburg.de) and 6 * Niklas Hallqvist (niklas@appli.se). 7 * 8 * The original version of this code was written by John Ioannidis 9 * for BSD/OS in Athens, Greece, in November 1995. 10 * 11 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, 12 * by Angelos D. Keromytis. 13 * 14 * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis 15 * and Niels Provos. 16 * 17 * Additional features in 1999 by Angelos D. Keromytis and Niklas Hallqvist. 18 * 19 * Copyright (c) 1995, 1996, 1997, 1998, 1999 by John Ioannidis, 20 * Angelos D. Keromytis and Niels Provos. 21 * Copyright (c) 1999 Niklas Hallqvist. 22 * Copyright (c) 2001, Angelos D. Keromytis. 23 * 24 * Permission to use, copy, and modify this software with or 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 43struct m_tag; 44 45/* IPSP global definitions. */ 46 47#include <sys/types.h> 48#ifdef _KERNEL 49#include <sys/timeout.h> 50#include <sys/tree.h> 51#endif 52#include <sys/queue.h> 53#include <netinet/in.h> 54#include <net/radix.h> 55 56union sockaddr_union { 57 struct sockaddr sa; 58 struct sockaddr_in sin; 59 struct sockaddr_in6 sin6; 60}; 61 62/* HMAC key sizes */ 63#define MD5HMAC96_KEYSIZE 16 64#define SHA1HMAC96_KEYSIZE 20 65#define RIPEMD160HMAC96_KEYSIZE 20 66#define SHA2_256HMAC96_KEYSIZE 32 67#define SHA2_384HMAC96_KEYSIZE 48 68#define SHA2_512HMAC96_KEYSIZE 64 69 70#define AH_HMAC_MAX_HASHLEN 32 /* 256 bits of authenticator for SHA512 */ 71#define AH_HMAC_RPLENGTH 4 /* 32 bits of replay counter */ 72#define AH_HMAC_INITIAL_RPL 1 /* Replay counter initial value */ 73 74/* Authenticator lengths */ 75#define AH_MD5_ALEN 16 76#define AH_SHA1_ALEN 20 77#define AH_RMD160_ALEN 20 78#define AH_SHA2_256_ALEN 32 79#define AH_SHA2_384_ALEN 48 80#define AH_SHA2_512_ALEN 64 81#define AH_ALEN_MAX 64 /* Keep updated */ 82 83/* Reserved SPI numbers */ 84#define SPI_LOCAL_USE 0 85#define SPI_RESERVED_MIN 1 86#define SPI_RESERVED_MAX 255 87 88/* Reserved CPI numbers */ 89#define CPI_RESERVED_MIN 1 90#define CPI_RESERVED_MAX 255 91#define CPI_PRIVATE_MIN 61440 92#define CPI_PRIVATE_MAX 65535 93 94/* sysctl default values */ 95#define IPSEC_DEFAULT_EMBRYONIC_SA_TIMEOUT 60 /* 1 minute */ 96#define IPSEC_DEFAULT_PFS 1 97#define IPSEC_DEFAULT_SOFT_ALLOCATIONS 0 98#define IPSEC_DEFAULT_EXP_ALLOCATIONS 0 99#define IPSEC_DEFAULT_SOFT_BYTES 0 100#define IPSEC_DEFAULT_EXP_BYTES 0 101#define IPSEC_DEFAULT_SOFT_TIMEOUT 80000 102#define IPSEC_DEFAULT_EXP_TIMEOUT 86400 103#define IPSEC_DEFAULT_SOFT_FIRST_USE 3600 104#define IPSEC_DEFAULT_EXP_FIRST_USE 7200 105#define IPSEC_DEFAULT_DEF_ENC "aes" 106#define IPSEC_DEFAULT_DEF_AUTH "hmac-sha1" 107#define IPSEC_DEFAULT_EXPIRE_ACQUIRE 30 108#define IPSEC_DEFAULT_DEF_COMP "deflate" 109 110struct sockaddr_encap { 111 u_int8_t sen_len; /* length */ 112 u_int8_t sen_family; /* PF_KEY */ 113 u_int16_t sen_type; /* see SENT_* */ 114 union { 115 struct { /* SENT_IP4 */ 116 u_int8_t Direction; 117 struct in_addr Src; 118 struct in_addr Dst; 119 u_int8_t Proto; 120 u_int16_t Sport; 121 u_int16_t Dport; 122 } Sip4; 123 124 struct { /* SENT_IP6 */ 125 u_int8_t Direction; 126 struct in6_addr Src; 127 struct in6_addr Dst; 128 u_int8_t Proto; 129 u_int16_t Sport; 130 u_int16_t Dport; 131 } Sip6; 132 133 struct ipsec_policy *PolicyHead; /* SENT_IPSP */ 134 } Sen; 135}; 136 137#define IPSP_DIRECTION_IN 0x1 138#define IPSP_DIRECTION_OUT 0x2 139 140#ifdef _KERNEL 141 142#define sen_data Sen.Data 143#define sen_ip_src Sen.Sip4.Src 144#define sen_ip_dst Sen.Sip4.Dst 145#define sen_proto Sen.Sip4.Proto 146#define sen_sport Sen.Sip4.Sport 147#define sen_dport Sen.Sip4.Dport 148#define sen_direction Sen.Sip4.Direction 149#define sen_ip6_src Sen.Sip6.Src 150#define sen_ip6_dst Sen.Sip6.Dst 151#define sen_ip6_proto Sen.Sip6.Proto 152#define sen_ip6_sport Sen.Sip6.Sport 153#define sen_ip6_dport Sen.Sip6.Dport 154#define sen_ip6_direction Sen.Sip6.Direction 155#define sen_ipsp Sen.PolicyHead 156 157/* 158 * The "type" is really part of the address as far as the routing 159 * system is concerned. By using only one bit in the type field 160 * for each type, we sort-of make sure that different types of 161 * encapsulation addresses won't be matched against the wrong type. 162 * 163 */ 164 165#define SENT_IP4 0x0001 /* data is two struct in_addr */ 166#define SENT_IPSP 0x0002 /* data as in IP4/6 plus SPI */ 167#define SENT_IP6 0x0004 168 169#define SENT_LEN sizeof(struct sockaddr_encap) 170 171struct ipsec_id { 172 u_int16_t type; /* Subtype of data */ 173 int16_t len; /* Length of data following */ 174}; 175 176struct ipsec_ids { 177 RB_ENTRY(ipsec_ids) id_node_id; 178 RB_ENTRY(ipsec_ids) id_node_flow; 179 struct ipsec_id *id_local; 180 struct ipsec_id *id_remote; 181 u_int32_t id_flow; 182 int id_refcount; 183 struct timeout id_timeout; 184}; 185RB_HEAD(ipsec_ids_flows, ipsec_ids); 186RB_HEAD(ipsec_ids_tree, ipsec_ids); 187 188struct ipsec_acquire { 189 union sockaddr_union ipa_addr; 190 u_int32_t ipa_seq; 191 struct sockaddr_encap ipa_info; 192 struct sockaddr_encap ipa_mask; 193 struct timeout ipa_timeout; 194 struct ipsec_policy *ipa_policy; 195 struct inpcb *ipa_pcb; 196 TAILQ_ENTRY(ipsec_acquire) ipa_ipo_next; 197 TAILQ_ENTRY(ipsec_acquire) ipa_next; 198}; 199 200struct ipsec_policy { 201 struct radix_node ipo_nodes[2]; /* radix tree glue */ 202 struct sockaddr_encap ipo_addr; 203 struct sockaddr_encap ipo_mask; 204 205 union sockaddr_union ipo_src; /* Local address to use */ 206 union sockaddr_union ipo_dst; /* Remote gateway -- if it's zeroed: 207 * - on output, we try to 208 * contact the remote host 209 * directly (if needed). 210 * - on input, we accept on if 211 * the inner source is the 212 * same as the outer source 213 * address, or if transport 214 * mode was used. 215 */ 216 217 u_int64_t ipo_last_searched; /* Timestamp of last lookup */ 218 219 u_int8_t ipo_flags; /* See IPSP_POLICY_* definitions */ 220 u_int8_t ipo_type; /* USE/ACQUIRE/... */ 221 u_int8_t ipo_sproto; /* ESP/AH; if zero, use system dflts */ 222 u_int ipo_rdomain; 223 224 int ipo_ref_count; 225 226 struct tdb *ipo_tdb; /* Cached entry */ 227 228 struct ipsec_ids *ipo_ids; 229 230 TAILQ_HEAD(ipo_acquires_head, ipsec_acquire) ipo_acquires; /* List of acquires */ 231 TAILQ_ENTRY(ipsec_policy) ipo_tdb_next; /* List TDB policies */ 232 TAILQ_ENTRY(ipsec_policy) ipo_list; /* List of all policies */ 233}; 234 235#define IPSP_POLICY_NONE 0x0000 /* No flags set */ 236#define IPSP_POLICY_STATIC 0x0002 /* Static policy */ 237 238#define IPSP_IPSEC_USE 0 /* Use if existing, don't acquire */ 239#define IPSP_IPSEC_ACQUIRE 1 /* Try acquire, let packet through */ 240#define IPSP_IPSEC_REQUIRE 2 /* Require SA */ 241#define IPSP_PERMIT 3 /* Permit traffic through */ 242#define IPSP_DENY 4 /* Deny traffic */ 243#define IPSP_IPSEC_DONTACQ 5 /* Require, but don't acquire */ 244 245/* Identity types */ 246#define IPSP_IDENTITY_NONE 0 247#define IPSP_IDENTITY_PREFIX 1 248#define IPSP_IDENTITY_FQDN 2 249#define IPSP_IDENTITY_USERFQDN 3 250 251struct tdb { /* tunnel descriptor block */ 252 /* 253 * Each TDB is on three hash tables: one keyed on dst/spi/sproto, 254 * one keyed on dst/sproto, and one keyed on src/sproto. The first 255 * is used for finding a specific TDB, the second for finding TDBs 256 * for outgoing policy matching, and the third for incoming 257 * policy matching. The following three fields maintain the hash 258 * queues in those three tables. 259 */ 260 struct tdb *tdb_hnext; /* dst/spi/sproto table */ 261 struct tdb *tdb_dnext; /* dst/sproto table */ 262 struct tdb *tdb_snext; /* src/sproto table */ 263 struct tdb *tdb_inext; 264 struct tdb *tdb_onext; 265 266 struct xformsw *tdb_xform; /* Transform to use */ 267 struct enc_xform *tdb_encalgxform; /* Enc algorithm */ 268 struct auth_hash *tdb_authalgxform; /* Auth algorithm */ 269 struct comp_algo *tdb_compalgxform; /* Compression algo */ 270 271#define TDBF_UNIQUE 0x00001 /* This should not be used by others */ 272#define TDBF_TIMER 0x00002 /* Absolute expiration timer in use */ 273#define TDBF_BYTES 0x00004 /* Check the byte counters */ 274#define TDBF_ALLOCATIONS 0x00008 /* Check the flows counters */ 275#define TDBF_INVALID 0x00010 /* This SPI is not valid yet/anymore */ 276#define TDBF_FIRSTUSE 0x00020 /* Expire after first use */ 277#define TDBF_SOFT_TIMER 0x00080 /* Soft expiration */ 278#define TDBF_SOFT_BYTES 0x00100 /* Soft expiration */ 279#define TDBF_SOFT_ALLOCATIONS 0x00200 /* Soft expiration */ 280#define TDBF_SOFT_FIRSTUSE 0x00400 /* Soft expiration */ 281#define TDBF_PFS 0x00800 /* Ask for PFS from Key Mgmt. */ 282#define TDBF_TUNNELING 0x01000 /* Force IP-IP encapsulation */ 283#define TDBF_USEDTUNNEL 0x10000 /* Appended a tunnel header in past */ 284#define TDBF_UDPENCAP 0x20000 /* UDP encapsulation */ 285#define TDBF_PFSYNC 0x40000 /* TDB will be synced */ 286#define TDBF_PFSYNC_RPL 0x80000 /* Replay counter should be bumped */ 287#define TDBF_ESN 0x100000 /* 64-bit sequence numbers (ESN) */ 288 289 u_int32_t tdb_flags; /* Flags related to this TDB */ 290 291 struct timeout tdb_timer_tmo; 292 struct timeout tdb_first_tmo; 293 struct timeout tdb_stimer_tmo; 294 struct timeout tdb_sfirst_tmo; 295 296 u_int32_t tdb_seq; /* Tracking number for PFKEY */ 297 u_int32_t tdb_exp_allocations; /* Expire after so many flows */ 298 u_int32_t tdb_soft_allocations; /* Expiration warning */ 299 u_int32_t tdb_cur_allocations; /* Total number of allocs */ 300 301 u_int64_t tdb_exp_bytes; /* Expire after so many bytes passed */ 302 u_int64_t tdb_soft_bytes; /* Expiration warning */ 303 u_int64_t tdb_cur_bytes; /* Current count of bytes */ 304 305 u_int64_t tdb_exp_timeout; /* When does the SPI expire */ 306 u_int64_t tdb_soft_timeout; /* Send soft-expire warning */ 307 u_int64_t tdb_established; /* When was SPI established */ 308 309 u_int64_t tdb_first_use; /* When was it first used */ 310 u_int64_t tdb_soft_first_use; /* Soft warning */ 311 u_int64_t tdb_exp_first_use; /* Expire if tdb_first_use + 312 * tdb_exp_first_use <= curtime 313 */ 314 315 u_int64_t tdb_last_used; /* When was this SA last used */ 316 u_int64_t tdb_last_marked;/* Last SKIPCRYPTO status change */ 317 318 u_int64_t tdb_cryptoid; /* Crypto session ID */ 319 320 u_int32_t tdb_spi; /* SPI */ 321 u_int16_t tdb_amxkeylen; /* Raw authentication key length */ 322 u_int16_t tdb_emxkeylen; /* Raw encryption key length */ 323 u_int16_t tdb_ivlen; /* IV length */ 324 u_int8_t tdb_sproto; /* IPsec protocol */ 325 u_int8_t tdb_wnd; /* Replay window */ 326 u_int8_t tdb_satype; /* SA type (RFC2367, PF_KEY) */ 327 u_int8_t tdb_updates; /* pfsync update counter */ 328 329 union sockaddr_union tdb_dst; /* Destination address */ 330 union sockaddr_union tdb_src; /* Source address */ 331 332 u_int8_t *tdb_amxkey; /* Raw authentication key */ 333 u_int8_t *tdb_emxkey; /* Raw encryption key */ 334 335#define TDB_REPLAYWASTE 32 336#define TDB_REPLAYMAX (2100+TDB_REPLAYWASTE) 337 338 u_int64_t tdb_rpl; /* Replay counter */ 339 u_int32_t tdb_seen[howmany(TDB_REPLAYMAX, 32)]; /* Anti-replay window */ 340 341 u_int8_t tdb_iv[4]; /* Used for HALF-IV ESP */ 342 343 struct ipsec_ids *tdb_ids; /* Src/Dst ID for this SA */ 344 int tdb_ids_swapped; /* XXX */ 345 346 u_int32_t tdb_mtu; /* MTU at this point in the chain */ 347 u_int64_t tdb_mtutimeout; /* When to ignore this entry */ 348 349 u_int16_t tdb_udpencap_port; /* Peer UDP port */ 350 351 u_int16_t tdb_tag; /* Packet filter tag */ 352 u_int32_t tdb_tap; /* Alternate enc(4) interface */ 353 354 u_int tdb_rdomain; /* Routing domain */ 355 356 struct sockaddr_encap tdb_filter; /* What traffic is acceptable */ 357 struct sockaddr_encap tdb_filtermask; /* And the mask */ 358 359 TAILQ_HEAD(tdb_policy_head, ipsec_policy) tdb_policy_head; 360 TAILQ_ENTRY(tdb) tdb_sync_entry; 361}; 362 363#endif /* _KERNEL */ 364 365struct tdb_ident { 366 u_int32_t spi; 367 union sockaddr_union dst; 368 u_int8_t proto; 369 u_int rdomain; 370}; 371 372struct tdb_crypto { 373 u_int32_t tc_spi; 374 union sockaddr_union tc_dst; 375 u_int8_t tc_proto; 376 int tc_protoff; 377 int tc_skip; 378 u_int tc_rdomain; 379}; 380 381struct ipsecinit { 382 u_int8_t *ii_enckey; 383 u_int8_t *ii_authkey; 384 u_int16_t ii_enckeylen; 385 u_int16_t ii_authkeylen; 386 u_int8_t ii_encalg; 387 u_int8_t ii_authalg; 388 u_int8_t ii_compalg; 389}; 390 391/* xform IDs */ 392#define XF_IP4 1 /* IP inside IP */ 393#define XF_AH 2 /* AH */ 394#define XF_ESP 3 /* ESP */ 395#define XF_TCPSIGNATURE 5 /* TCP MD5 Signature option, RFC 2358 */ 396#define XF_IPCOMP 6 /* IPCOMP */ 397 398/* xform attributes */ 399#define XFT_AUTH 0x0001 400#define XFT_CONF 0x0100 401#define XFT_COMP 0x1000 402 403#define IPSEC_ZEROES_SIZE 256 /* Larger than an IP6 extension hdr. */ 404 405#ifdef _KERNEL 406 407struct xformsw { 408 u_short xf_type; /* Unique ID of xform */ 409 u_short xf_flags; /* flags (see below) */ 410 char *xf_name; /* human-readable name */ 411 int (*xf_attach)(void); /* called at config time */ 412 int (*xf_init)(struct tdb *, struct xformsw *, struct ipsecinit *); 413 int (*xf_zeroize)(struct tdb *); /* termination */ 414 int (*xf_input)(struct mbuf *, struct tdb *, int, int); /* input */ 415 int (*xf_output)(struct mbuf *, struct tdb *, struct mbuf **, 416 int, int); /* output */ 417}; 418 419extern int ipsec_in_use; 420extern u_int64_t ipsec_last_added; 421extern int ipsec_policy_pool_initialized; 422 423extern int ipsec_keep_invalid; /* lifetime of embryonic SAs (in sec) */ 424extern int ipsec_require_pfs; /* use Perfect Forward Secrecy */ 425extern int ipsec_expire_acquire; /* wait for security assoc. (in sec) */ 426extern int ipsec_soft_allocations; /* flows/SA before renegotiation */ 427extern int ipsec_exp_allocations; /* num. of flows/SA before it expires */ 428extern int ipsec_soft_bytes; /* bytes/SA before renegotiation */ 429extern int ipsec_exp_bytes; /* num of bytes/SA before it expires */ 430extern int ipsec_soft_timeout; /* seconds/SA before renegotiation */ 431extern int ipsec_exp_timeout; /* seconds/SA before it expires */ 432extern int ipsec_soft_first_use; /* seconds between 1st asso & renego */ 433extern int ipsec_exp_first_use; /* seconds between 1st asso & expire */ 434 435extern char ipsec_def_enc[]; 436extern char ipsec_def_auth[]; 437extern char ipsec_def_comp[]; 438 439extern struct enc_xform enc_xform_des; 440extern struct enc_xform enc_xform_3des; 441extern struct enc_xform enc_xform_blf; 442extern struct enc_xform enc_xform_cast5; 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 struct comp_algo comp_algo_deflate; 449 450extern TAILQ_HEAD(ipsec_policy_head, ipsec_policy) ipsec_policy_head; 451extern TAILQ_HEAD(ipsec_acquire_head, ipsec_acquire) ipsec_acquire_head; 452 453/* Misc. */ 454#ifdef ENCDEBUG 455const char *ipsp_address(union sockaddr_union *, char *, socklen_t); 456#endif /* ENCDEBUG */ 457 458/* SPD tables */ 459struct radix_node_head *spd_table_add(unsigned int); 460struct radix_node_head *spd_table_get(unsigned int); 461 462/* TDB management routines */ 463uint32_t reserve_spi(u_int, u_int32_t, u_int32_t, union sockaddr_union *, 464 union sockaddr_union *, u_int8_t, int *); 465struct tdb *gettdb(u_int, u_int32_t, union sockaddr_union *, u_int8_t); 466struct tdb *gettdbbydst(u_int, union sockaddr_union *, u_int8_t, 467 struct ipsec_ids *, 468 struct sockaddr_encap *, struct sockaddr_encap *); 469struct tdb *gettdbbysrc(u_int, union sockaddr_union *, u_int8_t, 470 struct ipsec_ids *, 471 struct sockaddr_encap *, struct sockaddr_encap *); 472struct tdb *gettdbbysrcdst(u_int, u_int32_t, union sockaddr_union *, 473 union sockaddr_union *, u_int8_t); 474void puttdb(struct tdb *); 475void tdb_delete(struct tdb *); 476struct tdb *tdb_alloc(u_int); 477void tdb_free(struct tdb *); 478int tdb_init(struct tdb *, u_int16_t, struct ipsecinit *); 479int tdb_walk(u_int, int (*)(struct tdb *, void *, int), void *); 480 481/* XF_IP4 */ 482int ipe4_attach(void); 483int ipe4_init(struct tdb *, struct xformsw *, struct ipsecinit *); 484int ipe4_zeroize(struct tdb *); 485void ipe4_input(struct mbuf *, ...); 486void ipip_input(struct mbuf *, int, struct ifnet *, int); 487int ipip_output(struct mbuf *, struct tdb *, struct mbuf **, int, int); 488 489void ip4_input(struct mbuf *, ...); 490 491#ifdef INET6 492int ip4_input6(struct mbuf **, int *, int); 493#endif /* INET6 */ 494 495/* XF_AH */ 496int ah_attach(void); 497int ah_init(struct tdb *, struct xformsw *, struct ipsecinit *); 498int ah_zeroize(struct tdb *); 499int ah_input(struct mbuf *, struct tdb *, int, int); 500int ah_output(struct mbuf *, struct tdb *, struct mbuf **, int, int); 501int ah_sysctl(int *, u_int, void *, size_t *, void *, size_t); 502 503void ah4_input(struct mbuf *, ...); 504void *ah4_ctlinput(int, struct sockaddr *, u_int, void *); 505void *udpencap_ctlinput(int, struct sockaddr *, u_int, void *); 506 507#ifdef INET6 508int ah6_input(struct mbuf **, int *, int); 509#endif /* INET6 */ 510 511/* XF_ESP */ 512int esp_attach(void); 513int esp_init(struct tdb *, struct xformsw *, struct ipsecinit *); 514int esp_zeroize(struct tdb *); 515int esp_input(struct mbuf *, struct tdb *, int, int); 516int esp_output(struct mbuf *, struct tdb *, struct mbuf **, int, int); 517int esp_sysctl(int *, u_int, void *, size_t *, void *, size_t); 518 519void esp4_input(struct mbuf *, ...); 520void *esp4_ctlinput(int, struct sockaddr *, u_int, void *); 521 522#ifdef INET6 523int esp6_input(struct mbuf **, int *, int); 524#endif /* INET6 */ 525 526/* XF_IPCOMP */ 527int ipcomp_attach(void); 528int ipcomp_init(struct tdb *, struct xformsw *, struct ipsecinit *); 529int ipcomp_zeroize(struct tdb *); 530int ipcomp_input(struct mbuf *, struct tdb *, int, int); 531int ipcomp_output(struct mbuf *, struct tdb *, struct mbuf **, int, int); 532int ipcomp_sysctl(int *, u_int, void *, size_t *, void *, size_t); 533 534void ipcomp4_input(struct mbuf *, ...); 535 536#ifdef INET6 537int ipcomp6_input(struct mbuf **, int *, int); 538#endif /* INET6 */ 539 540/* XF_TCPSIGNATURE */ 541int tcp_signature_tdb_attach(void); 542int tcp_signature_tdb_init(struct tdb *, struct xformsw *, 543 struct ipsecinit *); 544int tcp_signature_tdb_zeroize(struct tdb *); 545int tcp_signature_tdb_input(struct mbuf *, struct tdb *, int, int); 546int tcp_signature_tdb_output(struct mbuf *, struct tdb *, struct mbuf **, 547 int, int); 548 549/* Replay window */ 550int checkreplaywindow(struct tdb *, u_int32_t, u_int32_t *, int); 551 552/* Packet processing */ 553int ipsp_process_packet(struct mbuf *, struct tdb *, int, int); 554int ipsp_process_done(struct mbuf *, struct tdb *); 555struct tdb *ipsp_spd_lookup(struct mbuf *, int, int, int *, int, 556 struct tdb *, struct inpcb *, u_int32_t); 557struct tdb *ipsp_spd_inp(struct mbuf *, int, int, int *, int, 558 struct tdb *, struct inpcb *, struct ipsec_policy *); 559int ipsp_is_unspecified(union sockaddr_union); 560int ipsp_aux_match(struct tdb *, struct ipsec_ids *, 561 struct sockaddr_encap *, struct sockaddr_encap *); 562int ipsp_ids_match(struct ipsec_ids *, struct ipsec_ids *); 563struct ipsec_ids *ipsp_ids_insert(struct ipsec_ids *); 564struct ipsec_ids *ipsp_ids_lookup(u_int32_t); 565void ipsp_ids_free(struct ipsec_ids *); 566 567int ipsec_common_input(struct mbuf *, int, int, int, int, int); 568int ipsec_common_input_cb(struct mbuf *, struct tdb *, int, int); 569int ipsec_delete_policy(struct ipsec_policy *); 570ssize_t ipsec_hdrsz(struct tdb *); 571void ipsec_adjust_mtu(struct mbuf *, u_int32_t); 572struct ipsec_acquire *ipsec_get_acquire(u_int32_t); 573 574#endif /* _KERNEL */ 575#endif /* _NETINET_IPSP_H_ */ 576