wps_defs.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. /*
  2. * Wi-Fi Protected Setup - message definitions
  3. * Copyright (c) 2008, 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 WPS_DEFS_H
  15. #define WPS_DEFS_H
  16. #ifdef CONFIG_WPS2
  17. #ifdef CONFIG_WPS_EXTENSIBILITY_TESTING
  18. #define WPS_VERSION 0x57
  19. #else /* CONFIG_WPS_EXTENSIBILITY_TESTING */
  20. #define WPS_VERSION 0x20
  21. #endif /* CONFIG_WPS_EXTENSIBILITY_TESTING */
  22. #else /* CONFIG_WPS2 */
  23. #define WPS_VERSION 0x10
  24. #endif /* CONFIG_WPS2 */
  25. /* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
  26. #define WPS_DH_GROUP 5
  27. #define WPS_UUID_LEN 16
  28. #define WPS_NONCE_LEN 16
  29. #define WPS_AUTHENTICATOR_LEN 8
  30. #define WPS_AUTHKEY_LEN 32
  31. #define WPS_KEYWRAPKEY_LEN 16
  32. #define WPS_EMSK_LEN 32
  33. #define WPS_PSK_LEN 16
  34. #define WPS_SECRET_NONCE_LEN 16
  35. #define WPS_HASH_LEN 32
  36. #define WPS_KWA_LEN 8
  37. #define WPS_MGMTAUTHKEY_LEN 32
  38. #define WPS_MGMTENCKEY_LEN 16
  39. #define WPS_MGMT_KEY_ID_LEN 16
  40. #define WPS_OOB_DEVICE_PASSWORD_ATTR_LEN 54
  41. #define WPS_OOB_DEVICE_PASSWORD_LEN 32
  42. #define WPS_OOB_PUBKEY_HASH_LEN 20
  43. /* Attribute Types */
  44. enum wps_attribute {
  45. ATTR_AP_CHANNEL = 0x1001,
  46. ATTR_ASSOC_STATE = 0x1002,
  47. ATTR_AUTH_TYPE = 0x1003,
  48. ATTR_AUTH_TYPE_FLAGS = 0x1004,
  49. ATTR_AUTHENTICATOR = 0x1005,
  50. ATTR_CONFIG_METHODS = 0x1008,
  51. ATTR_CONFIG_ERROR = 0x1009,
  52. ATTR_CONFIRM_URL4 = 0x100a,
  53. ATTR_CONFIRM_URL6 = 0x100b,
  54. ATTR_CONN_TYPE = 0x100c,
  55. ATTR_CONN_TYPE_FLAGS = 0x100d,
  56. ATTR_CRED = 0x100e,
  57. ATTR_ENCR_TYPE = 0x100f,
  58. ATTR_ENCR_TYPE_FLAGS = 0x1010,
  59. ATTR_DEV_NAME = 0x1011,
  60. ATTR_DEV_PASSWORD_ID = 0x1012,
  61. ATTR_E_HASH1 = 0x1014,
  62. ATTR_E_HASH2 = 0x1015,
  63. ATTR_E_SNONCE1 = 0x1016,
  64. ATTR_E_SNONCE2 = 0x1017,
  65. ATTR_ENCR_SETTINGS = 0x1018,
  66. ATTR_ENROLLEE_NONCE = 0x101a,
  67. ATTR_FEATURE_ID = 0x101b,
  68. ATTR_IDENTITY = 0x101c,
  69. ATTR_IDENTITY_PROOF = 0x101d,
  70. ATTR_KEY_WRAP_AUTH = 0x101e,
  71. ATTR_KEY_ID = 0x101f,
  72. ATTR_MAC_ADDR = 0x1020,
  73. ATTR_MANUFACTURER = 0x1021,
  74. ATTR_MSG_TYPE = 0x1022,
  75. ATTR_MODEL_NAME = 0x1023,
  76. ATTR_MODEL_NUMBER = 0x1024,
  77. ATTR_NETWORK_INDEX = 0x1026,
  78. ATTR_NETWORK_KEY = 0x1027,
  79. ATTR_NETWORK_KEY_INDEX = 0x1028,
  80. ATTR_NEW_DEVICE_NAME = 0x1029,
  81. ATTR_NEW_PASSWORD = 0x102a,
  82. ATTR_OOB_DEVICE_PASSWORD = 0x102c,
  83. ATTR_OS_VERSION = 0x102d,
  84. ATTR_POWER_LEVEL = 0x102f,
  85. ATTR_PSK_CURRENT = 0x1030,
  86. ATTR_PSK_MAX = 0x1031,
  87. ATTR_PUBLIC_KEY = 0x1032,
  88. ATTR_RADIO_ENABLE = 0x1033,
  89. ATTR_REBOOT = 0x1034,
  90. ATTR_REGISTRAR_CURRENT = 0x1035,
  91. ATTR_REGISTRAR_ESTABLISHED = 0x1036,
  92. ATTR_REGISTRAR_LIST = 0x1037,
  93. ATTR_REGISTRAR_MAX = 0x1038,
  94. ATTR_REGISTRAR_NONCE = 0x1039,
  95. ATTR_REQUEST_TYPE = 0x103a,
  96. ATTR_RESPONSE_TYPE = 0x103b,
  97. ATTR_RF_BANDS = 0x103c,
  98. ATTR_R_HASH1 = 0x103d,
  99. ATTR_R_HASH2 = 0x103e,
  100. ATTR_R_SNONCE1 = 0x103f,
  101. ATTR_R_SNONCE2 = 0x1040,
  102. ATTR_SELECTED_REGISTRAR = 0x1041,
  103. ATTR_SERIAL_NUMBER = 0x1042,
  104. ATTR_WPS_STATE = 0x1044,
  105. ATTR_SSID = 0x1045,
  106. ATTR_TOTAL_NETWORKS = 0x1046,
  107. ATTR_UUID_E = 0x1047,
  108. ATTR_UUID_R = 0x1048,
  109. ATTR_VENDOR_EXT = 0x1049,
  110. ATTR_VERSION = 0x104a,
  111. ATTR_X509_CERT_REQ = 0x104b,
  112. ATTR_X509_CERT = 0x104c,
  113. ATTR_EAP_IDENTITY = 0x104d,
  114. ATTR_MSG_COUNTER = 0x104e,
  115. ATTR_PUBKEY_HASH = 0x104f,
  116. ATTR_REKEY_KEY = 0x1050,
  117. ATTR_KEY_LIFETIME = 0x1051,
  118. ATTR_PERMITTED_CFG_METHODS = 0x1052,
  119. ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
  120. ATTR_PRIMARY_DEV_TYPE = 0x1054,
  121. ATTR_SECONDARY_DEV_TYPE_LIST = 0x1055,
  122. ATTR_PORTABLE_DEV = 0x1056,
  123. ATTR_AP_SETUP_LOCKED = 0x1057,
  124. ATTR_APPLICATION_EXT = 0x1058,
  125. ATTR_EAP_TYPE = 0x1059,
  126. ATTR_IV = 0x1060,
  127. ATTR_KEY_PROVIDED_AUTO = 0x1061,
  128. ATTR_802_1X_ENABLED = 0x1062,
  129. ATTR_APPSESSIONKEY = 0x1063,
  130. ATTR_WEPTRANSMITKEY = 0x1064,
  131. ATTR_REQUESTED_DEV_TYPE = 0x106a,
  132. ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
  133. };
  134. #define WPS_VENDOR_ID_WFA 14122
  135. /* WFA Vendor Extension subelements */
  136. enum {
  137. WFA_ELEM_VERSION2 = 0x00,
  138. WFA_ELEM_AUTHORIZEDMACS = 0x01,
  139. WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
  140. WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
  141. WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
  142. };
  143. /* Device Password ID */
  144. enum wps_dev_password_id {
  145. DEV_PW_DEFAULT = 0x0000,
  146. DEV_PW_USER_SPECIFIED = 0x0001,
  147. DEV_PW_MACHINE_SPECIFIED = 0x0002,
  148. DEV_PW_REKEY = 0x0003,
  149. DEV_PW_PUSHBUTTON = 0x0004,
  150. DEV_PW_REGISTRAR_SPECIFIED = 0x0005
  151. };
  152. /* Message Type */
  153. enum wps_msg_type {
  154. WPS_Beacon = 0x01,
  155. WPS_ProbeRequest = 0x02,
  156. WPS_ProbeResponse = 0x03,
  157. WPS_M1 = 0x04,
  158. WPS_M2 = 0x05,
  159. WPS_M2D = 0x06,
  160. WPS_M3 = 0x07,
  161. WPS_M4 = 0x08,
  162. WPS_M5 = 0x09,
  163. WPS_M6 = 0x0a,
  164. WPS_M7 = 0x0b,
  165. WPS_M8 = 0x0c,
  166. WPS_WSC_ACK = 0x0d,
  167. WPS_WSC_NACK = 0x0e,
  168. WPS_WSC_DONE = 0x0f
  169. };
  170. /* Authentication Type Flags */
  171. #define WPS_AUTH_OPEN 0x0001
  172. #define WPS_AUTH_WPAPSK 0x0002
  173. #define WPS_AUTH_SHARED 0x0004
  174. #define WPS_AUTH_WPA 0x0008
  175. #define WPS_AUTH_WPA2 0x0010
  176. #define WPS_AUTH_WPA2PSK 0x0020
  177. #define WPS_AUTH_TYPES (WPS_AUTH_OPEN | WPS_AUTH_WPAPSK | WPS_AUTH_SHARED | \
  178. WPS_AUTH_WPA | WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)
  179. /* Encryption Type Flags */
  180. #define WPS_ENCR_NONE 0x0001
  181. #define WPS_ENCR_WEP 0x0002
  182. #define WPS_ENCR_TKIP 0x0004
  183. #define WPS_ENCR_AES 0x0008
  184. #define WPS_ENCR_TYPES (WPS_ENCR_NONE | WPS_ENCR_WEP | WPS_ENCR_TKIP | \
  185. WPS_ENCR_AES)
  186. /* Configuration Error */
  187. enum wps_config_error {
  188. WPS_CFG_NO_ERROR = 0,
  189. WPS_CFG_OOB_IFACE_READ_ERROR = 1,
  190. WPS_CFG_DECRYPTION_CRC_FAILURE = 2,
  191. WPS_CFG_24_CHAN_NOT_SUPPORTED = 3,
  192. WPS_CFG_50_CHAN_NOT_SUPPORTED = 4,
  193. WPS_CFG_SIGNAL_TOO_WEAK = 5,
  194. WPS_CFG_NETWORK_AUTH_FAILURE = 6,
  195. WPS_CFG_NETWORK_ASSOC_FAILURE = 7,
  196. WPS_CFG_NO_DHCP_RESPONSE = 8,
  197. WPS_CFG_FAILED_DHCP_CONFIG = 9,
  198. WPS_CFG_IP_ADDR_CONFLICT = 10,
  199. WPS_CFG_NO_CONN_TO_REGISTRAR = 11,
  200. WPS_CFG_MULTIPLE_PBC_DETECTED = 12,
  201. WPS_CFG_ROGUE_SUSPECTED = 13,
  202. WPS_CFG_DEVICE_BUSY = 14,
  203. WPS_CFG_SETUP_LOCKED = 15,
  204. WPS_CFG_MSG_TIMEOUT = 16,
  205. WPS_CFG_REG_SESS_TIMEOUT = 17,
  206. WPS_CFG_DEV_PASSWORD_AUTH_FAILURE = 18
  207. };
  208. /* RF Bands */
  209. #define WPS_RF_24GHZ 0x01
  210. #define WPS_RF_50GHZ 0x02
  211. /* Config Methods */
  212. #define WPS_CONFIG_USBA 0x0001
  213. #define WPS_CONFIG_ETHERNET 0x0002
  214. #define WPS_CONFIG_LABEL 0x0004
  215. #define WPS_CONFIG_DISPLAY 0x0008
  216. #define WPS_CONFIG_EXT_NFC_TOKEN 0x0010
  217. #define WPS_CONFIG_INT_NFC_TOKEN 0x0020
  218. #define WPS_CONFIG_NFC_INTERFACE 0x0040
  219. #define WPS_CONFIG_PUSHBUTTON 0x0080
  220. #define WPS_CONFIG_KEYPAD 0x0100
  221. #ifdef CONFIG_WPS2
  222. #define WPS_CONFIG_VIRT_PUSHBUTTON 0x0280
  223. #define WPS_CONFIG_PHY_PUSHBUTTON 0x0480
  224. #define WPS_CONFIG_VIRT_DISPLAY 0x2008
  225. #define WPS_CONFIG_PHY_DISPLAY 0x4008
  226. #endif /* CONFIG_WPS2 */
  227. /* Connection Type Flags */
  228. #define WPS_CONN_ESS 0x01
  229. #define WPS_CONN_IBSS 0x02
  230. /* Wi-Fi Protected Setup State */
  231. enum wps_state {
  232. WPS_STATE_NOT_CONFIGURED = 1,
  233. WPS_STATE_CONFIGURED = 2
  234. };
  235. /* Association State */
  236. enum wps_assoc_state {
  237. WPS_ASSOC_NOT_ASSOC = 0,
  238. WPS_ASSOC_CONN_SUCCESS = 1,
  239. WPS_ASSOC_CFG_FAILURE = 2,
  240. WPS_ASSOC_FAILURE = 3,
  241. WPS_ASSOC_IP_FAILURE = 4
  242. };
  243. #define WPS_DEV_OUI_WFA 0x0050f204
  244. enum wps_dev_categ {
  245. WPS_DEV_COMPUTER = 1,
  246. WPS_DEV_INPUT = 2,
  247. WPS_DEV_PRINTER = 3,
  248. WPS_DEV_CAMERA = 4,
  249. WPS_DEV_STORAGE = 5,
  250. WPS_DEV_NETWORK_INFRA = 6,
  251. WPS_DEV_DISPLAY = 7,
  252. WPS_DEV_MULTIMEDIA = 8,
  253. WPS_DEV_GAMING = 9,
  254. WPS_DEV_PHONE = 10
  255. };
  256. enum wps_dev_subcateg {
  257. WPS_DEV_COMPUTER_PC = 1,
  258. WPS_DEV_COMPUTER_SERVER = 2,
  259. WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
  260. WPS_DEV_PRINTER_PRINTER = 1,
  261. WPS_DEV_PRINTER_SCANNER = 2,
  262. WPS_DEV_CAMERA_DIGITAL_STILL_CAMERA = 1,
  263. WPS_DEV_STORAGE_NAS = 1,
  264. WPS_DEV_NETWORK_INFRA_AP = 1,
  265. WPS_DEV_NETWORK_INFRA_ROUTER = 2,
  266. WPS_DEV_NETWORK_INFRA_SWITCH = 3,
  267. WPS_DEV_DISPLAY_TV = 1,
  268. WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
  269. WPS_DEV_DISPLAY_PROJECTOR = 3,
  270. WPS_DEV_MULTIMEDIA_DAR = 1,
  271. WPS_DEV_MULTIMEDIA_PVR = 2,
  272. WPS_DEV_MULTIMEDIA_MCX = 3,
  273. WPS_DEV_GAMING_XBOX = 1,
  274. WPS_DEV_GAMING_XBOX360 = 2,
  275. WPS_DEV_GAMING_PLAYSTATION = 3,
  276. WPS_DEV_PHONE_WINDOWS_MOBILE = 1
  277. };
  278. /* Request Type */
  279. enum wps_request_type {
  280. WPS_REQ_ENROLLEE_INFO = 0,
  281. WPS_REQ_ENROLLEE = 1,
  282. WPS_REQ_REGISTRAR = 2,
  283. WPS_REQ_WLAN_MANAGER_REGISTRAR = 3
  284. };
  285. /* Response Type */
  286. enum wps_response_type {
  287. WPS_RESP_ENROLLEE_INFO = 0,
  288. WPS_RESP_ENROLLEE = 1,
  289. WPS_RESP_REGISTRAR = 2,
  290. WPS_RESP_AP = 3
  291. };
  292. /* Walk Time for push button configuration (in seconds) */
  293. #define WPS_PBC_WALK_TIME 120
  294. #define WPS_MAX_AUTHORIZED_MACS 5
  295. #endif /* WPS_DEFS_H */