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