139beb93cSSam Leffler /* 239beb93cSSam Leffler * IKEv2 responder (RFC 4306) for EAP-IKEV2 339beb93cSSam Leffler * Copyright (c) 2007, Jouni Malinen <j@w1.fi> 439beb93cSSam Leffler * 5*f05cddf9SRui Paulo * This software may be distributed under the terms of the BSD license. 6*f05cddf9SRui Paulo * See README for more details. 739beb93cSSam Leffler */ 839beb93cSSam Leffler 939beb93cSSam Leffler #ifndef IKEV2_H 1039beb93cSSam Leffler #define IKEV2_H 1139beb93cSSam Leffler 1239beb93cSSam Leffler #include "eap_common/ikev2_common.h" 1339beb93cSSam Leffler 1439beb93cSSam Leffler struct ikev2_proposal_data { 1539beb93cSSam Leffler u8 proposal_num; 1639beb93cSSam Leffler int integ; 1739beb93cSSam Leffler int prf; 1839beb93cSSam Leffler int encr; 1939beb93cSSam Leffler int dh; 2039beb93cSSam Leffler }; 2139beb93cSSam Leffler 2239beb93cSSam Leffler 2339beb93cSSam Leffler struct ikev2_responder_data { 2439beb93cSSam Leffler enum { SA_INIT, SA_AUTH, CHILD_SA, NOTIFY, IKEV2_DONE, IKEV2_FAILED } 2539beb93cSSam Leffler state; 2639beb93cSSam Leffler u8 i_spi[IKEV2_SPI_LEN]; 2739beb93cSSam Leffler u8 r_spi[IKEV2_SPI_LEN]; 2839beb93cSSam Leffler u8 i_nonce[IKEV2_NONCE_MAX_LEN]; 2939beb93cSSam Leffler size_t i_nonce_len; 3039beb93cSSam Leffler u8 r_nonce[IKEV2_NONCE_MAX_LEN]; 3139beb93cSSam Leffler size_t r_nonce_len; 3239beb93cSSam Leffler struct wpabuf *i_dh_public; 3339beb93cSSam Leffler struct wpabuf *r_dh_private; 3439beb93cSSam Leffler struct ikev2_proposal_data proposal; 3539beb93cSSam Leffler const struct dh_group *dh; 3639beb93cSSam Leffler struct ikev2_keys keys; 3739beb93cSSam Leffler u8 *IDi; 3839beb93cSSam Leffler size_t IDi_len; 3939beb93cSSam Leffler u8 IDi_type; 4039beb93cSSam Leffler u8 *IDr; 4139beb93cSSam Leffler size_t IDr_len; 4239beb93cSSam Leffler struct wpabuf *r_sign_msg; 4339beb93cSSam Leffler struct wpabuf *i_sign_msg; 4439beb93cSSam Leffler u8 *shared_secret; 4539beb93cSSam Leffler size_t shared_secret_len; 4639beb93cSSam Leffler enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth; 4739beb93cSSam Leffler u8 *key_pad; 4839beb93cSSam Leffler size_t key_pad_len; 4939beb93cSSam Leffler u16 error_type; 5039beb93cSSam Leffler enum { LAST_MSG_SA_INIT, LAST_MSG_SA_AUTH } last_msg; 5139beb93cSSam Leffler }; 5239beb93cSSam Leffler 5339beb93cSSam Leffler 5439beb93cSSam Leffler void ikev2_responder_deinit(struct ikev2_responder_data *data); 5539beb93cSSam Leffler int ikev2_responder_process(struct ikev2_responder_data *data, 5639beb93cSSam Leffler const struct wpabuf *buf); 5739beb93cSSam Leffler struct wpabuf * ikev2_responder_build(struct ikev2_responder_data *data); 5839beb93cSSam Leffler 5939beb93cSSam Leffler #endif /* IKEV2_H */ 60