eapol_auth_sm.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * IEEE 802.1X-2004 Authenticator - EAPOL state machine
  3. * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef EAPOL_AUTH_SM_H
  9. #define EAPOL_AUTH_SM_H
  10. #define EAPOL_SM_PREAUTH BIT(0)
  11. #define EAPOL_SM_WAIT_START BIT(1)
  12. #define EAPOL_SM_USES_WPA BIT(2)
  13. #define EAPOL_SM_FROM_PMKSA_CACHE BIT(3)
  14. struct eapol_auth_config {
  15. int eap_reauth_period;
  16. int wpa;
  17. int individual_wep_key_len;
  18. int eap_server;
  19. void *ssl_ctx;
  20. void *msg_ctx;
  21. void *eap_sim_db_priv;
  22. char *eap_req_id_text; /* a copy of this will be allocated */
  23. size_t eap_req_id_text_len;
  24. u8 *pac_opaque_encr_key;
  25. u8 *eap_fast_a_id;
  26. size_t eap_fast_a_id_len;
  27. char *eap_fast_a_id_info;
  28. int eap_fast_prov;
  29. int pac_key_lifetime;
  30. int pac_key_refresh_time;
  31. int eap_sim_aka_result_ind;
  32. int tnc;
  33. struct wps_context *wps;
  34. int fragment_size;
  35. u16 pwd_group;
  36. int pbc_in_m1;
  37. /* Opaque context pointer to owner data for callback functions */
  38. void *ctx;
  39. };
  40. struct eap_user;
  41. typedef enum {
  42. EAPOL_LOGGER_DEBUG, EAPOL_LOGGER_INFO, EAPOL_LOGGER_WARNING
  43. } eapol_logger_level;
  44. enum eapol_event {
  45. EAPOL_AUTH_SM_CHANGE,
  46. EAPOL_AUTH_REAUTHENTICATE
  47. };
  48. struct eapol_auth_cb {
  49. void (*eapol_send)(void *ctx, void *sta_ctx, u8 type, const u8 *data,
  50. size_t datalen);
  51. void (*aaa_send)(void *ctx, void *sta_ctx, const u8 *data,
  52. size_t datalen);
  53. void (*finished)(void *ctx, void *sta_ctx, int success, int preauth);
  54. int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
  55. int phase2, struct eap_user *user);
  56. int (*sta_entry_alive)(void *ctx, const u8 *addr);
  57. void (*logger)(void *ctx, const u8 *addr, eapol_logger_level level,
  58. const char *txt);
  59. void (*set_port_authorized)(void *ctx, void *sta_ctx, int authorized);
  60. void (*abort_auth)(void *ctx, void *sta_ctx);
  61. void (*tx_key)(void *ctx, void *sta_ctx);
  62. void (*eapol_event)(void *ctx, void *sta_ctx, enum eapol_event type);
  63. };
  64. struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
  65. struct eapol_auth_cb *cb);
  66. void eapol_auth_deinit(struct eapol_authenticator *eapol);
  67. struct eapol_state_machine *
  68. eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
  69. int flags, const struct wpabuf *assoc_wps_ie,
  70. const struct wpabuf *assoc_p2p_ie, void *sta_ctx,
  71. const char *identity, const char *radius_cui);
  72. void eapol_auth_free(struct eapol_state_machine *sm);
  73. void eapol_auth_step(struct eapol_state_machine *sm);
  74. void eapol_auth_dump_state(FILE *f, const char *prefix,
  75. struct eapol_state_machine *sm);
  76. int eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
  77. #endif /* EAPOL_AUTH_SM_H */