ikev2.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * IKEv2 responder (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. #ifndef IKEV2_H
  15. #define IKEV2_H
  16. #include "eap_common/ikev2_common.h"
  17. struct ikev2_proposal_data {
  18. u8 proposal_num;
  19. int integ;
  20. int prf;
  21. int encr;
  22. int dh;
  23. };
  24. struct ikev2_responder_data {
  25. enum { SA_INIT, SA_AUTH, CHILD_SA, NOTIFY, IKEV2_DONE, IKEV2_FAILED }
  26. state;
  27. u8 i_spi[IKEV2_SPI_LEN];
  28. u8 r_spi[IKEV2_SPI_LEN];
  29. u8 i_nonce[IKEV2_NONCE_MAX_LEN];
  30. size_t i_nonce_len;
  31. u8 r_nonce[IKEV2_NONCE_MAX_LEN];
  32. size_t r_nonce_len;
  33. struct wpabuf *i_dh_public;
  34. struct wpabuf *r_dh_private;
  35. struct ikev2_proposal_data proposal;
  36. const struct dh_group *dh;
  37. struct ikev2_keys keys;
  38. u8 *IDi;
  39. size_t IDi_len;
  40. u8 IDi_type;
  41. u8 *IDr;
  42. size_t IDr_len;
  43. struct wpabuf *r_sign_msg;
  44. struct wpabuf *i_sign_msg;
  45. u8 *shared_secret;
  46. size_t shared_secret_len;
  47. enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth;
  48. u8 *key_pad;
  49. size_t key_pad_len;
  50. u16 error_type;
  51. enum { LAST_MSG_SA_INIT, LAST_MSG_SA_AUTH } last_msg;
  52. };
  53. void ikev2_responder_deinit(struct ikev2_responder_data *data);
  54. int ikev2_responder_process(struct ikev2_responder_data *data,
  55. const struct wpabuf *buf);
  56. struct wpabuf * ikev2_responder_build(struct ikev2_responder_data *data);
  57. #endif /* IKEV2_H */