eapol_auth_sm.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. int erp_send_reauth_start;
  25. char *erp_domain; /* a copy of this will be allocated */
  26. int erp; /* Whether ERP is enabled on authentication server */
  27. u8 *pac_opaque_encr_key;
  28. u8 *eap_fast_a_id;
  29. size_t eap_fast_a_id_len;
  30. char *eap_fast_a_id_info;
  31. int eap_fast_prov;
  32. int pac_key_lifetime;
  33. int pac_key_refresh_time;
  34. int eap_sim_aka_result_ind;
  35. int tnc;
  36. struct wps_context *wps;
  37. int fragment_size;
  38. u16 pwd_group;
  39. int pbc_in_m1;
  40. const u8 *server_id;
  41. size_t server_id_len;
  42. /* Opaque context pointer to owner data for callback functions */
  43. void *ctx;
  44. };
  45. struct eap_user;
  46. struct eap_server_erp_key;
  47. typedef enum {
  48. EAPOL_LOGGER_DEBUG, EAPOL_LOGGER_INFO, EAPOL_LOGGER_WARNING
  49. } eapol_logger_level;
  50. enum eapol_event {
  51. EAPOL_AUTH_SM_CHANGE,
  52. EAPOL_AUTH_REAUTHENTICATE
  53. };
  54. struct eapol_auth_cb {
  55. void (*eapol_send)(void *ctx, void *sta_ctx, u8 type, const u8 *data,
  56. size_t datalen);
  57. void (*aaa_send)(void *ctx, void *sta_ctx, const u8 *data,
  58. size_t datalen);
  59. void (*finished)(void *ctx, void *sta_ctx, int success, int preauth,
  60. int remediation);
  61. int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
  62. int phase2, struct eap_user *user);
  63. int (*sta_entry_alive)(void *ctx, const u8 *addr);
  64. void (*logger)(void *ctx, const u8 *addr, eapol_logger_level level,
  65. const char *txt);
  66. void (*set_port_authorized)(void *ctx, void *sta_ctx, int authorized);
  67. void (*abort_auth)(void *ctx, void *sta_ctx);
  68. void (*tx_key)(void *ctx, void *sta_ctx);
  69. void (*eapol_event)(void *ctx, void *sta_ctx, enum eapol_event type);
  70. struct eap_server_erp_key * (*erp_get_key)(void *ctx,
  71. const char *keyname);
  72. int (*erp_add_key)(void *ctx, struct eap_server_erp_key *erp);
  73. };
  74. struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
  75. struct eapol_auth_cb *cb);
  76. void eapol_auth_deinit(struct eapol_authenticator *eapol);
  77. struct eapol_state_machine *
  78. eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
  79. int flags, const struct wpabuf *assoc_wps_ie,
  80. const struct wpabuf *assoc_p2p_ie, void *sta_ctx,
  81. const char *identity, const char *radius_cui);
  82. void eapol_auth_free(struct eapol_state_machine *sm);
  83. void eapol_auth_step(struct eapol_state_machine *sm);
  84. int eapol_auth_dump_state(struct eapol_state_machine *sm, char *buf,
  85. size_t buflen);
  86. int eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
  87. #endif /* EAPOL_AUTH_SM_H */