00001 /* 00002 * IKEv2 initiator (RFC 4306) for EAP-IKEV2 00003 * Copyright (c) 2007, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef IKEV2_H 00016 #define IKEV2_H 00017 00018 #include "eap_common/ikev2_common.h" 00019 00020 struct ikev2_proposal_data { 00021 u8 proposal_num; 00022 int integ; 00023 int prf; 00024 int encr; 00025 int dh; 00026 }; 00027 00028 00029 struct ikev2_initiator_data { 00030 enum { SA_INIT, SA_AUTH, CHILD_SA, IKEV2_DONE } state; 00031 u8 i_spi[IKEV2_SPI_LEN]; 00032 u8 r_spi[IKEV2_SPI_LEN]; 00033 u8 i_nonce[IKEV2_NONCE_MAX_LEN]; 00034 size_t i_nonce_len; 00035 u8 r_nonce[IKEV2_NONCE_MAX_LEN]; 00036 size_t r_nonce_len; 00037 struct wpabuf *r_dh_public; 00038 struct wpabuf *i_dh_private; 00039 struct ikev2_proposal_data proposal; 00040 const struct dh_group *dh; 00041 struct ikev2_keys keys; 00042 u8 *IDi; 00043 size_t IDi_len; 00044 u8 *IDr; 00045 size_t IDr_len; 00046 u8 IDr_type; 00047 struct wpabuf *r_sign_msg; 00048 struct wpabuf *i_sign_msg; 00049 u8 *shared_secret; 00050 size_t shared_secret_len; 00051 enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth; 00052 u8 *key_pad; 00053 size_t key_pad_len; 00054 00055 const u8 * (*get_shared_secret)(void *ctx, const u8 *IDr, 00056 size_t IDr_len, size_t *secret_len); 00057 void *cb_ctx; 00058 int unknown_user; 00059 }; 00060 00061 00062 void ikev2_initiator_deinit(struct ikev2_initiator_data *data); 00063 int ikev2_initiator_process(struct ikev2_initiator_data *data, 00064 const struct wpabuf *buf); 00065 struct wpabuf * ikev2_initiator_build(struct ikev2_initiator_data *data); 00066 00067 #endif /* IKEV2_H */