Lines Matching refs:msg

21 static int wps_build_wps_state(struct wps_data *wps, struct wpabuf *msg)  in wps_build_wps_state()  argument
30 wpabuf_put_be16(msg, ATTR_WPS_STATE); in wps_build_wps_state()
31 wpabuf_put_be16(msg, 1); in wps_build_wps_state()
32 wpabuf_put_u8(msg, state); in wps_build_wps_state()
37 static int wps_build_e_hash(struct wps_data *wps, struct wpabuf *msg) in wps_build_e_hash() argument
56 wpabuf_put_be16(msg, ATTR_E_HASH1); in wps_build_e_hash()
57 wpabuf_put_be16(msg, SHA256_MAC_LEN); in wps_build_e_hash()
58 hash = wpabuf_put(msg, SHA256_MAC_LEN); in wps_build_e_hash()
72 wpabuf_put_be16(msg, ATTR_E_HASH2); in wps_build_e_hash()
73 wpabuf_put_be16(msg, SHA256_MAC_LEN); in wps_build_e_hash()
74 hash = wpabuf_put(msg, SHA256_MAC_LEN); in wps_build_e_hash()
85 static int wps_build_e_snonce1(struct wps_data *wps, struct wpabuf *msg) in wps_build_e_snonce1() argument
88 wpabuf_put_be16(msg, ATTR_E_SNONCE1); in wps_build_e_snonce1()
89 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN); in wps_build_e_snonce1()
90 wpabuf_put_data(msg, wps->snonce, WPS_SECRET_NONCE_LEN); in wps_build_e_snonce1()
95 static int wps_build_e_snonce2(struct wps_data *wps, struct wpabuf *msg) in wps_build_e_snonce2() argument
98 wpabuf_put_be16(msg, ATTR_E_SNONCE2); in wps_build_e_snonce2()
99 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN); in wps_build_e_snonce2()
100 wpabuf_put_data(msg, wps->snonce + WPS_SECRET_NONCE_LEN, in wps_build_e_snonce2()
108 struct wpabuf *msg; in wps_build_m1() local
118 msg = wpabuf_alloc(1000); in wps_build_m1()
119 if (msg == NULL) in wps_build_m1()
143 if (wps_build_version(msg) || in wps_build_m1()
144 wps_build_msg_type(msg, WPS_M1) || in wps_build_m1()
145 wps_build_uuid_e(msg, wps->uuid_e) || in wps_build_m1()
146 wps_build_mac_addr(msg, wps->mac_addr_e) || in wps_build_m1()
147 wps_build_enrollee_nonce(wps, msg) || in wps_build_m1()
148 wps_build_public_key(wps, msg) || in wps_build_m1()
149 wps_build_auth_type_flags(wps, msg) || in wps_build_m1()
150 wps_build_encr_type_flags(wps, msg) || in wps_build_m1()
151 wps_build_conn_type_flags(wps, msg) || in wps_build_m1()
152 wps_build_config_methods(msg, config_methods) || in wps_build_m1()
153 wps_build_wps_state(wps, msg) || in wps_build_m1()
154 wps_build_device_attrs(&wps->wps->dev, msg) || in wps_build_m1()
155 wps_build_rf_bands(&wps->wps->dev, msg, in wps_build_m1()
157 wps_build_assoc_state(wps, msg) || in wps_build_m1()
158 wps_build_dev_password_id(msg, wps->dev_pw_id) || in wps_build_m1()
159 wps_build_config_error(msg, WPS_CFG_NO_ERROR) || in wps_build_m1()
160 wps_build_os_version(&wps->wps->dev, msg) || in wps_build_m1()
161 wps_build_wfa_ext(msg, 0, NULL, 0, multi_ap_backhaul_sta) || in wps_build_m1()
162 wps_build_vendor_ext_m1(&wps->wps->dev, msg)) { in wps_build_m1()
163 wpabuf_free(msg); in wps_build_m1()
168 return msg; in wps_build_m1()
174 struct wpabuf *msg; in wps_build_m3() local
191 msg = wpabuf_alloc(1000); in wps_build_m3()
192 if (msg == NULL) in wps_build_m3()
195 if (wps_build_version(msg) || in wps_build_m3()
196 wps_build_msg_type(msg, WPS_M3) || in wps_build_m3()
197 wps_build_registrar_nonce(wps, msg) || in wps_build_m3()
198 wps_build_e_hash(wps, msg) || in wps_build_m3()
199 wps_build_wfa_ext(msg, 0, NULL, 0, 0) || in wps_build_m3()
200 wps_build_authenticator(wps, msg)) { in wps_build_m3()
201 wpabuf_free(msg); in wps_build_m3()
206 return msg; in wps_build_m3()
212 struct wpabuf *msg, *plain; in wps_build_m5() local
220 msg = wpabuf_alloc(1000); in wps_build_m5()
221 if (msg == NULL) { in wps_build_m5()
226 if (wps_build_version(msg) || in wps_build_m5()
227 wps_build_msg_type(msg, WPS_M5) || in wps_build_m5()
228 wps_build_registrar_nonce(wps, msg) || in wps_build_m5()
231 wps_build_encr_settings(wps, msg, plain) || in wps_build_m5()
232 wps_build_wfa_ext(msg, 0, NULL, 0, 0) || in wps_build_m5()
233 wps_build_authenticator(wps, msg)) { in wps_build_m5()
235 wpabuf_free(msg); in wps_build_m5()
241 return msg; in wps_build_m5()
246 static int wps_build_cred_ssid(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_ssid() argument
249 wpabuf_put_be16(msg, ATTR_SSID); in wps_build_cred_ssid()
250 wpabuf_put_be16(msg, wps->wps->ssid_len); in wps_build_cred_ssid()
251 wpabuf_put_data(msg, wps->wps->ssid, wps->wps->ssid_len); in wps_build_cred_ssid()
256 static int wps_build_cred_auth_type(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_auth_type() argument
273 wpabuf_put_be16(msg, ATTR_AUTH_TYPE); in wps_build_cred_auth_type()
274 wpabuf_put_be16(msg, 2); in wps_build_cred_auth_type()
275 wpabuf_put_be16(msg, auth_type); in wps_build_cred_auth_type()
280 static int wps_build_cred_encr_type(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_encr_type() argument
297 wpabuf_put_be16(msg, ATTR_ENCR_TYPE); in wps_build_cred_encr_type()
298 wpabuf_put_be16(msg, 2); in wps_build_cred_encr_type()
299 wpabuf_put_be16(msg, encr_type); in wps_build_cred_encr_type()
304 static int wps_build_cred_network_key(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_network_key() argument
322 wpabuf_put_be16(msg, ATTR_NETWORK_KEY); in wps_build_cred_network_key()
323 wpabuf_put_be16(msg, sizeof(psk) * 2); in wps_build_cred_network_key()
324 wpabuf_put_data(msg, hex, sizeof(psk) * 2); in wps_build_cred_network_key()
337 wpabuf_put_be16(msg, ATTR_NETWORK_KEY); in wps_build_cred_network_key()
338 wpabuf_put_be16(msg, wps->wps->network_key_len); in wps_build_cred_network_key()
339 wpabuf_put_data(msg, wps->wps->network_key, wps->wps->network_key_len); in wps_build_cred_network_key()
344 static int wps_build_cred_mac_addr(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_mac_addr() argument
347 wpabuf_put_be16(msg, ATTR_MAC_ADDR); in wps_build_cred_mac_addr()
348 wpabuf_put_be16(msg, ETH_ALEN); in wps_build_cred_mac_addr()
349 wpabuf_put_data(msg, wps->wps->dev.mac_addr, ETH_ALEN); in wps_build_cred_mac_addr()
388 struct wpabuf *msg, *plain; in wps_build_m7() local
396 msg = wpabuf_alloc(1000 + wps->wps->ap_settings_len); in wps_build_m7()
397 if (msg == NULL) { in wps_build_m7()
402 if (wps_build_version(msg) || in wps_build_m7()
403 wps_build_msg_type(msg, WPS_M7) || in wps_build_m7()
404 wps_build_registrar_nonce(wps, msg) || in wps_build_m7()
408 wps_build_encr_settings(wps, msg, plain) || in wps_build_m7()
409 wps_build_wfa_ext(msg, 0, NULL, 0, 0) || in wps_build_m7()
410 wps_build_authenticator(wps, msg)) { in wps_build_m7()
412 wpabuf_free(msg); in wps_build_m7()
430 return msg; in wps_build_m7()
436 struct wpabuf *msg; in wps_build_wsc_done() local
440 msg = wpabuf_alloc(1000); in wps_build_wsc_done()
441 if (msg == NULL) in wps_build_wsc_done()
444 if (wps_build_version(msg) || in wps_build_wsc_done()
445 wps_build_msg_type(msg, WPS_WSC_DONE) || in wps_build_wsc_done()
446 wps_build_enrollee_nonce(wps, msg) || in wps_build_wsc_done()
447 wps_build_registrar_nonce(wps, msg) || in wps_build_wsc_done()
448 wps_build_wfa_ext(msg, 0, NULL, 0, 0)) { in wps_build_wsc_done()
449 wpabuf_free(msg); in wps_build_wsc_done()
459 return msg; in wps_build_wsc_done()
466 struct wpabuf *msg; in wps_enrollee_get_msg() local
470 msg = wps_build_m1(wps); in wps_enrollee_get_msg()
474 msg = wps_build_m3(wps); in wps_enrollee_get_msg()
478 msg = wps_build_m5(wps); in wps_enrollee_get_msg()
482 msg = wps_build_m7(wps); in wps_enrollee_get_msg()
487 msg = wps_build_wsc_nack(wps); in wps_enrollee_get_msg()
491 msg = wps_build_wsc_ack(wps); in wps_enrollee_get_msg()
493 if (msg) { in wps_enrollee_get_msg()
499 msg = wps_build_wsc_nack(wps); in wps_enrollee_get_msg()
503 msg = wps_build_wsc_done(wps); in wps_enrollee_get_msg()
509 msg = NULL; in wps_enrollee_get_msg()
513 if (*op_code == WSC_MSG && msg) { in wps_enrollee_get_msg()
517 wps->last_msg = wpabuf_dup(msg); in wps_enrollee_get_msg()
520 return msg; in wps_enrollee_get_msg()
719 struct wpabuf msg; in wps_process_cred_e() local
729 wpabuf_set(&msg, cred, cred_len); in wps_process_cred_e()
730 if (wps_parse_msg(&msg, attr) < 0 || in wps_process_cred_e()
994 const struct wpabuf *msg, in wps_process_m2() argument
1031 wps_process_authenticator(wps, attr->authenticator, msg) || in wps_process_m2()
1130 const struct wpabuf *msg, in wps_process_m4() argument
1155 wps_process_authenticator(wps, attr->authenticator, msg) || in wps_process_m4()
1202 const struct wpabuf *msg, in wps_process_m6() argument
1227 wps_process_authenticator(wps, attr->authenticator, msg)) { in wps_process_m6()
1276 const struct wpabuf *msg, in wps_process_m8() argument
1301 wps_process_authenticator(wps, attr->authenticator, msg)) { in wps_process_m8()
1366 const struct wpabuf *msg) in wps_process_wsc_start() argument
1378 const struct wpabuf *msg) in wps_process_wsc_msg() argument
1391 if (wps_parse_msg(msg, attr) < 0) { in wps_process_wsc_msg()
1412 if (wps_validate_m2(msg) < 0) { in wps_process_wsc_msg()
1416 ret = wps_process_m2(wps, msg, attr); in wps_process_wsc_msg()
1419 if (wps_validate_m2d(msg) < 0) { in wps_process_wsc_msg()
1426 if (wps_validate_m4(msg) < 0) { in wps_process_wsc_msg()
1430 ret = wps_process_m4(wps, msg, attr); in wps_process_wsc_msg()
1437 if (wps_validate_m6(msg) < 0) { in wps_process_wsc_msg()
1441 ret = wps_process_m6(wps, msg, attr); in wps_process_wsc_msg()
1448 if (wps_validate_m8(msg) < 0) { in wps_process_wsc_msg()
1452 ret = wps_process_m8(wps, msg, attr); in wps_process_wsc_msg()
1476 wps->last_msg = wpabuf_dup(msg); in wps_process_wsc_msg()
1488 const struct wpabuf *msg) in wps_process_wsc_ack() argument
1501 if (wps_parse_msg(msg, attr) < 0) { in wps_process_wsc_ack()
1553 const struct wpabuf *msg) in wps_process_wsc_nack() argument
1567 if (wps_parse_msg(msg, attr) < 0) { in wps_process_wsc_nack()
1651 const struct wpabuf *msg) in wps_enrollee_process_msg() argument
1656 (unsigned long) wpabuf_len(msg), op_code); in wps_enrollee_process_msg()
1661 if (wps_parse_msg(msg, &attr) == 0 && attr.msg_type) { in wps_enrollee_process_msg()
1671 return wps_process_wsc_start(wps, msg); in wps_enrollee_process_msg()
1674 return wps_process_wsc_msg(wps, msg); in wps_enrollee_process_msg()
1676 if (wps_validate_wsc_ack(msg) < 0) in wps_enrollee_process_msg()
1678 return wps_process_wsc_ack(wps, msg); in wps_enrollee_process_msg()
1680 if (wps_validate_wsc_nack(msg) < 0) in wps_enrollee_process_msg()
1682 return wps_process_wsc_nack(wps, msg); in wps_enrollee_process_msg()