xref: /freebsd/sys/netipsec/key_var.h (revision a0196c3c891ccf2ee88854f9798fd8e44d0e9f16)
188768458SSam Leffler /*	$FreeBSD$	*/
288768458SSam Leffler /*	$KAME: key_var.h,v 1.11 2001/09/12 23:05:07 sakane Exp $	*/
388768458SSam Leffler 
4c398230bSWarner Losh /*-
588768458SSam Leffler  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
688768458SSam Leffler  * All rights reserved.
788768458SSam Leffler  *
888768458SSam Leffler  * Redistribution and use in source and binary forms, with or without
988768458SSam Leffler  * modification, are permitted provided that the following conditions
1088768458SSam Leffler  * are met:
1188768458SSam Leffler  * 1. Redistributions of source code must retain the above copyright
1288768458SSam Leffler  *    notice, this list of conditions and the following disclaimer.
1388768458SSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
1488768458SSam Leffler  *    notice, this list of conditions and the following disclaimer in the
1588768458SSam Leffler  *    documentation and/or other materials provided with the distribution.
1688768458SSam Leffler  * 3. Neither the name of the project nor the names of its contributors
1788768458SSam Leffler  *    may be used to endorse or promote products derived from this software
1888768458SSam Leffler  *    without specific prior written permission.
1988768458SSam Leffler  *
2088768458SSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2188768458SSam Leffler  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2288768458SSam Leffler  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2388768458SSam Leffler  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2488768458SSam Leffler  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2588768458SSam Leffler  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2688768458SSam Leffler  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2788768458SSam Leffler  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2888768458SSam Leffler  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2988768458SSam Leffler  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3088768458SSam Leffler  * SUCH DAMAGE.
3188768458SSam Leffler  */
3288768458SSam Leffler 
3388768458SSam Leffler #ifndef _NETIPSEC_KEY_VAR_H_
3488768458SSam Leffler #define _NETIPSEC_KEY_VAR_H_
3588768458SSam Leffler 
3688768458SSam Leffler /* sysctl */
3788768458SSam Leffler #define KEYCTL_DEBUG_LEVEL		1
3888768458SSam Leffler #define KEYCTL_SPI_TRY			2
3988768458SSam Leffler #define KEYCTL_SPI_MIN_VALUE		3
4088768458SSam Leffler #define KEYCTL_SPI_MAX_VALUE		4
4188768458SSam Leffler #define KEYCTL_RANDOM_INT		5
4288768458SSam Leffler #define KEYCTL_LARVAL_LIFETIME		6
4388768458SSam Leffler #define KEYCTL_BLOCKACQ_COUNT		7
4488768458SSam Leffler #define KEYCTL_BLOCKACQ_LIFETIME	8
4588768458SSam Leffler #define KEYCTL_ESP_KEYMIN		9
4688768458SSam Leffler #define KEYCTL_ESP_AUTH			10
4788768458SSam Leffler #define KEYCTL_AH_KEYMIN		11
4888768458SSam Leffler #define KEYCTL_PREFERED_OLDSA		12
4988768458SSam Leffler #define KEYCTL_MAXID			13
5088768458SSam Leffler 
5188768458SSam Leffler #define KEYCTL_NAMES { \
5288768458SSam Leffler 	{ 0, 0 }, \
5388768458SSam Leffler 	{ "debug", CTLTYPE_INT }, \
5488768458SSam Leffler 	{ "spi_try", CTLTYPE_INT }, \
5588768458SSam Leffler 	{ "spi_min_value", CTLTYPE_INT }, \
5688768458SSam Leffler 	{ "spi_max_value", CTLTYPE_INT }, \
5788768458SSam Leffler 	{ "random_int", CTLTYPE_INT }, \
5888768458SSam Leffler 	{ "larval_lifetime", CTLTYPE_INT }, \
5988768458SSam Leffler 	{ "blockacq_count", CTLTYPE_INT }, \
6088768458SSam Leffler 	{ "blockacq_lifetime", CTLTYPE_INT }, \
6188768458SSam Leffler 	{ "esp_keymin", CTLTYPE_INT }, \
6288768458SSam Leffler 	{ "esp_auth", CTLTYPE_INT }, \
6388768458SSam Leffler 	{ "ah_keymin", CTLTYPE_INT }, \
6488768458SSam Leffler 	{ "prefered_oldsa", CTLTYPE_INT }, \
6588768458SSam Leffler }
6688768458SSam Leffler 
6788768458SSam Leffler #ifdef _KERNEL
6888768458SSam Leffler #define _ARRAYLEN(p) (sizeof(p)/sizeof(p[0]))
69a0196c3cSGeorge V. Neville-Neil #define _KEYLEN(key) ((u_int)((key)->bits >> 3))
70a0196c3cSGeorge V. Neville-Neil #define _KEYBITS(key) ((u_int)((key)->bits))
7188768458SSam Leffler #define _KEYBUF(key) ((caddr_t)((caddr_t)(key) + sizeof(struct sadb_key)))
7288768458SSam Leffler #endif /*_KERNEL*/
7388768458SSam Leffler 
7488768458SSam Leffler #endif /* _NETIPSEC_KEY_VAR_H_ */
75