PageRenderTime 37ms CodeModel.GetById 9ms RepoModel.GetById 2ms app.codeStats 0ms

/drivers/net/wireless/bcm4329/include/proto/eapol.h

https://bitbucket.org/wisechild/galaxy-nexus
C++ Header | 172 lines | 111 code | 32 blank | 29 comment | 0 complexity | 7661dabfba35f65393edba7a9a06e473 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*
  2. * 802.1x EAPOL definitions
  3. *
  4. * See
  5. * IEEE Std 802.1X-2001
  6. * IEEE 802.1X RADIUS Usage Guidelines
  7. *
  8. * Copyright (C) 2002 Broadcom Corporation
  9. *
  10. * $Id: eapol.h,v 9.18.260.1.2.1.6.6 2009/04/08 05:00:08 Exp $
  11. */
  12. #ifndef _eapol_h_
  13. #define _eapol_h_
  14. #ifndef _TYPEDEFS_H_
  15. #include <typedefs.h>
  16. #endif
  17. /* This marks the start of a packed structure section. */
  18. #include <packed_section_start.h>
  19. #define AKW_BLOCK_LEN 8 /* The only def we need here */
  20. /* EAPOL for 802.3/Ethernet */
  21. typedef struct {
  22. struct ether_header eth; /* 802.3/Ethernet header */
  23. unsigned char version; /* EAPOL protocol version */
  24. unsigned char type; /* EAPOL type */
  25. unsigned short length; /* Length of body */
  26. unsigned char body[1]; /* Body (optional) */
  27. } eapol_header_t;
  28. #define EAPOL_HEADER_LEN 18
  29. /* EAPOL version */
  30. #define WPA2_EAPOL_VERSION 2
  31. #define WPA_EAPOL_VERSION 1
  32. #define LEAP_EAPOL_VERSION 1
  33. #define SES_EAPOL_VERSION 1
  34. /* EAPOL types */
  35. #define EAP_PACKET 0
  36. #define EAPOL_START 1
  37. #define EAPOL_LOGOFF 2
  38. #define EAPOL_KEY 3
  39. #define EAPOL_ASF 4
  40. /* EAPOL-Key types */
  41. #define EAPOL_RC4_KEY 1
  42. #define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */
  43. #define EAPOL_WPA_KEY 254 /* WPA */
  44. /* RC4 EAPOL-Key header field sizes */
  45. #define EAPOL_KEY_REPLAY_LEN 8
  46. #define EAPOL_KEY_IV_LEN 16
  47. #define EAPOL_KEY_SIG_LEN 16
  48. /* RC4 EAPOL-Key */
  49. typedef BWL_PRE_PACKED_STRUCT struct {
  50. unsigned char type; /* Key Descriptor Type */
  51. unsigned short length; /* Key Length (unaligned) */
  52. unsigned char replay[EAPOL_KEY_REPLAY_LEN]; /* Replay Counter */
  53. unsigned char iv[EAPOL_KEY_IV_LEN]; /* Key IV */
  54. unsigned char index; /* Key Flags & Index */
  55. unsigned char signature[EAPOL_KEY_SIG_LEN]; /* Key Signature */
  56. unsigned char key[1]; /* Key (optional) */
  57. } BWL_POST_PACKED_STRUCT eapol_key_header_t;
  58. #define EAPOL_KEY_HEADER_LEN 44
  59. /* RC4 EAPOL-Key flags */
  60. #define EAPOL_KEY_FLAGS_MASK 0x80
  61. #define EAPOL_KEY_BROADCAST 0
  62. #define EAPOL_KEY_UNICAST 0x80
  63. /* RC4 EAPOL-Key index */
  64. #define EAPOL_KEY_INDEX_MASK 0x7f
  65. /* WPA/802.11i/WPA2 EAPOL-Key header field sizes */
  66. #define EAPOL_WPA_KEY_REPLAY_LEN 8
  67. #define EAPOL_WPA_KEY_NONCE_LEN 32
  68. #define EAPOL_WPA_KEY_IV_LEN 16
  69. #define EAPOL_WPA_KEY_ID_LEN 8
  70. #define EAPOL_WPA_KEY_RSC_LEN 8
  71. #define EAPOL_WPA_KEY_MIC_LEN 16
  72. #define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN)
  73. #define EAPOL_WPA_MAX_KEY_SIZE 32
  74. /* WPA EAPOL-Key */
  75. typedef BWL_PRE_PACKED_STRUCT struct {
  76. unsigned char type; /* Key Descriptor Type */
  77. unsigned short key_info; /* Key Information (unaligned) */
  78. unsigned short key_len; /* Key Length (unaligned) */
  79. unsigned char replay[EAPOL_WPA_KEY_REPLAY_LEN]; /* Replay Counter */
  80. unsigned char nonce[EAPOL_WPA_KEY_NONCE_LEN]; /* Nonce */
  81. unsigned char iv[EAPOL_WPA_KEY_IV_LEN]; /* Key IV */
  82. unsigned char rsc[EAPOL_WPA_KEY_RSC_LEN]; /* Key RSC */
  83. unsigned char id[EAPOL_WPA_KEY_ID_LEN]; /* WPA:Key ID, 802.11i/WPA2: Reserved */
  84. unsigned char mic[EAPOL_WPA_KEY_MIC_LEN]; /* Key MIC */
  85. unsigned short data_len; /* Key Data Length */
  86. unsigned char data[EAPOL_WPA_KEY_DATA_LEN]; /* Key data */
  87. } BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t;
  88. #define EAPOL_WPA_KEY_LEN 95
  89. /* WPA/802.11i/WPA2 KEY KEY_INFO bits */
  90. #define WPA_KEY_DESC_V1 0x01
  91. #define WPA_KEY_DESC_V2 0x02
  92. #define WPA_KEY_PAIRWISE 0x08
  93. #define WPA_KEY_INSTALL 0x40
  94. #define WPA_KEY_ACK 0x80
  95. #define WPA_KEY_MIC 0x100
  96. #define WPA_KEY_SECURE 0x200
  97. #define WPA_KEY_ERROR 0x400
  98. #define WPA_KEY_REQ 0x800
  99. /* WPA-only KEY KEY_INFO bits */
  100. #define WPA_KEY_INDEX_0 0x00
  101. #define WPA_KEY_INDEX_1 0x10
  102. #define WPA_KEY_INDEX_2 0x20
  103. #define WPA_KEY_INDEX_3 0x30
  104. #define WPA_KEY_INDEX_MASK 0x30
  105. #define WPA_KEY_INDEX_SHIFT 0x04
  106. /* 802.11i/WPA2-only KEY KEY_INFO bits */
  107. #define WPA_KEY_ENCRYPTED_DATA 0x1000
  108. /* Key Data encapsulation */
  109. typedef BWL_PRE_PACKED_STRUCT struct {
  110. uint8 type;
  111. uint8 length;
  112. uint8 oui[3];
  113. uint8 subtype;
  114. uint8 data[1];
  115. } BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t;
  116. #define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
  117. #define WPA2_KEY_DATA_SUBTYPE_GTK 1
  118. #define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
  119. #define WPA2_KEY_DATA_SUBTYPE_MAC 3
  120. #define WPA2_KEY_DATA_SUBTYPE_PMKID 4
  121. /* GTK encapsulation */
  122. typedef BWL_PRE_PACKED_STRUCT struct {
  123. uint8 flags;
  124. uint8 reserved;
  125. uint8 gtk[EAPOL_WPA_MAX_KEY_SIZE];
  126. } BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t;
  127. #define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
  128. #define WPA2_GTK_INDEX_MASK 0x03
  129. #define WPA2_GTK_INDEX_SHIFT 0x00
  130. #define WPA2_GTK_TRANSMIT 0x04
  131. /* STAKey encapsulation */
  132. typedef BWL_PRE_PACKED_STRUCT struct {
  133. uint8 reserved[2];
  134. uint8 mac[ETHER_ADDR_LEN];
  135. uint8 stakey[EAPOL_WPA_MAX_KEY_SIZE];
  136. } BWL_POST_PACKED_STRUCT eapol_wpa2_key_stakey_encap_t;
  137. #define WPA2_KEY_DATA_PAD 0xdd
  138. /* This marks the end of a packed structure section. */
  139. #include <packed_section_end.h>
  140. #endif /* _eapol_h_ */