1 /* $OpenBSD: types.h,v 1.25 2016/01/27 20:20:30 gsoares Exp $ */ 2 3 /* 4 * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef IKED_TYPES_H 20 #define IKED_TYPES_H 21 22 #ifndef IKED_USER 23 #define IKED_USER "_iked" 24 #endif 25 26 #ifndef IKED_CONFIG 27 #define IKED_CONFIG "/etc/iked.conf" 28 #endif 29 30 #define IKED_SOCKET "/var/run/iked.sock" 31 32 #ifndef IKED_CA 33 #define IKED_CA "/etc/iked/" 34 #endif 35 36 #define IKED_CA_DIR "ca/" 37 #define IKED_CRL_DIR "crls/" 38 #define IKED_CERT_DIR "certs/" 39 #define IKED_PUBKEY_DIR "pubkeys/" 40 #define IKED_PRIVKEY IKED_CA "private/local.key" 41 #define IKED_PUBKEY "local.pub" 42 43 #define IKED_OCSP_RESPCERT "ocsp/responder.crt" 44 #define IKED_OCSP_ISSUER "ocsp/issuer.crt" 45 46 #define IKED_OPT_VERBOSE 0x00000001 47 #define IKED_OPT_NOACTION 0x00000002 48 #define IKED_OPT_NONATT 0x00000004 49 #define IKED_OPT_NATT 0x00000008 50 #define IKED_OPT_PASSIVE 0x00000010 51 #define IKED_OPT_NOIPV6BLOCKING 0x00000020 52 53 #define IKED_IKE_PORT 500 54 #define IKED_NATT_PORT 4500 55 56 #define IKED_NONCE_MIN 16 /* XXX 128 bits */ 57 #define IKED_NONCE_SIZE 32 /* XXX 256 bits */ 58 59 #define IKED_ID_SIZE 1024 /* XXX should be dynamic */ 60 #define IKED_PSK_SIZE 1024 /* XXX should be dynamic */ 61 #define IKED_MSGBUF_MAX 8192 62 #define IKED_CFG_MAX 16 /* maximum CP attributes */ 63 #define IKED_TAG_SIZE 64 64 #define IKED_CYCLE_BUFFERS 8 /* # of static buffers for mapping */ 65 #define IKED_PASSWORD_SIZE 256 /* limited by most EAP types */ 66 67 #define IKED_LIFETIME_BYTES 536870912 /* 512 Mb */ 68 #define IKED_LIFETIME_SECONDS 10800 /* 3 hours */ 69 70 #define IKED_E 0x1000 /* Decrypted flag */ 71 72 struct iked_constmap { 73 unsigned int cm_type; 74 const char *cm_name; 75 const char *cm_descr; 76 }; 77 78 struct iked_transform { 79 uint8_t xform_type; 80 uint16_t xform_id; 81 uint16_t xform_length; 82 uint16_t xform_keylength; 83 unsigned int xform_score; 84 struct iked_constmap *xform_map; 85 }; 86 87 enum imsg_type { 88 IMSG_NONE, 89 IMSG_CTL_OK, 90 IMSG_CTL_FAIL, 91 IMSG_CTL_VERBOSE, 92 IMSG_CTL_NOTIFY, 93 IMSG_CTL_RELOAD, 94 IMSG_CTL_RESET, 95 IMSG_CTL_COUPLE, 96 IMSG_CTL_DECOUPLE, 97 IMSG_CTL_ACTIVE, 98 IMSG_CTL_PASSIVE, 99 IMSG_COMPILE, 100 IMSG_UDP_SOCKET, 101 IMSG_PFKEY_SOCKET, 102 IMSG_IKE_MESSAGE, 103 IMSG_CFG_POLICY, 104 IMSG_CFG_USER, 105 IMSG_CERTREQ, 106 IMSG_CERT, 107 IMSG_CERTVALID, 108 IMSG_CERTINVALID, 109 IMSG_OCSP_FD, 110 IMSG_OCSP_URL, 111 IMSG_AUTH 112 }; 113 114 enum privsep_procid { 115 PROC_PARENT = 0, 116 PROC_CONTROL, 117 PROC_CERT, 118 PROC_IKEV2, 119 PROC_MAX 120 }; 121 122 enum flushmode { 123 RESET_RELOAD = 0, 124 RESET_ALL, 125 RESET_CA, 126 RESET_POLICY, 127 RESET_SA, 128 RESET_USER 129 }; 130 131 #ifndef nitems 132 #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) 133 #endif 134 135 #endif /* IKED_TYPES_H */ 136