Lines Matching +full:uuid +full:- +full:dev
2 * Wi-Fi Protected Setup - common functionality
3 * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi>
45 iter = (res_len + SHA256_MAC_LEN - 1) / SHA256_MAC_LEN; in wps_kdf()
55 left -= SHA256_MAC_LEN; in wps_kdf()
70 if (wps->dh_privkey == NULL) { in wps_derive_keys()
72 return -1; in wps_derive_keys()
75 pubkey = wps->registrar ? wps->dh_pubkey_e : wps->dh_pubkey_r; in wps_derive_keys()
78 return -1; in wps_derive_keys()
81 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: DH Private Key", wps->dh_privkey); in wps_derive_keys()
83 dh_shared = dh5_derive_shared(wps->dh_ctx, pubkey, wps->dh_privkey); in wps_derive_keys()
84 dh5_free(wps->dh_ctx); in wps_derive_keys()
85 wps->dh_ctx = NULL; in wps_derive_keys()
89 return -1; in wps_derive_keys()
93 wpabuf_clear_free(wps->dh_privkey); in wps_derive_keys()
94 wps->dh_privkey = NULL; in wps_derive_keys()
98 /* DHKey = SHA-256(g^AB mod p) */ in wps_derive_keys()
105 /* KDK = HMAC-SHA-256_DHKey(N1 || EnrolleeMAC || N2) */ in wps_derive_keys()
106 addr[0] = wps->nonce_e; in wps_derive_keys()
108 addr[1] = wps->mac_addr_e; in wps_derive_keys()
110 addr[2] = wps->nonce_r; in wps_derive_keys()
115 wps_kdf(kdk, NULL, 0, "Wi-Fi Easy and Secure Key Derivation", in wps_derive_keys()
117 os_memcpy(wps->authkey, keys, WPS_AUTHKEY_LEN); in wps_derive_keys()
118 os_memcpy(wps->keywrapkey, keys + WPS_AUTHKEY_LEN, WPS_KEYWRAPKEY_LEN); in wps_derive_keys()
119 os_memcpy(wps->emsk, keys + WPS_AUTHKEY_LEN + WPS_KEYWRAPKEY_LEN, in wps_derive_keys()
123 wps->authkey, WPS_AUTHKEY_LEN); in wps_derive_keys()
125 wps->keywrapkey, WPS_KEYWRAPKEY_LEN); in wps_derive_keys()
126 wpa_hexdump_key(MSG_DEBUG, "WPS: EMSK", wps->emsk, WPS_EMSK_LEN); in wps_derive_keys()
137 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd, in wps_derive_psk()
139 return -1; in wps_derive_psk()
140 os_memcpy(wps->psk1, hash, WPS_PSK_LEN); in wps_derive_psk()
141 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, in wps_derive_psk()
144 return -1; in wps_derive_psk()
145 os_memcpy(wps->psk2, hash, WPS_PSK_LEN); in wps_derive_psk()
149 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK1", wps->psk1, WPS_PSK_LEN); in wps_derive_psk()
150 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK2", wps->psk2, WPS_PSK_LEN); in wps_derive_psk()
164 /* AES-128-CBC */ in wps_decrypt_encr_settings()
171 decrypted = wpabuf_alloc(encr_len - block_size); in wps_decrypt_encr_settings()
176 wpabuf_put_data(decrypted, encr + block_size, encr_len - block_size); in wps_decrypt_encr_settings()
177 if (aes_128_cbc_decrypt(wps->keywrapkey, encr, wpabuf_mhead(decrypted), in wps_decrypt_encr_settings()
186 pos = wpabuf_head_u8(decrypted) + wpabuf_len(decrypted) - 1; in wps_decrypt_encr_settings()
194 if (*pos-- != pad) { in wps_decrypt_encr_settings()
201 decrypted->used -= pad; in wps_decrypt_encr_settings()
208 * wps_pin_checksum - Compute PIN checksum
222 return (10 - accum % 10) % 10; in wps_pin_checksum()
227 * wps_pin_valid - Check whether a PIN has a valid checksum
238 * wps_generate_pin - Generate a random PIN
247 return -1; in wps_generate_pin()
267 len = p - pin; in wps_pin_str_valid()
277 if (wps->event_cb == NULL) in wps_fail_event()
285 wps->event_cb(wps->cb_ctx, WPS_EV_FAIL, &data); in wps_fail_event()
293 if (wps->event_cb == NULL) in wps_success_event()
298 wps->event_cb(wps->cb_ctx, WPS_EV_SUCCESS, &data); in wps_success_event()
307 if (wps->event_cb == NULL) in wps_pwd_auth_fail_event()
314 wps->event_cb(wps->cb_ctx, WPS_EV_PWD_AUTH_FAIL, &data); in wps_pwd_auth_fail_event()
320 if (wps->event_cb == NULL) in wps_pbc_overlap_event()
323 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_OVERLAP, NULL); in wps_pbc_overlap_event()
329 if (wps->event_cb == NULL) in wps_pbc_timeout_event()
332 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_TIMEOUT, NULL); in wps_pbc_timeout_event()
338 if (wps->event_cb == NULL) in wps_pbc_active_event()
341 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_ACTIVE, NULL); in wps_pbc_active_event()
347 if (wps->event_cb == NULL) in wps_pbc_disable_event()
350 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_DISABLE, NULL); in wps_pbc_disable_event()
371 data.auth_type = wps->auth_types; in wps_get_oob_cred()
372 data.encr_type = wps->encr_types; in wps_get_oob_cred()
376 wps_build_mac_addr(plain, wps->dev.mac_addr) || in wps_get_oob_cred()
383 if (wps->wps_state == WPS_STATE_NOT_CONFIGURED && data.new_psk && in wps_get_oob_cred()
384 wps->ap) { in wps_get_oob_cred()
391 os_memcpy(cred.ssid, wps->ssid, wps->ssid_len); in wps_get_oob_cred()
392 cred.ssid_len = wps->ssid_len; in wps_get_oob_cred()
398 wps->wps_state = WPS_STATE_CONFIGURED; in wps_get_oob_cred()
402 if (wps->cred_cb) in wps_get_oob_cred()
403 wps->cred_cb(wps->cb_ctx, &cred); in wps_get_oob_cred()
440 for (i = 0; i < attr->num_cred; i++) { in wps_oob_use_cred()
445 wpabuf_set(&msg, attr->cred[i], attr->cred_len[i]); in wps_oob_use_cred()
450 return -1; in wps_oob_use_cred()
452 wps->cred_cb(wps->cb_ctx, &local_cred); in wps_oob_use_cred()
466 /* <categ>-<OUI>-<subcateg> */ in wps_dev_type_str2bin()
468 pos = os_strchr(str, '-'); in wps_dev_type_str2bin()
470 return -1; in wps_dev_type_str2bin()
473 return -1; in wps_dev_type_str2bin()
474 pos = os_strchr(pos, '-'); in wps_dev_type_str2bin()
476 return -1; in wps_dev_type_str2bin()
490 ret = os_snprintf(buf, buf_len, "%u-%08X-%u", in wps_dev_type_bin2str()
500 void uuid_gen_mac_addr(const u8 *mac_addr, u8 *uuid) in uuid_gen_mac_addr() argument
518 os_memcpy(uuid, hash, 16); in uuid_gen_mac_addr()
520 /* Version: 5 = named-based version using SHA-1 */ in uuid_gen_mac_addr()
521 uuid[6] = (5 << 4) | (uuid[6] & 0x0f); in uuid_gen_mac_addr()
524 uuid[8] = 0x80 | (uuid[8] & 0x3f); in uuid_gen_mac_addr()
612 wps_build_config_error(msg, wps->config_error) || in wps_build_wsc_nack()
653 return -1; in wps_nfc_gen_dh()
658 return -1; in wps_nfc_gen_dh()
728 wps_build_uuid_e(msg, ctx->uuid) || in wps_build_nfc_handover_req()
734 WPA_PUT_BE16(len, wpabuf_len(msg) - 2); in wps_build_nfc_handover_req()
744 wps->ssid, wps->ssid_len); in wps_build_ssid()
746 wpabuf_put_be16(msg, wps->ssid_len); in wps_build_ssid()
747 wpabuf_put_data(msg, wps->ssid, wps->ssid_len); in wps_build_ssid()
777 return -1; in wps_build_ap_freq()
817 WPA_PUT_BE16(len, wpabuf_len(msg) - 2); in wps_build_nfc_handover_sel()
843 if (wps_build_manufacturer(&ctx->dev, msg) || in wps_build_nfc_handover_req_p2p()
844 wps_build_model_name(&ctx->dev, msg) || in wps_build_nfc_handover_req_p2p()
845 wps_build_model_number(&ctx->dev, msg) || in wps_build_nfc_handover_req_p2p()
848 wps_build_rf_bands(&ctx->dev, msg, 0) || in wps_build_nfc_handover_req_p2p()
849 wps_build_serial_number(&ctx->dev, msg) || in wps_build_nfc_handover_req_p2p()
850 wps_build_uuid_e(msg, ctx->uuid) || in wps_build_nfc_handover_req_p2p()
895 if (wps_build_manufacturer(&ctx->dev, msg) || in wps_build_nfc_handover_sel_p2p()
896 wps_build_model_name(&ctx->dev, msg) || in wps_build_nfc_handover_sel_p2p()
897 wps_build_model_number(&ctx->dev, msg) || in wps_build_nfc_handover_sel_p2p()
900 wps_build_rf_bands(&ctx->dev, msg, 0) || in wps_build_nfc_handover_sel_p2p()
901 wps_build_serial_number(&ctx->dev, msg) || in wps_build_nfc_handover_sel_p2p()
902 wps_build_uuid_e(msg, ctx->uuid) || in wps_build_nfc_handover_sel_p2p()