ieee802_1x.h 3.5 KB

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