12 #define IKEV2_NONCE_MIN_LEN 16
13 #define IKEV2_NONCE_MAX_LEN 256
20 #define IKEV2_SPI_LEN 8
23 u8 i_spi[IKEV2_SPI_LEN];
24 u8 r_spi[IKEV2_SPI_LEN];
42 u8 proposal_length[2];
54 u8 transform_length[2];
69 #define IKEV2_VERSION (((IKEV2_MjVer) << 4) | (IKEV2_MnVer))
83 #define IKEV2_HDR_INITIATOR 0x08
84 #define IKEV2_HDR_VERSION 0x10
85 #define IKEV2_HDR_RESPONSE 0x20
88 #define IKEV2_PAYLOAD_FLAGS_CRITICAL 0x01
94 IKEV2_PAYLOAD_NO_NEXT_PAYLOAD = 0,
95 IKEV2_PAYLOAD_SA = 33,
96 IKEV2_PAYLOAD_KEY_EXCHANGE = 34,
97 IKEV2_PAYLOAD_IDi = 35,
98 IKEV2_PAYLOAD_IDr = 36,
99 IKEV2_PAYLOAD_CERTIFICATE = 37,
100 IKEV2_PAYLOAD_CERT_REQ = 38,
101 IKEV2_PAYLOAD_AUTHENTICATION = 39,
102 IKEV2_PAYLOAD_NONCE = 40,
103 IKEV2_PAYLOAD_NOTIFICATION = 41,
104 IKEV2_PAYLOAD_VENDOD_ID = 43,
105 IKEV2_PAYLOAD_ENCRYPTED = 46,
106 IKEV2_PAYLOAD_NEXT_FAST_ID = 121
112 IKEV2_PROTOCOL_RESERVED = 0,
113 IKEV2_PROTOCOL_IKE = 1,
114 IKEV2_PROTOCOL_AH = 2,
115 IKEV2_PROTOCOL_ESP = 3
121 IKEV2_TRANSFORM_ENCR = 1,
122 IKEV2_TRANSFORM_PRF = 2,
123 IKEV2_TRANSFORM_INTEG = 3,
124 IKEV2_TRANSFORM_DH = 4,
125 IKEV2_TRANSFORM_ESN = 5
154 AUTH_HMAC_MD5_96 = 1,
155 AUTH_HMAC_SHA1_96 = 2,
163 DH_GROUP1_768BIT_MODP = 1,
164 DH_GROUP2_1024BIT_MODP = 2,
165 DH_GROUP5_1536BIT_MODP = 5,
166 DH_GROUP5_2048BIT_MODP = 14,
167 DH_GROUP5_3072BIT_MODP = 15,
168 DH_GROUP5_4096BIT_MODP = 16,
169 DH_GROUP5_6144BIT_MODP = 17,
170 DH_GROUP5_8192BIT_MODP = 18
188 CERT_ENCODING_PKCS7_X509 = 1,
189 CERT_ENCODING_PGP_CERT = 2,
190 CERT_ENCODING_DNS_SIGNED_KEY = 3,
193 CERT_ENCODING_X509_CERT_SIGN = 4,
194 CERT_ENCODING_KERBEROS_TOKEN = 6,
196 CERT_ENCODING_CRL = 7,
197 CERT_ENCODING_ARL = 8,
198 CERT_ENCODING_SPKI_CERT = 9,
199 CERT_ENCODING_X509_CERT_ATTR = 10,
201 CERT_ENCODING_RAW_RSA_KEY = 11,
202 CERT_ENCODING_HASH_AND_URL_X509_CERT = 12,
203 CERT_ENCODING_HASH_AND_URL_X509_BUNDLE = 13
210 AUTH_SHARED_KEY_MIC = 2,
217 UNSUPPORTED_CRITICAL_PAYLOAD = 1,
219 INVALID_MAJOR_VERSION = 5,
221 INVALID_MESSAGE_ID = 9,
223 NO_PROPOSAL_CHOSEN = 14,
224 INVALID_KE_PAYLOAD = 17,
225 AUTHENTICATION_FAILED = 24,
226 SINGLE_PAIR_REQUIRED = 34,
227 NO_ADDITIONAL_SAS = 35,
228 INTERNAL_ADDRESS_FAILURE = 36,
229 FAILED_CP_REQUIRED = 37,
230 TS_UNACCEPTABLE = 38,
231 INVALID_SELECTORS = 39
236 u8 *SK_d, *SK_ai, *SK_ar, *SK_ei, *SK_er, *SK_pi, *SK_pr;
237 size_t SK_d_len, SK_integ_len, SK_encr_len, SK_prf_len;
242 void ikev2_free_keys(
struct ikev2_keys *keys);
246 #define IKEV2_MAX_HASH_LEN 20
267 int ikev2_integ_hash(
int alg,
const u8 *key,
size_t key_len,
const u8 *data,
268 size_t data_len, u8 *hash);
270 int ikev2_prf_hash(
int alg,
const u8 *key,
size_t key_len,
271 size_t num_elem,
const u8 *addr[],
const size_t *len,
273 int ikev2_prf_plus(
int alg,
const u8 *key,
size_t key_len,
274 const u8 *data,
size_t data_len,
275 u8 *out,
size_t out_len);
277 int ikev2_encr_encrypt(
int alg,
const u8 *key,
size_t key_len,
const u8 *iv,
278 const u8 *plain, u8 *crypt,
size_t len);
279 int ikev2_encr_decrypt(
int alg,
const u8 *key,
size_t key_len,
const u8 *iv,
280 const u8 *crypt, u8 *plain,
size_t len);
282 int ikev2_derive_auth_data(
int prf_alg,
const struct wpabuf *sign_msg,
283 const u8 *ID,
size_t ID_len, u8 ID_type,
285 const u8 *shared_secret,
size_t shared_secret_len,
286 const u8 *nonce,
size_t nonce_len,
287 const u8 *key_pad,
size_t key_pad_len,
307 size_t encrypted_len;
308 u8 encr_next_payload;
309 const u8 *notification;
310 size_t notification_len;
314 u8 next_payload,
const u8 *pos,
const u8 *end);
316 u8 * ikev2_decrypt_payload(
int encr_id,
int integ_id,
struct ikev2_keys *keys,
317 int initiator,
const struct ikev2_hdr *hdr,
318 const u8 *encrypted,
size_t encrypted_len,
320 void ikev2_update_hdr(
struct wpabuf *msg);
321 int ikev2_build_encrypted(
int encr_id,
int integ_id,
struct ikev2_keys *keys,
322 int initiator,
struct wpabuf *msg,
323 struct wpabuf *plain, u8 next_payload);
327 const u8 *skeyseed,
const u8 *data,
size_t data_len,
Definition: ikev2_common.h:260
Definition: ikev2_common.h:235
Definition: ikev2_common.h:291
Definition: ikev2_common.h:248
Definition: ikev2_common.h:33
Definition: ikev2_common.h:22
Definition: ikev2_common.h:39
Definition: ikev2_common.h:254