ieee802_1x.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * hostapd / IEEE 802.1X-2004 Authenticator
  3. * Copyright (c) 2002-2012, 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 IEEE802_1X_H
  9. #define IEEE802_1X_H
  10. struct hostapd_data;
  11. struct sta_info;
  12. struct eapol_state_machine;
  13. struct hostapd_config;
  14. struct hostapd_bss_config;
  15. struct hostapd_radius_attr;
  16. struct radius_msg;
  17. #ifdef _MSC_VER
  18. #pragma pack(push, 1)
  19. #endif /* _MSC_VER */
  20. /* RFC 3580, 4. RC4 EAPOL-Key Frame */
  21. struct ieee802_1x_eapol_key {
  22. u8 type;
  23. u16 key_length;
  24. u8 replay_counter[8]; /* does not repeat within the life of the keying
  25. * material used to encrypt the Key field;
  26. * 64-bit NTP timestamp MAY be used here */
  27. u8 key_iv[16]; /* cryptographically random number */
  28. u8 key_index; /* key flag in the most significant bit:
  29. * 0 = broadcast (default key),
  30. * 1 = unicast (key mapping key); key index is in the
  31. * 7 least significant bits */
  32. u8 key_signature[16]; /* HMAC-MD5 message integrity check computed with
  33. * MS-MPPE-Send-Key as the key */
  34. /* followed by key: if packet body length = 44 + key length, then the
  35. * key field (of key_length bytes) contains the key in encrypted form;
  36. * if packet body length = 44, key field is absent and key_length
  37. * represents the number of least significant octets from
  38. * MS-MPPE-Send-Key attribute to be used as the keying material;
  39. * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
  40. } STRUCT_PACKED;
  41. #ifdef _MSC_VER
  42. #pragma pack(pop)
  43. #endif /* _MSC_VER */
  44. void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
  45. size_t len);
  46. void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta);
  47. void ieee802_1x_free_station(struct sta_info *sta);
  48. void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta);
  49. void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta);
  50. void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
  51. struct sta_info *sta, int authorized);
  52. void ieee802_1x_dump_state(FILE *f, const char *prefix, struct sta_info *sta);
  53. int ieee802_1x_init(struct hostapd_data *hapd);
  54. void ieee802_1x_deinit(struct hostapd_data *hapd);
  55. int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
  56. const u8 *buf, size_t len, int ack);
  57. int ieee802_1x_eapol_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
  58. const u8 *data, int len, int ack);
  59. u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
  60. u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
  61. int idx);
  62. struct wpabuf * ieee802_1x_get_radius_cui(struct eapol_state_machine *sm);
  63. const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len);
  64. void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm,
  65. int enabled);
  66. void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm,
  67. int valid);
  68. void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth);
  69. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
  70. int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
  71. char *buf, size_t buflen);
  72. void hostapd_get_ntp_timestamp(u8 *buf);
  73. char *eap_type_text(u8 type);
  74. const char *radius_mode_txt(struct hostapd_data *hapd);
  75. int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta);
  76. int add_common_radius_attr(struct hostapd_data *hapd,
  77. struct hostapd_radius_attr *req_attr,
  78. struct sta_info *sta,
  79. struct radius_msg *msg);
  80. #endif /* IEEE802_1X_H */