ikev2.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * IKEv2 initiator (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_initiator_data {
  25. enum { SA_INIT, SA_AUTH, CHILD_SA, IKEV2_DONE } 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 *r_dh_public;
  33. struct wpabuf *i_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 *IDr;
  40. size_t IDr_len;
  41. u8 IDr_type;
  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. const u8 * (*get_shared_secret)(void *ctx, const u8 *IDr,
  50. size_t IDr_len, size_t *secret_len);
  51. void *cb_ctx;
  52. int unknown_user;
  53. };
  54. void ikev2_initiator_deinit(struct ikev2_initiator_data *data);
  55. int ikev2_initiator_process(struct ikev2_initiator_data *data,
  56. const struct wpabuf *buf);
  57. struct wpabuf * ikev2_initiator_build(struct ikev2_initiator_data *data);
  58. #endif /* IKEV2_H */