blob: 051a93869c1e8251f1031e4810d65c5ac0edcb60 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * IKEv2 initiator (RFC 4306) for EAP-IKEV2
3 * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
4 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef IKEV2_H
10#define IKEV2_H
11
12#include "eap_common/ikev2_common.h"
13
14struct ikev2_proposal_data {
15 u8 proposal_num;
16 int integ;
17 int prf;
18 int encr;
19 int dh;
20};
21
22
23struct ikev2_initiator_data {
24 enum { SA_INIT, SA_AUTH, CHILD_SA, IKEV2_DONE } state;
25 u8 i_spi[IKEV2_SPI_LEN];
26 u8 r_spi[IKEV2_SPI_LEN];
27 u8 i_nonce[IKEV2_NONCE_MAX_LEN];
28 size_t i_nonce_len;
29 u8 r_nonce[IKEV2_NONCE_MAX_LEN];
30 size_t r_nonce_len;
31 struct wpabuf *r_dh_public;
32 struct wpabuf *i_dh_private;
33 struct ikev2_proposal_data proposal;
34 const struct dh_group *dh;
35 struct ikev2_keys keys;
36 u8 *IDi;
37 size_t IDi_len;
38 u8 *IDr;
39 size_t IDr_len;
40 u8 IDr_type;
41 struct wpabuf *r_sign_msg;
42 struct wpabuf *i_sign_msg;
43 u8 *shared_secret;
44 size_t shared_secret_len;
45 enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth;
46 u8 *key_pad;
47 size_t key_pad_len;
48
49 const u8 * (*get_shared_secret)(void *ctx, const u8 *IDr,
50 size_t IDr_len, size_t *secret_len);
51 void *cb_ctx;
52 int unknown_user;
53};
54
55
56void ikev2_initiator_deinit(struct ikev2_initiator_data *data);
57int ikev2_initiator_process(struct ikev2_initiator_data *data,
58 const struct wpabuf *buf);
59struct wpabuf * ikev2_initiator_build(struct ikev2_initiator_data *data);
60
61#endif /* IKEV2_H */