You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ieee802_1x.h 3.4KB

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