10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53055Sdanmcd * Common Development and Distribution License (the "License"). 63055Sdanmcd * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*10019SMark.Fenwick@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _NET_PFKEYV2_H 270Sstevel@tonic-gate #define _NET_PFKEYV2_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * Definitions and structures for PF_KEY version 2. See RFC 2367 for 310Sstevel@tonic-gate * more details. SA == Security Association, which is what PF_KEY provides 320Sstevel@tonic-gate * an API for managing. 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define PF_KEY_V2 2 400Sstevel@tonic-gate #define PFKEYV2_REVISION 200109L 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Base PF_KEY message. 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate typedef struct sadb_msg { 470Sstevel@tonic-gate uint8_t sadb_msg_version; /* Version, currently PF_KEY_V2 */ 480Sstevel@tonic-gate uint8_t sadb_msg_type; /* ADD, UPDATE, etc. */ 490Sstevel@tonic-gate uint8_t sadb_msg_errno; /* Error number from UNIX errno space */ 500Sstevel@tonic-gate uint8_t sadb_msg_satype; /* ESP, AH, etc. */ 510Sstevel@tonic-gate uint16_t sadb_msg_len; /* Length in 64-bit words. */ 520Sstevel@tonic-gate uint16_t sadb_msg_reserved; /* must be zero */ 530Sstevel@tonic-gate /* 540Sstevel@tonic-gate * Use the reserved field for extended diagnostic information on errno 550Sstevel@tonic-gate * responses. 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate #define sadb_x_msg_diagnostic sadb_msg_reserved 580Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 590Sstevel@tonic-gate union { 600Sstevel@tonic-gate struct { 610Sstevel@tonic-gate uint32_t sadb_x_msg_useq; /* Set by originator */ 620Sstevel@tonic-gate uint32_t sadb_x_msg_upid; /* Set by originator */ 630Sstevel@tonic-gate } sadb_x_msg_actual; 640Sstevel@tonic-gate uint64_t sadb_x_msg_alignment; 650Sstevel@tonic-gate } sadb_x_msg_u; 660Sstevel@tonic-gate #define sadb_msg_seq sadb_x_msg_u.sadb_x_msg_actual.sadb_x_msg_useq 670Sstevel@tonic-gate #define sadb_msg_pid sadb_x_msg_u.sadb_x_msg_actual.sadb_x_msg_upid 680Sstevel@tonic-gate } sadb_msg_t; 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* 710Sstevel@tonic-gate * Generic extension header. 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate 740Sstevel@tonic-gate typedef struct sadb_ext { 750Sstevel@tonic-gate union { 760Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 770Sstevel@tonic-gate struct { 780Sstevel@tonic-gate uint16_t sadb_x_ext_ulen; /* In 64s, inclusive */ 790Sstevel@tonic-gate uint16_t sadb_x_ext_utype; /* 0 is reserved */ 800Sstevel@tonic-gate } sadb_x_ext_actual; 810Sstevel@tonic-gate uint64_t sadb_x_ext_alignment; 820Sstevel@tonic-gate } sadb_x_ext_u; 830Sstevel@tonic-gate #define sadb_ext_len sadb_x_ext_u.sadb_x_ext_actual.sadb_x_ext_ulen 840Sstevel@tonic-gate #define sadb_ext_type sadb_x_ext_u.sadb_x_ext_actual.sadb_x_ext_utype 850Sstevel@tonic-gate } sadb_ext_t; 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* 880Sstevel@tonic-gate * Security Association information extension. 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate typedef struct sadb_sa { 920Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 930Sstevel@tonic-gate union { 940Sstevel@tonic-gate struct { 950Sstevel@tonic-gate uint16_t sadb_x_sa_ulen; 960Sstevel@tonic-gate uint16_t sadb_x_sa_uexttype; /* ASSOCIATION */ 970Sstevel@tonic-gate uint32_t sadb_x_sa_uspi; /* Sec. Param. Index */ 980Sstevel@tonic-gate } sadb_x_sa_uactual; 990Sstevel@tonic-gate uint64_t sadb_x_sa_alignment; 1000Sstevel@tonic-gate } sadb_x_sa_u; 1010Sstevel@tonic-gate #define sadb_sa_len sadb_x_sa_u.sadb_x_sa_uactual.sadb_x_sa_ulen 1020Sstevel@tonic-gate #define sadb_sa_exttype sadb_x_sa_u.sadb_x_sa_uactual.sadb_x_sa_uexttype 1030Sstevel@tonic-gate #define sadb_sa_spi sadb_x_sa_u.sadb_x_sa_uactual.sadb_x_sa_uspi 1040Sstevel@tonic-gate uint8_t sadb_sa_replay; /* Replay counter */ 1050Sstevel@tonic-gate uint8_t sadb_sa_state; /* MATURE, DEAD, DYING, LARVAL */ 1060Sstevel@tonic-gate uint8_t sadb_sa_auth; /* Authentication algorithm */ 1070Sstevel@tonic-gate uint8_t sadb_sa_encrypt; /* Encryption algorithm */ 1080Sstevel@tonic-gate uint32_t sadb_sa_flags; /* SA flags. */ 1090Sstevel@tonic-gate } sadb_sa_t; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate /* 1120Sstevel@tonic-gate * SA Lifetime extension. Already 64-bit aligned thanks to uint64_t fields. 1130Sstevel@tonic-gate */ 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate typedef struct sadb_lifetime { 1160Sstevel@tonic-gate uint16_t sadb_lifetime_len; 1170Sstevel@tonic-gate uint16_t sadb_lifetime_exttype; /* SOFT, HARD, CURRENT */ 1180Sstevel@tonic-gate uint32_t sadb_lifetime_allocations; 1190Sstevel@tonic-gate uint64_t sadb_lifetime_bytes; 1200Sstevel@tonic-gate uint64_t sadb_lifetime_addtime; /* These fields are assumed to hold */ 1210Sstevel@tonic-gate uint64_t sadb_lifetime_usetime; /* >= sizeof (time_t). */ 1220Sstevel@tonic-gate } sadb_lifetime_t; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 1250Sstevel@tonic-gate * SA address information. 1260Sstevel@tonic-gate */ 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate typedef struct sadb_address { 1290Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 1300Sstevel@tonic-gate union { 1310Sstevel@tonic-gate struct { 1320Sstevel@tonic-gate uint16_t sadb_x_address_ulen; 1330Sstevel@tonic-gate uint16_t sadb_x_address_uexttype; /* SRC, DST, PROXY */ 1340Sstevel@tonic-gate uint8_t sadb_x_address_uproto; /* Proto for ports... */ 1350Sstevel@tonic-gate uint8_t sadb_x_address_uprefixlen; /* Prefix length. */ 1360Sstevel@tonic-gate uint16_t sadb_x_address_ureserved; /* Padding */ 1370Sstevel@tonic-gate } sadb_x_address_actual; 1380Sstevel@tonic-gate uint64_t sadb_x_address_alignment; 1390Sstevel@tonic-gate } sadb_x_address_u; 1400Sstevel@tonic-gate #define sadb_address_len \ 1410Sstevel@tonic-gate sadb_x_address_u.sadb_x_address_actual.sadb_x_address_ulen 1420Sstevel@tonic-gate #define sadb_address_exttype \ 1430Sstevel@tonic-gate sadb_x_address_u.sadb_x_address_actual.sadb_x_address_uexttype 1440Sstevel@tonic-gate #define sadb_address_proto \ 1450Sstevel@tonic-gate sadb_x_address_u.sadb_x_address_actual.sadb_x_address_uproto 1460Sstevel@tonic-gate #define sadb_address_prefixlen \ 1470Sstevel@tonic-gate sadb_x_address_u.sadb_x_address_actual.sadb_x_address_uprefixlen 1480Sstevel@tonic-gate #define sadb_address_reserved \ 1490Sstevel@tonic-gate sadb_x_address_u.sadb_x_address_actual.sadb_x_address_ureserved 1500Sstevel@tonic-gate /* Followed by a sockaddr structure which may contain ports. */ 1510Sstevel@tonic-gate } sadb_address_t; 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate /* 1540Sstevel@tonic-gate * SA key information. 1550Sstevel@tonic-gate */ 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate typedef struct sadb_key { 1580Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 1590Sstevel@tonic-gate union { 1600Sstevel@tonic-gate struct { 1610Sstevel@tonic-gate uint16_t sadb_x_key_ulen; 1620Sstevel@tonic-gate uint16_t sadb_x_key_uexttype; /* AUTH, ENCRYPT */ 1630Sstevel@tonic-gate uint16_t sadb_x_key_ubits; /* Actual len (bits) */ 1640Sstevel@tonic-gate uint16_t sadb_x_key_ureserved; 1650Sstevel@tonic-gate } sadb_x_key_actual; 1660Sstevel@tonic-gate uint64_t sadb_x_key_alignment; 1670Sstevel@tonic-gate } sadb_x_key_u; 1680Sstevel@tonic-gate #define sadb_key_len sadb_x_key_u.sadb_x_key_actual.sadb_x_key_ulen 1690Sstevel@tonic-gate #define sadb_key_exttype sadb_x_key_u.sadb_x_key_actual.sadb_x_key_uexttype 1700Sstevel@tonic-gate #define sadb_key_bits sadb_x_key_u.sadb_x_key_actual.sadb_x_key_ubits 1710Sstevel@tonic-gate #define sadb_key_reserved sadb_x_key_u.sadb_x_key_actual.sadb_x_key_ureserved 1720Sstevel@tonic-gate /* Followed by actual key(s) in canonical (outbound proc.) order. */ 1730Sstevel@tonic-gate } sadb_key_t; 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate /* 1760Sstevel@tonic-gate * SA Identity information. Already 64-bit aligned thanks to uint64_t fields. 1770Sstevel@tonic-gate */ 1780Sstevel@tonic-gate 1790Sstevel@tonic-gate typedef struct sadb_ident { 1800Sstevel@tonic-gate uint16_t sadb_ident_len; 1810Sstevel@tonic-gate uint16_t sadb_ident_exttype; /* SRC, DST, PROXY */ 1820Sstevel@tonic-gate uint16_t sadb_ident_type; /* FQDN, USER_FQDN, etc. */ 1830Sstevel@tonic-gate uint16_t sadb_ident_reserved; /* Padding */ 1840Sstevel@tonic-gate uint64_t sadb_ident_id; /* For userid, etc. */ 1850Sstevel@tonic-gate /* Followed by an identity null-terminate C string if present. */ 1860Sstevel@tonic-gate } sadb_ident_t; 1870Sstevel@tonic-gate 1880Sstevel@tonic-gate /* 1890Sstevel@tonic-gate * SA sensitivity information. This is mostly useful on MLS systems. 1900Sstevel@tonic-gate */ 1910Sstevel@tonic-gate 1920Sstevel@tonic-gate typedef struct sadb_sens { 1930Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 1940Sstevel@tonic-gate union { 1950Sstevel@tonic-gate struct { 1960Sstevel@tonic-gate uint16_t sadb_x_sens_ulen; 1970Sstevel@tonic-gate uint16_t sadb_x_sens_uexttype; /* SENSITIVITY */ 1980Sstevel@tonic-gate uint32_t sadb_x_sens_udpd; /* Protection domain */ 1990Sstevel@tonic-gate } sadb_x_sens_actual; 2000Sstevel@tonic-gate uint64_t sadb_x_sens_alignment; 2010Sstevel@tonic-gate } sadb_x_sens_u; 2020Sstevel@tonic-gate #define sadb_sens_len sadb_x_sens_u.sadb_x_sens_actual.sadb_x_sens_ulen 2030Sstevel@tonic-gate #define sadb_sens_exttype sadb_x_sens_u.sadb_x_sens_actual.sadb_x_sens_uexttype 2040Sstevel@tonic-gate #define sadb_sens_dpd sadb_x_sens_u.sadb_x_sens_actual.sadb_x_sens_udpd 2050Sstevel@tonic-gate uint8_t sadb_sens_sens_level; 2060Sstevel@tonic-gate uint8_t sadb_sens_sens_len; /* 64-bit words */ 2070Sstevel@tonic-gate uint8_t sadb_sens_integ_level; 2080Sstevel@tonic-gate uint8_t sadb_sens_integ_len; /* 64-bit words */ 2090Sstevel@tonic-gate uint32_t sadb_sens_reserved; 2100Sstevel@tonic-gate /* 2110Sstevel@tonic-gate * followed by two uint64_t arrays 2120Sstevel@tonic-gate * uint64_t sadb_sens_bitmap[sens_bitmap_len]; 2130Sstevel@tonic-gate * uint64_t sadb_integ_bitmap[integ_bitmap_len]; 2140Sstevel@tonic-gate */ 2150Sstevel@tonic-gate } sadb_sens_t; 2160Sstevel@tonic-gate 2170Sstevel@tonic-gate /* 2180Sstevel@tonic-gate * A proposal extension. This is found in an ACQUIRE message, and it 2190Sstevel@tonic-gate * proposes what sort of SA the kernel would like to ACQUIRE. 2200Sstevel@tonic-gate */ 2210Sstevel@tonic-gate 2220Sstevel@tonic-gate /* First, a base structure... */ 2230Sstevel@tonic-gate 2240Sstevel@tonic-gate typedef struct sadb_x_propbase { 2250Sstevel@tonic-gate uint16_t sadb_x_propb_len; 2260Sstevel@tonic-gate uint16_t sadb_x_propb_exttype; /* PROPOSAL, X_EPROP */ 2270Sstevel@tonic-gate union { 2280Sstevel@tonic-gate struct { 2290Sstevel@tonic-gate uint8_t sadb_x_propb_lenres_replay; 2300Sstevel@tonic-gate uint8_t sadb_x_propb_lenres_eres; 2310Sstevel@tonic-gate uint16_t sadb_x_propb_lenres_numecombs; 2320Sstevel@tonic-gate } sadb_x_propb_lenres; 2330Sstevel@tonic-gate struct { 2340Sstevel@tonic-gate uint8_t sadb_x_propb_oldres_replay; 2350Sstevel@tonic-gate uint8_t sadb_x_propb_oldres_reserved[3]; 2360Sstevel@tonic-gate } sadb_x_propb_oldres; 2370Sstevel@tonic-gate } sadb_x_propb_u; 2380Sstevel@tonic-gate #define sadb_x_propb_replay \ 2390Sstevel@tonic-gate sadb_x_propb_u.sadb_x_propb_lenres.sadb_x_propb_lenres_replay 2400Sstevel@tonic-gate #define sadb_x_propb_reserved \ 2410Sstevel@tonic-gate sadb_x_propb_u.sadb_x_propb_oldres.sadb_x_propb_oldres_reserved 2420Sstevel@tonic-gate #define sadb_x_propb_ereserved \ 2430Sstevel@tonic-gate sadb_x_propb_u.sadb_x_propb_lenres.sadb_x_propb_lenres_eres 2440Sstevel@tonic-gate #define sadb_x_propb_numecombs \ 2450Sstevel@tonic-gate sadb_x_propb_u.sadb_x_propb_lenres.sadb_x_propb_lenres_numecombs 2460Sstevel@tonic-gate /* Followed by sadb_comb[] array or sadb_ecomb[] array. */ 2470Sstevel@tonic-gate } sadb_x_propbase_t; 2480Sstevel@tonic-gate 2490Sstevel@tonic-gate /* Now, the actual sadb_prop structure, which will have alignment in it! */ 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate typedef struct sadb_prop { 2520Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 2530Sstevel@tonic-gate union { 2540Sstevel@tonic-gate sadb_x_propbase_t sadb_x_prop_actual; 2550Sstevel@tonic-gate uint64_t sadb_x_prop_alignment; 2560Sstevel@tonic-gate } sadb_x_prop_u; 2570Sstevel@tonic-gate #define sadb_prop_len sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_len 2580Sstevel@tonic-gate #define sadb_prop_exttype sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_exttype 2590Sstevel@tonic-gate #define sadb_prop_replay sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_replay 2600Sstevel@tonic-gate #define sadb_prop_reserved \ 2610Sstevel@tonic-gate sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_reserved 2620Sstevel@tonic-gate #define sadb_x_prop_ereserved \ 2630Sstevel@tonic-gate sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_ereserved 2640Sstevel@tonic-gate #define sadb_x_prop_numecombs \ 2650Sstevel@tonic-gate sadb_x_prop_u.sadb_x_prop_actual.sadb_x_propb_numecombs 2660Sstevel@tonic-gate } sadb_prop_t; 2670Sstevel@tonic-gate 2680Sstevel@tonic-gate /* 2690Sstevel@tonic-gate * This is a proposed combination. Many of these can follow a proposal 2700Sstevel@tonic-gate * extension. Already 64-bit aligned thanks to uint64_t fields. 2710Sstevel@tonic-gate */ 2720Sstevel@tonic-gate 2730Sstevel@tonic-gate typedef struct sadb_comb { 2740Sstevel@tonic-gate uint8_t sadb_comb_auth; /* Authentication algorithm */ 2750Sstevel@tonic-gate uint8_t sadb_comb_encrypt; /* Encryption algorithm */ 2760Sstevel@tonic-gate uint16_t sadb_comb_flags; /* Comb. flags (e.g. PFS) */ 2770Sstevel@tonic-gate uint16_t sadb_comb_auth_minbits; /* Bit strengths for auth */ 2780Sstevel@tonic-gate uint16_t sadb_comb_auth_maxbits; 2790Sstevel@tonic-gate uint16_t sadb_comb_encrypt_minbits; /* Bit strengths for encrypt */ 2800Sstevel@tonic-gate uint16_t sadb_comb_encrypt_maxbits; 2810Sstevel@tonic-gate uint32_t sadb_comb_reserved; 2820Sstevel@tonic-gate uint32_t sadb_comb_soft_allocations; /* Lifetime proposals for */ 2830Sstevel@tonic-gate uint32_t sadb_comb_hard_allocations; /* this combination. */ 2840Sstevel@tonic-gate uint64_t sadb_comb_soft_bytes; 2850Sstevel@tonic-gate uint64_t sadb_comb_hard_bytes; 2860Sstevel@tonic-gate uint64_t sadb_comb_soft_addtime; 2870Sstevel@tonic-gate uint64_t sadb_comb_hard_addtime; 2880Sstevel@tonic-gate uint64_t sadb_comb_soft_usetime; 2890Sstevel@tonic-gate uint64_t sadb_comb_hard_usetime; 2900Sstevel@tonic-gate } sadb_comb_t; 2910Sstevel@tonic-gate 2920Sstevel@tonic-gate /* 2930Sstevel@tonic-gate * An extended combination that can comprise of many SA types. 2940Sstevel@tonic-gate * A single combination has algorithms and SA types locked. 2950Sstevel@tonic-gate * These are represented by algorithm descriptors, the second structure 2960Sstevel@tonic-gate * in the list. For example, if the EACQUIRE requests AH(MD5) + ESP(DES/null) 2970Sstevel@tonic-gate * _or_ ESP(DES/MD5), it would have two combinations: 2980Sstevel@tonic-gate * 2990Sstevel@tonic-gate * COMB: algdes(AH, AUTH, MD5), algdes(ESP, CRYPT, DES) 3000Sstevel@tonic-gate * COMB: algdes(ESP, AUTH, MD5), algdes(ESP, CRYPT, DES) 3010Sstevel@tonic-gate * 3020Sstevel@tonic-gate * If an SA type supports an algorithm type, and there's no descriptor, 3030Sstevel@tonic-gate * assume it requires NONE, just like it were explicitly stated. 3040Sstevel@tonic-gate * (This includes ESP NULL encryption, BTW.) 3050Sstevel@tonic-gate * 3060Sstevel@tonic-gate * Already 64-bit aligned thanks to uint64_t fields. 3070Sstevel@tonic-gate */ 3080Sstevel@tonic-gate 3090Sstevel@tonic-gate typedef struct sadb_x_ecomb { 3100Sstevel@tonic-gate uint8_t sadb_x_ecomb_numalgs; 3110Sstevel@tonic-gate uint8_t sadb_x_ecomb_reserved; 3120Sstevel@tonic-gate uint16_t sadb_x_ecomb_flags; /* E.g. PFS? */ 3130Sstevel@tonic-gate uint32_t sadb_x_ecomb_reserved2; 3140Sstevel@tonic-gate uint32_t sadb_x_ecomb_soft_allocations; 3150Sstevel@tonic-gate uint32_t sadb_x_ecomb_hard_allocations; 3160Sstevel@tonic-gate uint64_t sadb_x_ecomb_soft_bytes; 3170Sstevel@tonic-gate uint64_t sadb_x_ecomb_hard_bytes; 3180Sstevel@tonic-gate uint64_t sadb_x_ecomb_soft_addtime; 3190Sstevel@tonic-gate uint64_t sadb_x_ecomb_hard_addtime; 3200Sstevel@tonic-gate uint64_t sadb_x_ecomb_soft_usetime; 3210Sstevel@tonic-gate uint64_t sadb_x_ecomb_hard_usetime; 3220Sstevel@tonic-gate } sadb_x_ecomb_t; 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate typedef struct sadb_x_algdesc { 3250Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 3260Sstevel@tonic-gate union { 3270Sstevel@tonic-gate struct { 3280Sstevel@tonic-gate uint8_t sadb_x_algdesc_usatype; /* ESP, AH, etc. */ 3290Sstevel@tonic-gate uint8_t sadb_x_algdesc_ualgtype; /* AUTH, CRYPT, COMP */ 3300Sstevel@tonic-gate uint8_t sadb_x_algdesc_ualg; /* 3DES, MD5, etc. */ 3310Sstevel@tonic-gate uint8_t sadb_x_algdesc_ureserved; 3320Sstevel@tonic-gate uint16_t sadb_x_algdesc_uminbits; /* Bit strengths. */ 3330Sstevel@tonic-gate uint16_t sadb_x_algdesc_umaxbits; 3340Sstevel@tonic-gate } sadb_x_algdesc_actual; 3350Sstevel@tonic-gate uint64_t sadb_x_algdesc_alignment; 3360Sstevel@tonic-gate } sadb_x_algdesc_u; 3370Sstevel@tonic-gate #define sadb_x_algdesc_satype \ 3380Sstevel@tonic-gate sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_usatype 3390Sstevel@tonic-gate #define sadb_x_algdesc_algtype \ 3400Sstevel@tonic-gate sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_ualgtype 3410Sstevel@tonic-gate #define sadb_x_algdesc_alg \ 3420Sstevel@tonic-gate sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_ualg 3430Sstevel@tonic-gate #define sadb_x_algdesc_reserved \ 3440Sstevel@tonic-gate sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_ureserved 3450Sstevel@tonic-gate #define sadb_x_algdesc_minbits \ 3460Sstevel@tonic-gate sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_uminbits 3470Sstevel@tonic-gate #define sadb_x_algdesc_maxbits \ 3480Sstevel@tonic-gate sadb_x_algdesc_u.sadb_x_algdesc_actual.sadb_x_algdesc_umaxbits 3490Sstevel@tonic-gate } sadb_x_algdesc_t; 3500Sstevel@tonic-gate 3510Sstevel@tonic-gate /* 3520Sstevel@tonic-gate * When key mgmt. registers with the kernel, the kernel will tell key mgmt. 3530Sstevel@tonic-gate * its supported algorithms. 3540Sstevel@tonic-gate */ 3550Sstevel@tonic-gate 3560Sstevel@tonic-gate typedef struct sadb_supported { 3570Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 3580Sstevel@tonic-gate union { 3590Sstevel@tonic-gate struct { 3600Sstevel@tonic-gate uint16_t sadb_x_supported_ulen; 3610Sstevel@tonic-gate uint16_t sadb_x_supported_uexttype; 3620Sstevel@tonic-gate uint32_t sadb_x_supported_ureserved; 3630Sstevel@tonic-gate } sadb_x_supported_actual; 3640Sstevel@tonic-gate uint64_t sadb_x_supported_alignment; 3650Sstevel@tonic-gate } sadb_x_supported_u; 3660Sstevel@tonic-gate #define sadb_supported_len \ 3670Sstevel@tonic-gate sadb_x_supported_u.sadb_x_supported_actual.sadb_x_supported_ulen 3680Sstevel@tonic-gate #define sadb_supported_exttype \ 3690Sstevel@tonic-gate sadb_x_supported_u.sadb_x_supported_actual.sadb_x_supported_uexttype 3700Sstevel@tonic-gate #define sadb_supported_reserved \ 3710Sstevel@tonic-gate sadb_x_supported_u.sadb_x_supported_actual.sadb_x_supported_ureserved 3720Sstevel@tonic-gate } sadb_supported_t; 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate /* First, a base structure... */ 3750Sstevel@tonic-gate typedef struct sadb_x_algb { 3760Sstevel@tonic-gate uint8_t sadb_x_algb_id; /* Algorithm type. */ 3770Sstevel@tonic-gate uint8_t sadb_x_algb_ivlen; /* IV len, in bits */ 3780Sstevel@tonic-gate uint16_t sadb_x_algb_minbits; /* Min. key len (in bits) */ 3790Sstevel@tonic-gate uint16_t sadb_x_algb_maxbits; /* Max. key length */ 3800Sstevel@tonic-gate union { 3810Sstevel@tonic-gate uint16_t sadb_x_algb_ureserved; 3820Sstevel@tonic-gate uint8_t sadb_x_algb_udefaults[2]; 3830Sstevel@tonic-gate } sadb_x_algb_union; 3840Sstevel@tonic-gate 3850Sstevel@tonic-gate #define sadb_x_algb_reserved sadb_x_algb_union.sadb_x_algb_ureserved 3860Sstevel@tonic-gate #define sadb_x_algb_increment sadb_x_algb_union.sadb_x_algb_udefaults[0] 3870Sstevel@tonic-gate #define sadb_x_algb_defincr sadb_x_algb_union.sadb_x_algb_udefaults[1] 3880Sstevel@tonic-gate /* 3890Sstevel@tonic-gate * alg_increment: the number of bits from a key length to the next 3900Sstevel@tonic-gate * alg_defincr: the number of increments from the smallest possible 3910Sstevel@tonic-gate * key to the default key length 3920Sstevel@tonic-gate */ 3930Sstevel@tonic-gate } sadb_x_algb_t; 3940Sstevel@tonic-gate /* useful macros for dealing with defincr */ 3950Sstevel@tonic-gate #define SADB_ALG_DEFAULT_LEN(min, incr, defincr) ((min) + ((defincr) * (incr))) 3960Sstevel@tonic-gate #define SADB_ALG_DEFAULT_INCR(min, incr, default) (((default) - (min)) / (incr)) 3970Sstevel@tonic-gate 3980Sstevel@tonic-gate /* Now, the actual sadb_alg structure, which will have alignment in it. */ 3990Sstevel@tonic-gate typedef struct sadb_alg { 4000Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 4010Sstevel@tonic-gate union { 4020Sstevel@tonic-gate sadb_x_algb_t sadb_x_alg_actual; 4030Sstevel@tonic-gate uint64_t sadb_x_alg_alignment; 4040Sstevel@tonic-gate } sadb_x_alg_u; 4050Sstevel@tonic-gate #define sadb_alg_id sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_id 4060Sstevel@tonic-gate #define sadb_alg_ivlen sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_ivlen 4070Sstevel@tonic-gate #define sadb_alg_minbits sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_minbits 4080Sstevel@tonic-gate #define sadb_alg_maxbits sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_maxbits 4090Sstevel@tonic-gate #define sadb_alg_reserved sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_reserved 4100Sstevel@tonic-gate #define sadb_x_alg_increment \ 4110Sstevel@tonic-gate sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_increment 4120Sstevel@tonic-gate #define sadb_x_alg_defincr sadb_x_alg_u.sadb_x_alg_actual.sadb_x_algb_defincr 4130Sstevel@tonic-gate } sadb_alg_t; 4140Sstevel@tonic-gate 4150Sstevel@tonic-gate /* 4160Sstevel@tonic-gate * If key mgmt. needs an SPI in a range (including 0 to 0xFFFFFFFF), it 4170Sstevel@tonic-gate * asks the kernel with this extension in the SADB_GETSPI message. 4180Sstevel@tonic-gate */ 4190Sstevel@tonic-gate 4200Sstevel@tonic-gate typedef struct sadb_spirange { 4210Sstevel@tonic-gate uint16_t sadb_spirange_len; 4220Sstevel@tonic-gate uint16_t sadb_spirange_exttype; /* SPI_RANGE */ 4230Sstevel@tonic-gate uint32_t sadb_spirange_min; 4240Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 4250Sstevel@tonic-gate union { 4260Sstevel@tonic-gate struct { 4270Sstevel@tonic-gate uint32_t sadb_x_spirange_umax; 4280Sstevel@tonic-gate uint32_t sadb_x_spirange_ureserved; 4290Sstevel@tonic-gate } sadb_x_spirange_actual; 4300Sstevel@tonic-gate uint64_t sadb_x_spirange_alignment; 4310Sstevel@tonic-gate } sadb_x_spirange_u; 4320Sstevel@tonic-gate #define sadb_spirange_max \ 4330Sstevel@tonic-gate sadb_x_spirange_u.sadb_x_spirange_actual.sadb_x_spirange_umax 4340Sstevel@tonic-gate #define sadb_spirange_reserved \ 4350Sstevel@tonic-gate sadb_x_spirange_u.sadb_x_spirange_actual.sadb_x_spirange_ureserved 4360Sstevel@tonic-gate } sadb_spirange_t; 4370Sstevel@tonic-gate 4380Sstevel@tonic-gate /* 4390Sstevel@tonic-gate * For the "extended REGISTER" which'll tell the kernel to send me 4400Sstevel@tonic-gate * "extended ACQUIREs". 4410Sstevel@tonic-gate */ 4420Sstevel@tonic-gate 4430Sstevel@tonic-gate typedef struct sadb_x_ereg { 4440Sstevel@tonic-gate /* Union is for guaranteeing 64-bit alignment. */ 4450Sstevel@tonic-gate union { 4460Sstevel@tonic-gate struct { 4470Sstevel@tonic-gate uint16_t sadb_x_ereg_ulen; 4480Sstevel@tonic-gate uint16_t sadb_x_ereg_uexttype; /* X_EREG */ 4490Sstevel@tonic-gate /* Array of SA types, 0-terminated. */ 4500Sstevel@tonic-gate uint8_t sadb_x_ereg_usatypes[4]; 4510Sstevel@tonic-gate } sadb_x_ereg_actual; 4520Sstevel@tonic-gate uint64_t sadb_x_ereg_alignment; 4530Sstevel@tonic-gate } sadb_x_ereg_u; 4540Sstevel@tonic-gate #define sadb_x_ereg_len \ 4550Sstevel@tonic-gate sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_ulen 4560Sstevel@tonic-gate #define sadb_x_ereg_exttype \ 4570Sstevel@tonic-gate sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_uexttype 4580Sstevel@tonic-gate #define sadb_x_ereg_satypes \ 4590Sstevel@tonic-gate sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_usatypes 4600Sstevel@tonic-gate } sadb_x_ereg_t; 4610Sstevel@tonic-gate 4620Sstevel@tonic-gate /* 4630Sstevel@tonic-gate * For conveying a Key Management Cookie with SADB_GETSPI, SADB_ADD, 4640Sstevel@tonic-gate * SADB_ACQUIRE, or SADB_X_INVERSE_ACQUIRE. 4650Sstevel@tonic-gate */ 4660Sstevel@tonic-gate 4670Sstevel@tonic-gate typedef struct sadb_x_kmc { 4680Sstevel@tonic-gate uint16_t sadb_x_kmc_len; 4690Sstevel@tonic-gate uint16_t sadb_x_kmc_exttype; /* X_KM_COOKIE */ 4700Sstevel@tonic-gate uint32_t sadb_x_kmc_proto; /* KM protocol */ 4710Sstevel@tonic-gate union { 4720Sstevel@tonic-gate struct { 4730Sstevel@tonic-gate uint32_t sadb_x_kmc_ucookie; /* KMP-specific */ 4740Sstevel@tonic-gate uint32_t sadb_x_kmc_ureserved; /* Must be zero */ 4750Sstevel@tonic-gate } sadb_x_kmc_actual; 4760Sstevel@tonic-gate uint64_t sadb_x_kmc_alignment; 4770Sstevel@tonic-gate } sadb_x_kmc_u; 4780Sstevel@tonic-gate #define sadb_x_kmc_cookie sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ucookie 4790Sstevel@tonic-gate #define sadb_x_kmc_reserved sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ureserved 4800Sstevel@tonic-gate } sadb_x_kmc_t; 4810Sstevel@tonic-gate 4826668Smarkfen typedef struct sadb_x_pair { 4836668Smarkfen union { 4846668Smarkfen /* Union is for guaranteeing 64-bit alignment. */ 4856668Smarkfen struct { 4866668Smarkfen uint16_t sadb_x_pair_ulen; 4876668Smarkfen uint16_t sadb_x_pair_uexttype; 4886668Smarkfen uint32_t sadb_x_pair_uspi; /* SPI of paired SA */ 4896668Smarkfen } sadb_x_pair_actual; 4906668Smarkfen uint64_t sadb_x_ext_alignment; 4916668Smarkfen } sadb_x_pair_u; 4926668Smarkfen #define sadb_x_pair_len sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_ulen 4936668Smarkfen #define sadb_x_pair_exttype \ 4946668Smarkfen sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uexttype 4956668Smarkfen #define sadb_x_pair_spi sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uspi 4966668Smarkfen } sadb_x_pair_t; 4970Sstevel@tonic-gate 4980Sstevel@tonic-gate /* 4997749SThejaswini.Singarajipura@Sun.COM * For the Sequence numbers to be used with SADB_DUMP, SADB_GET, SADB_UPDATE. 5007749SThejaswini.Singarajipura@Sun.COM */ 5017749SThejaswini.Singarajipura@Sun.COM 5027749SThejaswini.Singarajipura@Sun.COM typedef struct sadb_x_replay_ctr { 5037749SThejaswini.Singarajipura@Sun.COM uint16_t sadb_x_rc_len; 5047749SThejaswini.Singarajipura@Sun.COM uint16_t sadb_x_rc_exttype; 5057749SThejaswini.Singarajipura@Sun.COM uint32_t sadb_x_rc_replay32; /* For 240x SAs. */ 5067749SThejaswini.Singarajipura@Sun.COM uint64_t sadb_x_rc_replay64; /* For 430x SAs. */ 5077749SThejaswini.Singarajipura@Sun.COM } sadb_x_replay_ctr_t; 5087749SThejaswini.Singarajipura@Sun.COM 5097749SThejaswini.Singarajipura@Sun.COM /* 5107749SThejaswini.Singarajipura@Sun.COM * For extended DUMP request. Dumps the SAs which were idle for 5117749SThejaswini.Singarajipura@Sun.COM * longer than the timeout specified. 5127749SThejaswini.Singarajipura@Sun.COM */ 5137749SThejaswini.Singarajipura@Sun.COM 5147749SThejaswini.Singarajipura@Sun.COM typedef struct sadb_x_edump { 5157749SThejaswini.Singarajipura@Sun.COM uint16_t sadb_x_edump_len; 5167749SThejaswini.Singarajipura@Sun.COM uint16_t sadb_x_edump_exttype; 5177749SThejaswini.Singarajipura@Sun.COM uint32_t sadb_x_edump_reserved; 5187749SThejaswini.Singarajipura@Sun.COM uint64_t sadb_x_edump_timeout; 5197749SThejaswini.Singarajipura@Sun.COM } sadb_x_edump_t; 5207749SThejaswini.Singarajipura@Sun.COM 5217749SThejaswini.Singarajipura@Sun.COM /* 5220Sstevel@tonic-gate * Base message types. 5230Sstevel@tonic-gate */ 5240Sstevel@tonic-gate 5250Sstevel@tonic-gate #define SADB_RESERVED 0 5260Sstevel@tonic-gate #define SADB_GETSPI 1 5270Sstevel@tonic-gate #define SADB_UPDATE 2 5280Sstevel@tonic-gate #define SADB_ADD 3 5290Sstevel@tonic-gate #define SADB_DELETE 4 5300Sstevel@tonic-gate #define SADB_GET 5 5310Sstevel@tonic-gate #define SADB_ACQUIRE 6 5320Sstevel@tonic-gate #define SADB_REGISTER 7 5330Sstevel@tonic-gate #define SADB_EXPIRE 8 5340Sstevel@tonic-gate #define SADB_FLUSH 9 5350Sstevel@tonic-gate #define SADB_DUMP 10 /* not used normally */ 5360Sstevel@tonic-gate #define SADB_X_PROMISC 11 5370Sstevel@tonic-gate #define SADB_X_INVERSE_ACQUIRE 12 5386668Smarkfen #define SADB_X_UPDATEPAIR 13 5397749SThejaswini.Singarajipura@Sun.COM #define SADB_X_DELPAIR 14 5407749SThejaswini.Singarajipura@Sun.COM #define SADB_X_DELPAIR_STATE 15 5417749SThejaswini.Singarajipura@Sun.COM #define SADB_MAX 15 5420Sstevel@tonic-gate 5430Sstevel@tonic-gate /* 5440Sstevel@tonic-gate * SA flags 5450Sstevel@tonic-gate */ 5460Sstevel@tonic-gate 5470Sstevel@tonic-gate #define SADB_SAFLAGS_PFS 0x1 /* Perfect forward secrecy? */ 5480Sstevel@tonic-gate #define SADB_SAFLAGS_NOREPLAY 0x2 /* Replay field NOT PRESENT. */ 5490Sstevel@tonic-gate 5500Sstevel@tonic-gate /* Below flags are used by this implementation. Grow from left-to-right. */ 5510Sstevel@tonic-gate #define SADB_X_SAFLAGS_USED 0x80000000 /* SA used/not used */ 5520Sstevel@tonic-gate #define SADB_X_SAFLAGS_UNIQUE 0x40000000 /* SA unique/reusable */ 5530Sstevel@tonic-gate #define SADB_X_SAFLAGS_AALG1 0x20000000 /* Auth-alg specific flag 1 */ 5540Sstevel@tonic-gate #define SADB_X_SAFLAGS_AALG2 0x10000000 /* Auth-alg specific flag 2 */ 5550Sstevel@tonic-gate #define SADB_X_SAFLAGS_EALG1 0x8000000 /* Encr-alg specific flag 1 */ 5560Sstevel@tonic-gate #define SADB_X_SAFLAGS_EALG2 0x4000000 /* Encr-alg specific flag 2 */ 5570Sstevel@tonic-gate #define SADB_X_SAFLAGS_KM1 0x2000000 /* Key mgmt. specific flag 1 */ 5580Sstevel@tonic-gate #define SADB_X_SAFLAGS_KM2 0x1000000 /* Key mgmt. specific flag 2 */ 5590Sstevel@tonic-gate #define SADB_X_SAFLAGS_KM3 0x800000 /* Key mgmt. specific flag 3 */ 5600Sstevel@tonic-gate #define SADB_X_SAFLAGS_KM4 0x400000 /* Key mgmt. specific flag 4 */ 5613055Sdanmcd #define SADB_X_SAFLAGS_KRES1 0x200000 /* Reserved by the kernel */ 5620Sstevel@tonic-gate #define SADB_X_SAFLAGS_NATT_LOC 0x100000 /* this has a natted src SA */ 5630Sstevel@tonic-gate #define SADB_X_SAFLAGS_NATT_REM 0x80000 /* this has a natted dst SA */ 5643055Sdanmcd #define SADB_X_SAFLAGS_KRES2 0x40000 /* Reserved by the kernel */ 5653055Sdanmcd #define SADB_X_SAFLAGS_TUNNEL 0x20000 /* tunnel mode */ 5666668Smarkfen #define SADB_X_SAFLAGS_PAIRED 0x10000 /* inbound/outbound pair */ 5676668Smarkfen #define SADB_X_SAFLAGS_OUTBOUND 0x8000 /* SA direction bit */ 5686668Smarkfen #define SADB_X_SAFLAGS_INBOUND 0x4000 /* SA direction bit */ 5697066Sdanmcd #define SADB_X_SAFLAGS_NATTED 0x1000 /* Local node is behind a NAT */ 5703055Sdanmcd 5713055Sdanmcd #define SADB_X_SAFLAGS_KRES \ 5723055Sdanmcd SADB_X_SAFLAGS_KRES1 | SADB_X_SAFLAGS_KRES2 5733055Sdanmcd 5740Sstevel@tonic-gate /* 5750Sstevel@tonic-gate * SA state. 5760Sstevel@tonic-gate */ 5770Sstevel@tonic-gate 5787749SThejaswini.Singarajipura@Sun.COM #define SADB_SASTATE_LARVAL 0 5797749SThejaswini.Singarajipura@Sun.COM #define SADB_SASTATE_MATURE 1 5807749SThejaswini.Singarajipura@Sun.COM #define SADB_SASTATE_DYING 2 5817749SThejaswini.Singarajipura@Sun.COM #define SADB_SASTATE_DEAD 3 5827749SThejaswini.Singarajipura@Sun.COM #define SADB_X_SASTATE_ACTIVE_ELSEWHERE 4 5837749SThejaswini.Singarajipura@Sun.COM #define SADB_X_SASTATE_IDLE 5 5847749SThejaswini.Singarajipura@Sun.COM #define SADB_X_SASTATE_ACTIVE 6 5850Sstevel@tonic-gate 5867749SThejaswini.Singarajipura@Sun.COM #define SADB_SASTATE_MAX 6 5870Sstevel@tonic-gate 5880Sstevel@tonic-gate /* 5890Sstevel@tonic-gate * SA type. Gaps are present in the number space because (for the time being) 5900Sstevel@tonic-gate * these types correspond to the SA types in the IPsec DOI document. 5910Sstevel@tonic-gate */ 5920Sstevel@tonic-gate 5930Sstevel@tonic-gate #define SADB_SATYPE_UNSPEC 0 5940Sstevel@tonic-gate #define SADB_SATYPE_AH 2 /* RFC-1826 */ 5950Sstevel@tonic-gate #define SADB_SATYPE_ESP 3 /* RFC-1827 */ 5960Sstevel@tonic-gate #define SADB_SATYPE_RSVP 5 /* RSVP Authentication */ 5970Sstevel@tonic-gate #define SADB_SATYPE_OSPFV2 6 /* OSPFv2 Authentication */ 5980Sstevel@tonic-gate #define SADB_SATYPE_RIPV2 7 /* RIPv2 Authentication */ 5990Sstevel@tonic-gate #define SADB_SATYPE_MIP 8 /* Mobile IPv4 Authentication */ 6000Sstevel@tonic-gate 6010Sstevel@tonic-gate #define SADB_SATYPE_MAX 8 6020Sstevel@tonic-gate 6030Sstevel@tonic-gate /* 6040Sstevel@tonic-gate * Algorithm types. Gaps are present because (for the time being) these types 6050Sstevel@tonic-gate * correspond to the SA types in the IPsec DOI document. 6060Sstevel@tonic-gate * 6070Sstevel@tonic-gate * NOTE: These are numbered to play nice with the IPsec DOI. That's why 6080Sstevel@tonic-gate * there are gaps. 6090Sstevel@tonic-gate */ 6100Sstevel@tonic-gate 6110Sstevel@tonic-gate /* Authentication algorithms */ 6120Sstevel@tonic-gate #define SADB_AALG_NONE 0 6130Sstevel@tonic-gate #define SADB_AALG_MD5HMAC 2 6140Sstevel@tonic-gate #define SADB_AALG_SHA1HMAC 3 6156126Sdanmcd #define SADB_AALG_SHA256HMAC 5 6166126Sdanmcd #define SADB_AALG_SHA384HMAC 6 6176126Sdanmcd #define SADB_AALG_SHA512HMAC 7 6180Sstevel@tonic-gate 6196126Sdanmcd #define SADB_AALG_MAX 7 6200Sstevel@tonic-gate 6210Sstevel@tonic-gate /* Encryption algorithms */ 6220Sstevel@tonic-gate #define SADB_EALG_NONE 0 6230Sstevel@tonic-gate #define SADB_EALG_DESCBC 2 6240Sstevel@tonic-gate #define SADB_EALG_3DESCBC 3 6250Sstevel@tonic-gate #define SADB_EALG_BLOWFISH 7 6260Sstevel@tonic-gate #define SADB_EALG_NULL 11 6270Sstevel@tonic-gate #define SADB_EALG_AES 12 6280Sstevel@tonic-gate #define SADB_EALG_MAX 12 6290Sstevel@tonic-gate 6300Sstevel@tonic-gate /* 6310Sstevel@tonic-gate * Extension header values. 6320Sstevel@tonic-gate */ 6330Sstevel@tonic-gate 6340Sstevel@tonic-gate #define SADB_EXT_RESERVED 0 6350Sstevel@tonic-gate 6360Sstevel@tonic-gate #define SADB_EXT_SA 1 6370Sstevel@tonic-gate #define SADB_EXT_LIFETIME_CURRENT 2 6380Sstevel@tonic-gate #define SADB_EXT_LIFETIME_HARD 3 6390Sstevel@tonic-gate #define SADB_EXT_LIFETIME_SOFT 4 6400Sstevel@tonic-gate #define SADB_EXT_ADDRESS_SRC 5 6410Sstevel@tonic-gate #define SADB_EXT_ADDRESS_DST 6 6423055Sdanmcd /* These two are synonyms. */ 6430Sstevel@tonic-gate #define SADB_EXT_ADDRESS_PROXY 7 6443055Sdanmcd #define SADB_X_EXT_ADDRESS_INNER_SRC SADB_EXT_ADDRESS_PROXY 6450Sstevel@tonic-gate #define SADB_EXT_KEY_AUTH 8 6460Sstevel@tonic-gate #define SADB_EXT_KEY_ENCRYPT 9 6470Sstevel@tonic-gate #define SADB_EXT_IDENTITY_SRC 10 6480Sstevel@tonic-gate #define SADB_EXT_IDENTITY_DST 11 6490Sstevel@tonic-gate #define SADB_EXT_SENSITIVITY 12 6500Sstevel@tonic-gate #define SADB_EXT_PROPOSAL 13 6510Sstevel@tonic-gate #define SADB_EXT_SUPPORTED_AUTH 14 6520Sstevel@tonic-gate #define SADB_EXT_SUPPORTED_ENCRYPT 15 6530Sstevel@tonic-gate #define SADB_EXT_SPIRANGE 16 6540Sstevel@tonic-gate #define SADB_X_EXT_EREG 17 6550Sstevel@tonic-gate #define SADB_X_EXT_EPROP 18 6560Sstevel@tonic-gate #define SADB_X_EXT_KM_COOKIE 19 6570Sstevel@tonic-gate #define SADB_X_EXT_ADDRESS_NATT_LOC 20 6580Sstevel@tonic-gate #define SADB_X_EXT_ADDRESS_NATT_REM 21 6593055Sdanmcd #define SADB_X_EXT_ADDRESS_INNER_DST 22 6606668Smarkfen #define SADB_X_EXT_PAIR 23 6617749SThejaswini.Singarajipura@Sun.COM #define SADB_X_EXT_REPLAY_VALUE 24 6627749SThejaswini.Singarajipura@Sun.COM #define SADB_X_EXT_EDUMP 25 6637749SThejaswini.Singarajipura@Sun.COM #define SADB_X_EXT_LIFETIME_IDLE 26 6640Sstevel@tonic-gate 6657749SThejaswini.Singarajipura@Sun.COM #define SADB_EXT_MAX 26 6660Sstevel@tonic-gate 6670Sstevel@tonic-gate /* 6680Sstevel@tonic-gate * Identity types. 6690Sstevel@tonic-gate */ 6700Sstevel@tonic-gate 6710Sstevel@tonic-gate #define SADB_IDENTTYPE_RESERVED 0 6720Sstevel@tonic-gate 6730Sstevel@tonic-gate /* 6740Sstevel@tonic-gate * For PREFIX and ADDR_RANGE, use the AF of the PROXY if present, or the SRC 6750Sstevel@tonic-gate * if not present. 6760Sstevel@tonic-gate */ 6770Sstevel@tonic-gate #define SADB_IDENTTYPE_PREFIX 1 6780Sstevel@tonic-gate #define SADB_IDENTTYPE_FQDN 2 /* Fully qualified domain name. */ 6790Sstevel@tonic-gate #define SADB_IDENTTYPE_USER_FQDN 3 /* e.g. root@domain.com */ 6800Sstevel@tonic-gate #define SADB_X_IDENTTYPE_DN 4 /* ASN.1 DER Distinguished Name. */ 6810Sstevel@tonic-gate #define SADB_X_IDENTTYPE_GN 5 /* ASN.1 DER Generic Name. */ 6820Sstevel@tonic-gate #define SADB_X_IDENTTYPE_KEY_ID 6 /* Generic KEY ID. */ 6830Sstevel@tonic-gate #define SADB_X_IDENTTYPE_ADDR_RANGE 7 6840Sstevel@tonic-gate 6850Sstevel@tonic-gate #define SADB_IDENTTYPE_MAX 7 6860Sstevel@tonic-gate 6870Sstevel@tonic-gate /* 6880Sstevel@tonic-gate * Protection DOI values for the SENSITIVITY extension. There are no values 6890Sstevel@tonic-gate * currently, so the MAX is the only non-zero value available. 6900Sstevel@tonic-gate */ 6910Sstevel@tonic-gate 6920Sstevel@tonic-gate #define SADB_DPD_NONE 0 6930Sstevel@tonic-gate 6940Sstevel@tonic-gate #define SADB_DPD_MAX 1 6950Sstevel@tonic-gate 6960Sstevel@tonic-gate /* 6970Sstevel@tonic-gate * Diagnostic codes. These supplement error messages. Be sure to 6980Sstevel@tonic-gate * update libipsecutil's keysock_diag() if you change any of these. 6990Sstevel@tonic-gate */ 7000Sstevel@tonic-gate 7010Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_PRESET -1 /* Internal value. */ 7020Sstevel@tonic-gate 7030Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_NONE 0 7040Sstevel@tonic-gate 7050Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_UNKNOWN_MSG 1 7060Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_UNKNOWN_EXT 2 7070Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_EXTLEN 3 7080Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_UNKNOWN_SATYPE 4 7090Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_SATYPE_NEEDED 5 7100Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_NO_SADBS 6 7110Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_NO_EXT 7 7120Sstevel@tonic-gate /* Bad address family value */ 7130Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_SRC_AF 8 7140Sstevel@tonic-gate /* in sockaddr->sa_family. */ 7150Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_DST_AF 9 7163055Sdanmcd /* These two are synonyms. */ 7170Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_PROXY_AF 10 7183055Sdanmcd #define SADB_X_DIAGNOSTIC_BAD_INNER_SRC_AF 10 7193055Sdanmcd 7200Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_AF_MISMATCH 11 7210Sstevel@tonic-gate 7220Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_SRC 12 7230Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_DST 13 7240Sstevel@tonic-gate 7250Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_ALLOC_HSERR 14 7260Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BYTES_HSERR 15 7270Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_ADDTIME_HSERR 16 7280Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_USETIME_HSERR 17 7290Sstevel@tonic-gate 7300Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_SRC 18 7310Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_DST 19 7320Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_SA 20 7330Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_EKEY 21 7340Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_AKEY 22 7350Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_RANGE 23 7360Sstevel@tonic-gate 7370Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_SRC 24 7380Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_DST 25 7390Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_SA 26 7400Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_EKEY 27 7410Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_AKEY 28 7420Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_RANGE 29 7430Sstevel@tonic-gate 7440Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_SRC 30 7450Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_DST 31 7460Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_SA 32 7470Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_EKEY 33 7480Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_AKEY 34 7490Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_RANGE 35 7500Sstevel@tonic-gate 7510Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_AKEY_PRESENT 36 7520Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_EKEY_PRESENT 37 7530Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_PROP_PRESENT 38 7540Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_SUPP_PRESENT 39 7550Sstevel@tonic-gate 7560Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_AALG 40 7570Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_EALG 41 7580Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_SAFLAGS 42 7590Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_SASTATE 43 7600Sstevel@tonic-gate 7610Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_AKEYBITS 44 7620Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_BAD_EKEYBITS 45 7630Sstevel@tonic-gate 7640Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_ENCR_NOTSUPP 46 7650Sstevel@tonic-gate 7660Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_WEAK_EKEY 47 7670Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_WEAK_AKEY 48 7680Sstevel@tonic-gate 7690Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_KMP 49 7700Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_KMC 50 7710Sstevel@tonic-gate 7720Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_NATT_LOC 51 7730Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MISSING_NATT_REM 52 7740Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_NATT_LOC 53 7750Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_NATT_REM 54 7760Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_NATT_LOC 55 7770Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_MALFORMED_NATT_REM 56 7780Sstevel@tonic-gate #define SADB_X_DIAGNOSTIC_DUPLICATE_NATT_PORTS 57 7793055Sdanmcd 7803055Sdanmcd #define SADB_X_DIAGNOSTIC_MISSING_INNER_SRC 58 7813055Sdanmcd #define SADB_X_DIAGNOSTIC_MISSING_INNER_DST 59 7823055Sdanmcd #define SADB_X_DIAGNOSTIC_DUPLICATE_INNER_SRC 60 7833055Sdanmcd #define SADB_X_DIAGNOSTIC_DUPLICATE_INNER_DST 61 7843055Sdanmcd #define SADB_X_DIAGNOSTIC_MALFORMED_INNER_SRC 62 7853055Sdanmcd #define SADB_X_DIAGNOSTIC_MALFORMED_INNER_DST 63 7863055Sdanmcd 7873055Sdanmcd #define SADB_X_DIAGNOSTIC_PREFIX_INNER_SRC 64 7883055Sdanmcd #define SADB_X_DIAGNOSTIC_PREFIX_INNER_DST 65 7893055Sdanmcd #define SADB_X_DIAGNOSTIC_BAD_INNER_DST_AF 66 7903055Sdanmcd #define SADB_X_DIAGNOSTIC_INNER_AF_MISMATCH 67 7913055Sdanmcd 7923055Sdanmcd #define SADB_X_DIAGNOSTIC_BAD_NATT_REM_AF 68 7933055Sdanmcd #define SADB_X_DIAGNOSTIC_BAD_NATT_LOC_AF 69 7943055Sdanmcd 7953055Sdanmcd #define SADB_X_DIAGNOSTIC_PROTO_MISMATCH 70 7963055Sdanmcd #define SADB_X_DIAGNOSTIC_INNER_PROTO_MISMATCH 71 7973055Sdanmcd 7983055Sdanmcd #define SADB_X_DIAGNOSTIC_DUAL_PORT_SETS 72 7993055Sdanmcd 8006668Smarkfen #define SADB_X_DIAGNOSTIC_PAIR_INAPPROPRIATE 73 8016668Smarkfen #define SADB_X_DIAGNOSTIC_PAIR_ADD_MISMATCH 74 8026668Smarkfen #define SADB_X_DIAGNOSTIC_PAIR_ALREADY 75 8036668Smarkfen #define SADB_X_DIAGNOSTIC_PAIR_SA_NOTFOUND 76 8046668Smarkfen #define SADB_X_DIAGNOSTIC_BAD_SA_DIRECTION 77 8056668Smarkfen 8066668Smarkfen #define SADB_X_DIAGNOSTIC_SA_NOTFOUND 78 8076668Smarkfen #define SADB_X_DIAGNOSTIC_SA_EXPIRED 79 808*10019SMark.Fenwick@Sun.COM #define SADB_X_DIAGNOSTIC_BAD_CTX 80 809*10019SMark.Fenwick@Sun.COM #define SADB_X_DIAGNOSTIC_INVALID_REPLAY 81 810*10019SMark.Fenwick@Sun.COM #define SADB_X_DIAGNOSTIC_MISSING_LIFETIME 82 811*10019SMark.Fenwick@Sun.COM #define SADB_X_DIAGNOSTIC_MAX 82 8120Sstevel@tonic-gate 8130Sstevel@tonic-gate /* Algorithm type for sadb_x_algdesc above... */ 8140Sstevel@tonic-gate 8150Sstevel@tonic-gate #define SADB_X_ALGTYPE_NONE 0 8160Sstevel@tonic-gate #define SADB_X_ALGTYPE_AUTH 1 8170Sstevel@tonic-gate #define SADB_X_ALGTYPE_CRYPT 2 8180Sstevel@tonic-gate #define SADB_X_ALGTYPE_COMPRESS 3 8190Sstevel@tonic-gate 8200Sstevel@tonic-gate #define SADB_X_ALGTYPE_MAX 3 8210Sstevel@tonic-gate 8220Sstevel@tonic-gate /* Key management protocol for sadb_x_kmc above... */ 8230Sstevel@tonic-gate 8240Sstevel@tonic-gate #define SADB_X_KMP_MANUAL 0 8250Sstevel@tonic-gate #define SADB_X_KMP_IKE 1 8260Sstevel@tonic-gate #define SADB_X_KMP_KINK 2 8270Sstevel@tonic-gate 8280Sstevel@tonic-gate #define SADB_X_KMP_MAX 2 8290Sstevel@tonic-gate 8300Sstevel@tonic-gate /* 8310Sstevel@tonic-gate * Handy conversion macros. Not part of the PF_KEY spec... 8320Sstevel@tonic-gate */ 8330Sstevel@tonic-gate 8340Sstevel@tonic-gate #define SADB_64TO8(x) ((x) << 3) 8350Sstevel@tonic-gate #define SADB_8TO64(x) ((x) >> 3) 8360Sstevel@tonic-gate #define SADB_8TO1(x) ((x) << 3) 8370Sstevel@tonic-gate #define SADB_1TO8(x) ((x) >> 3) 8380Sstevel@tonic-gate 8390Sstevel@tonic-gate #ifdef __cplusplus 8400Sstevel@tonic-gate } 8410Sstevel@tonic-gate #endif 8420Sstevel@tonic-gate 8430Sstevel@tonic-gate #endif /* _NET_PFKEYV2_H */ 844