• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * IKEv2 initiator (RFC 4306) for EAP-IKEV2
3  * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14 
15 #ifndef IKEV2_H
16 #define IKEV2_H
17 
18 #include "eap_common/ikev2_common.h"
19 
20 struct ikev2_proposal_data {
21 	u8 proposal_num;
22 	int integ;
23 	int prf;
24 	int encr;
25 	int dh;
26 };
27 
28 
29 struct ikev2_initiator_data {
30 	enum { SA_INIT, SA_AUTH, CHILD_SA, IKEV2_DONE } state;
31 	u8 i_spi[IKEV2_SPI_LEN];
32 	u8 r_spi[IKEV2_SPI_LEN];
33 	u8 i_nonce[IKEV2_NONCE_MAX_LEN];
34 	size_t i_nonce_len;
35 	u8 r_nonce[IKEV2_NONCE_MAX_LEN];
36 	size_t r_nonce_len;
37 	struct wpabuf *r_dh_public;
38 	struct wpabuf *i_dh_private;
39 	struct ikev2_proposal_data proposal;
40 	const struct dh_group *dh;
41 	struct ikev2_keys keys;
42 	u8 *IDi;
43 	size_t IDi_len;
44 	u8 *IDr;
45 	size_t IDr_len;
46 	u8 IDr_type;
47 	struct wpabuf *r_sign_msg;
48 	struct wpabuf *i_sign_msg;
49 	u8 *shared_secret;
50 	size_t shared_secret_len;
51 	enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth;
52 	u8 *key_pad;
53 	size_t key_pad_len;
54 
55 	const u8 * (*get_shared_secret)(void *ctx, const u8 *IDr,
56 					size_t IDr_len, size_t *secret_len);
57 	void *cb_ctx;
58 	int unknown_user;
59 };
60 
61 
62 void ikev2_initiator_deinit(struct ikev2_initiator_data *data);
63 int ikev2_initiator_process(struct ikev2_initiator_data *data,
64 			    const struct wpabuf *buf);
65 struct wpabuf * ikev2_initiator_build(struct ikev2_initiator_data *data);
66 
67 #endif /* IKEV2_H */
68