| 1 |
/* |
| 2 |
* IKEv2 responder (RFC 4306) for EAP-IKEV2 |
| 3 |
* Copyright (c) 2007, Jouni Malinen <[email protected]> |
| 4 |
* |
| 5 |
* This software may be distributed under the terms of the BSD license. |
| 6 |
* See README for more details. |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef IKEV2_H |
| 10 |
#define IKEV2_H |
| 11 |
|
| 12 |
#include "eap_common/ikev2_common.h" |
| 13 |
|
| 14 |
struct ikev2_proposal_data { |
| 15 |
u8 proposal_num; |
| 16 |
int integ; |
| 17 |
int prf; |
| 18 |
int encr; |
| 19 |
int dh; |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
struct ikev2_responder_data { |
| 24 |
enum { SA_INIT, SA_AUTH, CHILD_SA, NOTIFY, IKEV2_DONE, IKEV2_FAILED } |
| 25 |
state; |
| 26 |
u8 i_spi[IKEV2_SPI_LEN]; |
| 27 |
u8 r_spi[IKEV2_SPI_LEN]; |
| 28 |
u8 i_nonce[IKEV2_NONCE_MAX_LEN]; |
| 29 |
size_t i_nonce_len; |
| 30 |
u8 r_nonce[IKEV2_NONCE_MAX_LEN]; |
| 31 |
size_t r_nonce_len; |
| 32 |
struct wpabuf *i_dh_public; |
| 33 |
struct wpabuf *r_dh_private; |
| 34 |
struct ikev2_proposal_data proposal; |
| 35 |
const struct dh_group *dh; |
| 36 |
struct ikev2_keys keys; |
| 37 |
u8 *IDi; |
| 38 |
size_t IDi_len; |
| 39 |
u8 IDi_type; |
| 40 |
u8 *IDr; |
| 41 |
size_t IDr_len; |
| 42 |
struct wpabuf *r_sign_msg; |
| 43 |
struct wpabuf *i_sign_msg; |
| 44 |
u8 *shared_secret; |
| 45 |
size_t shared_secret_len; |
| 46 |
enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth; |
| 47 |
u8 *key_pad; |
| 48 |
size_t key_pad_len; |
| 49 |
u16 error_type; |
| 50 |
enum { LAST_MSG_SA_INIT, LAST_MSG_SA_AUTH } last_msg; |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
void ikev2_responder_deinit(struct ikev2_responder_data *data); |
| 55 |
int ikev2_responder_process(struct ikev2_responder_data *data, |
| 56 |
const struct wpabuf *buf); |
| 57 |
struct wpabuf * ikev2_responder_build(struct ikev2_responder_data *data); |
| 58 |
|
| 59 |
#endif /* IKEV2_H */ |