eap.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * hostapd / EAP Full Authenticator state machine (RFC 4137)
  3. * Copyright (c) 2004-2007, 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 EAP_H
  9. #define EAP_H
  10. #include "common/defs.h"
  11. #include "eap_common/eap_defs.h"
  12. #include "eap_server/eap_methods.h"
  13. #include "wpabuf.h"
  14. struct eap_sm;
  15. #define EAP_TTLS_AUTH_PAP 1
  16. #define EAP_TTLS_AUTH_CHAP 2
  17. #define EAP_TTLS_AUTH_MSCHAP 4
  18. #define EAP_TTLS_AUTH_MSCHAPV2 8
  19. struct eap_user {
  20. struct {
  21. int vendor;
  22. u32 method;
  23. } methods[EAP_MAX_METHODS];
  24. u8 *password;
  25. size_t password_len;
  26. int password_hash; /* whether password is hashed with
  27. * nt_password_hash() */
  28. int phase2;
  29. int force_version;
  30. int ttls_auth; /* bitfield of
  31. * EAP_TTLS_AUTH_{PAP,CHAP,MSCHAP,MSCHAPV2} */
  32. };
  33. struct eap_eapol_interface {
  34. /* Lower layer to full authenticator variables */
  35. Boolean eapResp; /* shared with EAPOL Backend Authentication */
  36. struct wpabuf *eapRespData;
  37. Boolean portEnabled;
  38. int retransWhile;
  39. Boolean eapRestart; /* shared with EAPOL Authenticator PAE */
  40. int eapSRTT;
  41. int eapRTTVAR;
  42. /* Full authenticator to lower layer variables */
  43. Boolean eapReq; /* shared with EAPOL Backend Authentication */
  44. Boolean eapNoReq; /* shared with EAPOL Backend Authentication */
  45. Boolean eapSuccess;
  46. Boolean eapFail;
  47. Boolean eapTimeout;
  48. struct wpabuf *eapReqData;
  49. u8 *eapKeyData;
  50. size_t eapKeyDataLen;
  51. Boolean eapKeyAvailable; /* called keyAvailable in IEEE 802.1X-2004 */
  52. /* AAA interface to full authenticator variables */
  53. Boolean aaaEapReq;
  54. Boolean aaaEapNoReq;
  55. Boolean aaaSuccess;
  56. Boolean aaaFail;
  57. struct wpabuf *aaaEapReqData;
  58. u8 *aaaEapKeyData;
  59. size_t aaaEapKeyDataLen;
  60. Boolean aaaEapKeyAvailable;
  61. int aaaMethodTimeout;
  62. /* Full authenticator to AAA interface variables */
  63. Boolean aaaEapResp;
  64. struct wpabuf *aaaEapRespData;
  65. /* aaaIdentity -> eap_get_identity() */
  66. Boolean aaaTimeout;
  67. };
  68. struct eapol_callbacks {
  69. int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
  70. int phase2, struct eap_user *user);
  71. const char * (*get_eap_req_id_text)(void *ctx, size_t *len);
  72. };
  73. struct eap_config {
  74. void *ssl_ctx;
  75. void *msg_ctx;
  76. void *eap_sim_db_priv;
  77. Boolean backend_auth;
  78. int eap_server;
  79. u16 pwd_group;
  80. u8 *pac_opaque_encr_key;
  81. u8 *eap_fast_a_id;
  82. size_t eap_fast_a_id_len;
  83. char *eap_fast_a_id_info;
  84. int eap_fast_prov;
  85. int pac_key_lifetime;
  86. int pac_key_refresh_time;
  87. int eap_sim_aka_result_ind;
  88. int tnc;
  89. struct wps_context *wps;
  90. const struct wpabuf *assoc_wps_ie;
  91. const struct wpabuf *assoc_p2p_ie;
  92. const u8 *peer_addr;
  93. int fragment_size;
  94. int pbc_in_m1;
  95. const u8 *server_id;
  96. size_t server_id_len;
  97. };
  98. struct eap_sm * eap_server_sm_init(void *eapol_ctx,
  99. struct eapol_callbacks *eapol_cb,
  100. struct eap_config *eap_conf);
  101. void eap_server_sm_deinit(struct eap_sm *sm);
  102. int eap_server_sm_step(struct eap_sm *sm);
  103. void eap_sm_notify_cached(struct eap_sm *sm);
  104. void eap_sm_pending_cb(struct eap_sm *sm);
  105. int eap_sm_method_pending(struct eap_sm *sm);
  106. const u8 * eap_get_identity(struct eap_sm *sm, size_t *len);
  107. struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm);
  108. void eap_server_clear_identity(struct eap_sm *sm);
  109. #endif /* EAP_H */