Home | History | Annotate | Download | only in wps
      1 /*
      2  * Wi-Fi Protected Setup - message definitions
      3  * Copyright (c) 2008, Jouni Malinen <j (at) w1.fi>
      4  *
      5  * This software may be distributed under the terms of the BSD license.
      6  * See README for more details.
      7  */
      8 
      9 #ifndef WPS_DEFS_H
     10 #define WPS_DEFS_H
     11 
     12 #ifdef CONFIG_WPS_TESTING
     13 
     14 extern int wps_version_number;
     15 extern int wps_testing_dummy_cred;
     16 extern int wps_corrupt_pkhash;
     17 extern int wps_force_auth_types_in_use;
     18 extern u16 wps_force_auth_types;
     19 extern int wps_force_encr_types_in_use;
     20 extern u16 wps_force_encr_types;
     21 #define WPS_VERSION wps_version_number
     22 
     23 #else /* CONFIG_WPS_TESTING */
     24 
     25 #define WPS_VERSION 0x20
     26 
     27 #endif /* CONFIG_WPS_TESTING */
     28 
     29 /* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
     30 #define WPS_DH_GROUP 5
     31 
     32 #define WPS_UUID_LEN 16
     33 #define WPS_NONCE_LEN 16
     34 #define WPS_AUTHENTICATOR_LEN 8
     35 #define WPS_AUTHKEY_LEN 32
     36 #define WPS_KEYWRAPKEY_LEN 16
     37 #define WPS_EMSK_LEN 32
     38 #define WPS_PSK_LEN 16
     39 #define WPS_SECRET_NONCE_LEN 16
     40 #define WPS_HASH_LEN 32
     41 #define WPS_KWA_LEN 8
     42 #define WPS_MGMTAUTHKEY_LEN 32
     43 #define WPS_MGMTENCKEY_LEN 16
     44 #define WPS_MGMT_KEY_ID_LEN 16
     45 #define WPS_OOB_DEVICE_PASSWORD_MIN_LEN 16
     46 #define WPS_OOB_DEVICE_PASSWORD_LEN 32
     47 #define WPS_OOB_PUBKEY_HASH_LEN 20
     48 #define WPS_DEV_NAME_MAX_LEN 32
     49 #define WPS_MANUFACTURER_MAX_LEN 64
     50 #define WPS_MODEL_NAME_MAX_LEN 32
     51 #define WPS_MODEL_NUMBER_MAX_LEN 32
     52 #define WPS_SERIAL_NUMBER_MAX_LEN 32
     53 
     54 /* Attribute Types */
     55 enum wps_attribute {
     56 	ATTR_AP_CHANNEL = 0x1001,
     57 	ATTR_ASSOC_STATE = 0x1002,
     58 	ATTR_AUTH_TYPE = 0x1003,
     59 	ATTR_AUTH_TYPE_FLAGS = 0x1004,
     60 	ATTR_AUTHENTICATOR = 0x1005,
     61 	ATTR_CONFIG_METHODS = 0x1008,
     62 	ATTR_CONFIG_ERROR = 0x1009,
     63 	ATTR_CONFIRM_URL4 = 0x100a,
     64 	ATTR_CONFIRM_URL6 = 0x100b,
     65 	ATTR_CONN_TYPE = 0x100c,
     66 	ATTR_CONN_TYPE_FLAGS = 0x100d,
     67 	ATTR_CRED = 0x100e,
     68 	ATTR_ENCR_TYPE = 0x100f,
     69 	ATTR_ENCR_TYPE_FLAGS = 0x1010,
     70 	ATTR_DEV_NAME = 0x1011,
     71 	ATTR_DEV_PASSWORD_ID = 0x1012,
     72 	ATTR_E_HASH1 = 0x1014,
     73 	ATTR_E_HASH2 = 0x1015,
     74 	ATTR_E_SNONCE1 = 0x1016,
     75 	ATTR_E_SNONCE2 = 0x1017,
     76 	ATTR_ENCR_SETTINGS = 0x1018,
     77 	ATTR_ENROLLEE_NONCE = 0x101a,
     78 	ATTR_FEATURE_ID = 0x101b,
     79 	ATTR_IDENTITY = 0x101c,
     80 	ATTR_IDENTITY_PROOF = 0x101d,
     81 	ATTR_KEY_WRAP_AUTH = 0x101e,
     82 	ATTR_KEY_ID = 0x101f,
     83 	ATTR_MAC_ADDR = 0x1020,
     84 	ATTR_MANUFACTURER = 0x1021,
     85 	ATTR_MSG_TYPE = 0x1022,
     86 	ATTR_MODEL_NAME = 0x1023,
     87 	ATTR_MODEL_NUMBER = 0x1024,
     88 	ATTR_NETWORK_INDEX = 0x1026,
     89 	ATTR_NETWORK_KEY = 0x1027,
     90 	ATTR_NETWORK_KEY_INDEX = 0x1028,
     91 	ATTR_NEW_DEVICE_NAME = 0x1029,
     92 	ATTR_NEW_PASSWORD = 0x102a,
     93 	ATTR_OOB_DEVICE_PASSWORD = 0x102c,
     94 	ATTR_OS_VERSION = 0x102d,
     95 	ATTR_POWER_LEVEL = 0x102f,
     96 	ATTR_PSK_CURRENT = 0x1030,
     97 	ATTR_PSK_MAX = 0x1031,
     98 	ATTR_PUBLIC_KEY = 0x1032,
     99 	ATTR_RADIO_ENABLE = 0x1033,
    100 	ATTR_REBOOT = 0x1034,
    101 	ATTR_REGISTRAR_CURRENT = 0x1035,
    102 	ATTR_REGISTRAR_ESTABLISHED = 0x1036,
    103 	ATTR_REGISTRAR_LIST = 0x1037,
    104 	ATTR_REGISTRAR_MAX = 0x1038,
    105 	ATTR_REGISTRAR_NONCE = 0x1039,
    106 	ATTR_REQUEST_TYPE = 0x103a,
    107 	ATTR_RESPONSE_TYPE = 0x103b,
    108 	ATTR_RF_BANDS = 0x103c,
    109 	ATTR_R_HASH1 = 0x103d,
    110 	ATTR_R_HASH2 = 0x103e,
    111 	ATTR_R_SNONCE1 = 0x103f,
    112 	ATTR_R_SNONCE2 = 0x1040,
    113 	ATTR_SELECTED_REGISTRAR = 0x1041,
    114 	ATTR_SERIAL_NUMBER = 0x1042,
    115 	ATTR_WPS_STATE = 0x1044,
    116 	ATTR_SSID = 0x1045,
    117 	ATTR_TOTAL_NETWORKS = 0x1046,
    118 	ATTR_UUID_E = 0x1047,
    119 	ATTR_UUID_R = 0x1048,
    120 	ATTR_VENDOR_EXT = 0x1049,
    121 	ATTR_VERSION = 0x104a,
    122 	ATTR_X509_CERT_REQ = 0x104b,
    123 	ATTR_X509_CERT = 0x104c,
    124 	ATTR_EAP_IDENTITY = 0x104d,
    125 	ATTR_MSG_COUNTER = 0x104e,
    126 	ATTR_PUBKEY_HASH = 0x104f,
    127 	ATTR_REKEY_KEY = 0x1050,
    128 	ATTR_KEY_LIFETIME = 0x1051,
    129 	ATTR_PERMITTED_CFG_METHODS = 0x1052,
    130 	ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
    131 	ATTR_PRIMARY_DEV_TYPE = 0x1054,
    132 	ATTR_SECONDARY_DEV_TYPE_LIST = 0x1055,
    133 	ATTR_PORTABLE_DEV = 0x1056,
    134 	ATTR_AP_SETUP_LOCKED = 0x1057,
    135 	ATTR_APPLICATION_EXT = 0x1058,
    136 	ATTR_EAP_TYPE = 0x1059,
    137 	ATTR_IV = 0x1060,
    138 	ATTR_KEY_PROVIDED_AUTO = 0x1061,
    139 	ATTR_802_1X_ENABLED = 0x1062,
    140 	ATTR_APPSESSIONKEY = 0x1063,
    141 	ATTR_WEPTRANSMITKEY = 0x1064,
    142 	ATTR_REQUESTED_DEV_TYPE = 0x106a,
    143 	ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
    144 };
    145 
    146 #define WPS_VENDOR_ID_WFA 14122
    147 
    148 /* WFA Vendor Extension subelements */
    149 enum {
    150 	WFA_ELEM_VERSION2 = 0x00,
    151 	WFA_ELEM_AUTHORIZEDMACS = 0x01,
    152 	WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
    153 	WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
    154 	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04,
    155 	WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS = 0x05
    156 };
    157 
    158 /* Device Password ID */
    159 enum wps_dev_password_id {
    160 	DEV_PW_DEFAULT = 0x0000,
    161 	DEV_PW_USER_SPECIFIED = 0x0001,
    162 	DEV_PW_MACHINE_SPECIFIED = 0x0002,
    163 	DEV_PW_REKEY = 0x0003,
    164 	DEV_PW_PUSHBUTTON = 0x0004,
    165 	DEV_PW_REGISTRAR_SPECIFIED = 0x0005,
    166 	DEV_PW_NFC_CONNECTION_HANDOVER = 0x0007,
    167 	DEV_PW_P2PS_DEFAULT = 0x0008
    168 };
    169 
    170 /* Message Type */
    171 enum wps_msg_type {
    172 	WPS_Beacon = 0x01,
    173 	WPS_ProbeRequest = 0x02,
    174 	WPS_ProbeResponse = 0x03,
    175 	WPS_M1 = 0x04,
    176 	WPS_M2 = 0x05,
    177 	WPS_M2D = 0x06,
    178 	WPS_M3 = 0x07,
    179 	WPS_M4 = 0x08,
    180 	WPS_M5 = 0x09,
    181 	WPS_M6 = 0x0a,
    182 	WPS_M7 = 0x0b,
    183 	WPS_M8 = 0x0c,
    184 	WPS_WSC_ACK = 0x0d,
    185 	WPS_WSC_NACK = 0x0e,
    186 	WPS_WSC_DONE = 0x0f
    187 };
    188 
    189 /* Authentication Type Flags */
    190 #define WPS_AUTH_OPEN 0x0001
    191 #define WPS_AUTH_WPAPSK 0x0002
    192 #define WPS_AUTH_SHARED 0x0004 /* deprecated */
    193 #define WPS_AUTH_WPA 0x0008
    194 #define WPS_AUTH_WPA2 0x0010
    195 #define WPS_AUTH_WPA2PSK 0x0020
    196 #define WPS_AUTH_TYPES (WPS_AUTH_OPEN | WPS_AUTH_WPAPSK | WPS_AUTH_SHARED | \
    197 			WPS_AUTH_WPA | WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)
    198 
    199 /* Encryption Type Flags */
    200 #define WPS_ENCR_NONE 0x0001
    201 #define WPS_ENCR_WEP 0x0002 /* deprecated */
    202 #define WPS_ENCR_TKIP 0x0004
    203 #define WPS_ENCR_AES 0x0008
    204 #define WPS_ENCR_TYPES (WPS_ENCR_NONE | WPS_ENCR_WEP | WPS_ENCR_TKIP | \
    205 			WPS_ENCR_AES)
    206 
    207 /* Configuration Error */
    208 enum wps_config_error {
    209 	WPS_CFG_NO_ERROR = 0,
    210 	WPS_CFG_OOB_IFACE_READ_ERROR = 1,
    211 	WPS_CFG_DECRYPTION_CRC_FAILURE = 2,
    212 	WPS_CFG_24_CHAN_NOT_SUPPORTED = 3,
    213 	WPS_CFG_50_CHAN_NOT_SUPPORTED = 4,
    214 	WPS_CFG_SIGNAL_TOO_WEAK = 5,
    215 	WPS_CFG_NETWORK_AUTH_FAILURE = 6,
    216 	WPS_CFG_NETWORK_ASSOC_FAILURE = 7,
    217 	WPS_CFG_NO_DHCP_RESPONSE = 8,
    218 	WPS_CFG_FAILED_DHCP_CONFIG = 9,
    219 	WPS_CFG_IP_ADDR_CONFLICT = 10,
    220 	WPS_CFG_NO_CONN_TO_REGISTRAR = 11,
    221 	WPS_CFG_MULTIPLE_PBC_DETECTED = 12,
    222 	WPS_CFG_ROGUE_SUSPECTED = 13,
    223 	WPS_CFG_DEVICE_BUSY = 14,
    224 	WPS_CFG_SETUP_LOCKED = 15,
    225 	WPS_CFG_MSG_TIMEOUT = 16,
    226 	WPS_CFG_REG_SESS_TIMEOUT = 17,
    227 	WPS_CFG_DEV_PASSWORD_AUTH_FAILURE = 18,
    228 	WPS_CFG_60G_CHAN_NOT_SUPPORTED = 19,
    229 	WPS_CFG_PUBLIC_KEY_HASH_MISMATCH = 20
    230 };
    231 
    232 /* Vendor specific Error Indication for WPS event messages */
    233 enum wps_error_indication {
    234 	WPS_EI_NO_ERROR,
    235 	WPS_EI_SECURITY_TKIP_ONLY_PROHIBITED,
    236 	WPS_EI_SECURITY_WEP_PROHIBITED,
    237 	WPS_EI_AUTH_FAILURE,
    238 	NUM_WPS_EI_VALUES
    239 };
    240 
    241 /* RF Bands */
    242 #define WPS_RF_24GHZ 0x01
    243 #define WPS_RF_50GHZ 0x02
    244 #define WPS_RF_60GHZ 0x04
    245 
    246 /* Config Methods */
    247 #define WPS_CONFIG_USBA 0x0001
    248 #define WPS_CONFIG_ETHERNET 0x0002
    249 #define WPS_CONFIG_LABEL 0x0004
    250 #define WPS_CONFIG_DISPLAY 0x0008
    251 #define WPS_CONFIG_EXT_NFC_TOKEN 0x0010
    252 #define WPS_CONFIG_INT_NFC_TOKEN 0x0020
    253 #define WPS_CONFIG_NFC_INTERFACE 0x0040
    254 #define WPS_CONFIG_PUSHBUTTON 0x0080
    255 #define WPS_CONFIG_KEYPAD 0x0100
    256 #define WPS_CONFIG_VIRT_PUSHBUTTON 0x0280
    257 #define WPS_CONFIG_PHY_PUSHBUTTON 0x0480
    258 #define WPS_CONFIG_P2PS 0x1000
    259 #define WPS_CONFIG_VIRT_DISPLAY 0x2008
    260 #define WPS_CONFIG_PHY_DISPLAY 0x4008
    261 
    262 /* Connection Type Flags */
    263 #define WPS_CONN_ESS 0x01
    264 #define WPS_CONN_IBSS 0x02
    265 
    266 /* Wi-Fi Protected Setup State */
    267 enum wps_state {
    268 	WPS_STATE_NOT_CONFIGURED = 1,
    269 	WPS_STATE_CONFIGURED = 2
    270 };
    271 
    272 /* Association State */
    273 enum wps_assoc_state {
    274 	WPS_ASSOC_NOT_ASSOC = 0,
    275 	WPS_ASSOC_CONN_SUCCESS = 1,
    276 	WPS_ASSOC_CFG_FAILURE = 2,
    277 	WPS_ASSOC_FAILURE = 3,
    278 	WPS_ASSOC_IP_FAILURE = 4
    279 };
    280 
    281 
    282 #define WPS_DEV_OUI_WFA 0x0050f204
    283 
    284 enum wps_dev_categ {
    285 	WPS_DEV_COMPUTER = 1,
    286 	WPS_DEV_INPUT = 2,
    287 	WPS_DEV_PRINTER = 3,
    288 	WPS_DEV_CAMERA = 4,
    289 	WPS_DEV_STORAGE = 5,
    290 	WPS_DEV_NETWORK_INFRA = 6,
    291 	WPS_DEV_DISPLAY = 7,
    292 	WPS_DEV_MULTIMEDIA = 8,
    293 	WPS_DEV_GAMING = 9,
    294 	WPS_DEV_PHONE = 10,
    295 	WPS_DEV_AUDIO = 11,
    296 };
    297 
    298 enum wps_dev_subcateg {
    299 	WPS_DEV_COMPUTER_PC = 1,
    300 	WPS_DEV_COMPUTER_SERVER = 2,
    301 	WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
    302 	WPS_DEV_COMPUTER_ULTRA_MOBILE = 4,
    303 	WPS_DEV_COMPUTER_NOTEBOOK = 5,
    304 	WPS_DEV_COMPUTER_DESKTOP = 6,
    305 	WPS_DEV_COMPUTER_MID = 7,
    306 	WPS_DEV_COMPUTER_NETBOOK = 8,
    307 	WPS_DEV_COMPUTER_TABLET = 9,
    308 	WPS_DEV_INPUT_KEYBOARD = 1,
    309 	WPS_DEV_INPUT_MOUSE = 2,
    310 	WPS_DEV_INPUT_JOYSTICK = 3,
    311 	WPS_DEV_INPUT_TRACKBALL = 4,
    312 	WPS_DEV_INPUT_GAMING = 5,
    313 	WPS_DEV_INPUT_REMOTE = 6,
    314 	WPS_DEV_INPUT_TOUCHSCREEN = 7,
    315 	WPS_DEV_INPUT_BIOMETRIC_READER = 8,
    316 	WPS_DEV_INPUT_BARCODE_READER = 9,
    317 	WPS_DEV_PRINTER_PRINTER = 1,
    318 	WPS_DEV_PRINTER_SCANNER = 2,
    319 	WPS_DEV_PRINTER_FAX = 3,
    320 	WPS_DEV_PRINTER_COPIER = 4,
    321 	WPS_DEV_PRINTER_ALL_IN_ONE = 5,
    322 	WPS_DEV_CAMERA_DIGITAL_STILL_CAMERA = 1,
    323 	WPS_DEV_CAMERA_VIDEO = 2,
    324 	WPS_DEV_CAMERA_WEB = 3,
    325 	WPS_DEV_CAMERA_SECURITY = 4,
    326 	WPS_DEV_STORAGE_NAS = 1,
    327 	WPS_DEV_NETWORK_INFRA_AP = 1,
    328 	WPS_DEV_NETWORK_INFRA_ROUTER = 2,
    329 	WPS_DEV_NETWORK_INFRA_SWITCH = 3,
    330 	WPS_DEV_NETWORK_INFRA_GATEWAY = 4,
    331 	WPS_DEV_NETWORK_INFRA_BRIDGE = 5,
    332 	WPS_DEV_DISPLAY_TV = 1,
    333 	WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
    334 	WPS_DEV_DISPLAY_PROJECTOR = 3,
    335 	WPS_DEV_DISPLAY_MONITOR = 4,
    336 	WPS_DEV_MULTIMEDIA_DAR = 1,
    337 	WPS_DEV_MULTIMEDIA_PVR = 2,
    338 	WPS_DEV_MULTIMEDIA_MCX = 3,
    339 	WPS_DEV_MULTIMEDIA_SET_TOP_BOX = 4,
    340 	WPS_DEV_MULTIMEDIA_MEDIA_SERVER = 5,
    341 	WPS_DEV_MULTIMEDIA_PORTABLE_VIDEO_PLAYER = 6,
    342 	WPS_DEV_GAMING_XBOX = 1,
    343 	WPS_DEV_GAMING_XBOX360 = 2,
    344 	WPS_DEV_GAMING_PLAYSTATION = 3,
    345 	WPS_DEV_GAMING_GAME_CONSOLE = 4,
    346 	WPS_DEV_GAMING_PORTABLE_DEVICE = 5,
    347 	WPS_DEV_PHONE_WINDOWS_MOBILE = 1,
    348 	WPS_DEV_PHONE_SINGLE_MODE = 2,
    349 	WPS_DEV_PHONE_DUAL_MODE = 3,
    350 	WPS_DEV_PHONE_SP_SINGLE_MODE = 4,
    351 	WPS_DEV_PHONE_SP_DUAL_MODE = 5,
    352 	WPS_DEV_AUDIO_TUNER_RECV = 1,
    353 	WPS_DEV_AUDIO_SPEAKERS = 2,
    354 	WPS_DEV_AUDIO_PMP = 3,
    355 	WPS_DEV_AUDIO_HEADSET = 4,
    356 	WPS_DEV_AUDIO_HEADPHONES = 5,
    357 	WPS_DEV_AUDIO_MICROPHONE = 6,
    358 	WPS_DEV_AUDIO_HOME_THEATRE = 7,
    359 };
    360 
    361 
    362 /* Request Type */
    363 enum wps_request_type {
    364 	WPS_REQ_ENROLLEE_INFO = 0,
    365 	WPS_REQ_ENROLLEE = 1,
    366 	WPS_REQ_REGISTRAR = 2,
    367 	WPS_REQ_WLAN_MANAGER_REGISTRAR = 3
    368 };
    369 
    370 /* Response Type */
    371 enum wps_response_type {
    372 	WPS_RESP_ENROLLEE_INFO = 0,
    373 	WPS_RESP_ENROLLEE = 1,
    374 	WPS_RESP_REGISTRAR = 2,
    375 	WPS_RESP_AP = 3
    376 };
    377 
    378 /* Walk Time for push button configuration (in seconds) */
    379 #define WPS_PBC_WALK_TIME 120
    380 
    381 #define WPS_MAX_AUTHORIZED_MACS 5
    382 
    383 #endif /* WPS_DEFS_H */
    384