Lines Matching refs:msg
19 static int wps_build_wps_state(struct wps_data *wps, struct wpabuf *msg) in wps_build_wps_state() argument
28 wpabuf_put_be16(msg, ATTR_WPS_STATE); in wps_build_wps_state()
29 wpabuf_put_be16(msg, 1); in wps_build_wps_state()
30 wpabuf_put_u8(msg, state); in wps_build_wps_state()
35 static int wps_build_e_hash(struct wps_data *wps, struct wpabuf *msg) in wps_build_e_hash() argument
54 wpabuf_put_be16(msg, ATTR_E_HASH1); in wps_build_e_hash()
55 wpabuf_put_be16(msg, SHA256_MAC_LEN); in wps_build_e_hash()
56 hash = wpabuf_put(msg, SHA256_MAC_LEN); in wps_build_e_hash()
70 wpabuf_put_be16(msg, ATTR_E_HASH2); in wps_build_e_hash()
71 wpabuf_put_be16(msg, SHA256_MAC_LEN); in wps_build_e_hash()
72 hash = wpabuf_put(msg, SHA256_MAC_LEN); in wps_build_e_hash()
83 static int wps_build_e_snonce1(struct wps_data *wps, struct wpabuf *msg) in wps_build_e_snonce1() argument
86 wpabuf_put_be16(msg, ATTR_E_SNONCE1); in wps_build_e_snonce1()
87 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN); in wps_build_e_snonce1()
88 wpabuf_put_data(msg, wps->snonce, WPS_SECRET_NONCE_LEN); in wps_build_e_snonce1()
93 static int wps_build_e_snonce2(struct wps_data *wps, struct wpabuf *msg) in wps_build_e_snonce2() argument
96 wpabuf_put_be16(msg, ATTR_E_SNONCE2); in wps_build_e_snonce2()
97 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN); in wps_build_e_snonce2()
98 wpabuf_put_data(msg, wps->snonce + WPS_SECRET_NONCE_LEN, in wps_build_e_snonce2()
106 struct wpabuf *msg; in wps_build_m1() local
115 msg = wpabuf_alloc(1000); in wps_build_m1()
116 if (msg == NULL) in wps_build_m1()
137 if (wps_build_version(msg) || in wps_build_m1()
138 wps_build_msg_type(msg, WPS_M1) || in wps_build_m1()
139 wps_build_uuid_e(msg, wps->uuid_e) || in wps_build_m1()
140 wps_build_mac_addr(msg, wps->mac_addr_e) || in wps_build_m1()
141 wps_build_enrollee_nonce(wps, msg) || in wps_build_m1()
142 wps_build_public_key(wps, msg) || in wps_build_m1()
143 wps_build_auth_type_flags(wps, msg) || in wps_build_m1()
144 wps_build_encr_type_flags(wps, msg) || in wps_build_m1()
145 wps_build_conn_type_flags(wps, msg) || in wps_build_m1()
146 wps_build_config_methods(msg, config_methods) || in wps_build_m1()
147 wps_build_wps_state(wps, msg) || in wps_build_m1()
148 wps_build_device_attrs(&wps->wps->dev, msg) || in wps_build_m1()
149 wps_build_rf_bands(&wps->wps->dev, msg, in wps_build_m1()
151 wps_build_assoc_state(wps, msg) || in wps_build_m1()
152 wps_build_dev_password_id(msg, wps->dev_pw_id) || in wps_build_m1()
153 wps_build_config_error(msg, WPS_CFG_NO_ERROR) || in wps_build_m1()
154 wps_build_os_version(&wps->wps->dev, msg) || in wps_build_m1()
155 wps_build_wfa_ext(msg, 0, NULL, 0) || in wps_build_m1()
156 wps_build_vendor_ext_m1(&wps->wps->dev, msg)) { in wps_build_m1()
157 wpabuf_free(msg); in wps_build_m1()
162 return msg; in wps_build_m1()
168 struct wpabuf *msg; in wps_build_m3() local
184 msg = wpabuf_alloc(1000); in wps_build_m3()
185 if (msg == NULL) in wps_build_m3()
188 if (wps_build_version(msg) || in wps_build_m3()
189 wps_build_msg_type(msg, WPS_M3) || in wps_build_m3()
190 wps_build_registrar_nonce(wps, msg) || in wps_build_m3()
191 wps_build_e_hash(wps, msg) || in wps_build_m3()
192 wps_build_wfa_ext(msg, 0, NULL, 0) || in wps_build_m3()
193 wps_build_authenticator(wps, msg)) { in wps_build_m3()
194 wpabuf_free(msg); in wps_build_m3()
199 return msg; in wps_build_m3()
205 struct wpabuf *msg, *plain; in wps_build_m5() local
213 msg = wpabuf_alloc(1000); in wps_build_m5()
214 if (msg == NULL) { in wps_build_m5()
219 if (wps_build_version(msg) || in wps_build_m5()
220 wps_build_msg_type(msg, WPS_M5) || in wps_build_m5()
221 wps_build_registrar_nonce(wps, msg) || in wps_build_m5()
224 wps_build_encr_settings(wps, msg, plain) || in wps_build_m5()
225 wps_build_wfa_ext(msg, 0, NULL, 0) || in wps_build_m5()
226 wps_build_authenticator(wps, msg)) { in wps_build_m5()
228 wpabuf_free(msg); in wps_build_m5()
234 return msg; in wps_build_m5()
238 static int wps_build_cred_ssid(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_ssid() argument
241 wpabuf_put_be16(msg, ATTR_SSID); in wps_build_cred_ssid()
242 wpabuf_put_be16(msg, wps->wps->ssid_len); in wps_build_cred_ssid()
243 wpabuf_put_data(msg, wps->wps->ssid, wps->wps->ssid_len); in wps_build_cred_ssid()
248 static int wps_build_cred_auth_type(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_auth_type() argument
265 wpabuf_put_be16(msg, ATTR_AUTH_TYPE); in wps_build_cred_auth_type()
266 wpabuf_put_be16(msg, 2); in wps_build_cred_auth_type()
267 wpabuf_put_be16(msg, auth_type); in wps_build_cred_auth_type()
272 static int wps_build_cred_encr_type(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_encr_type() argument
289 wpabuf_put_be16(msg, ATTR_ENCR_TYPE); in wps_build_cred_encr_type()
290 wpabuf_put_be16(msg, 2); in wps_build_cred_encr_type()
291 wpabuf_put_be16(msg, encr_type); in wps_build_cred_encr_type()
296 static int wps_build_cred_network_key(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_network_key() argument
314 wpabuf_put_be16(msg, ATTR_NETWORK_KEY); in wps_build_cred_network_key()
315 wpabuf_put_be16(msg, sizeof(psk) * 2); in wps_build_cred_network_key()
316 wpabuf_put_data(msg, hex, sizeof(psk) * 2); in wps_build_cred_network_key()
327 wpabuf_put_be16(msg, ATTR_NETWORK_KEY); in wps_build_cred_network_key()
328 wpabuf_put_be16(msg, wps->wps->network_key_len); in wps_build_cred_network_key()
329 wpabuf_put_data(msg, wps->wps->network_key, wps->wps->network_key_len); in wps_build_cred_network_key()
334 static int wps_build_cred_mac_addr(struct wps_data *wps, struct wpabuf *msg) in wps_build_cred_mac_addr() argument
337 wpabuf_put_be16(msg, ATTR_MAC_ADDR); in wps_build_cred_mac_addr()
338 wpabuf_put_be16(msg, ETH_ALEN); in wps_build_cred_mac_addr()
339 wpabuf_put_data(msg, wps->wps->dev.mac_addr, ETH_ALEN); in wps_build_cred_mac_addr()
374 struct wpabuf *msg, *plain; in wps_build_m7() local
382 msg = wpabuf_alloc(1000 + wps->wps->ap_settings_len); in wps_build_m7()
383 if (msg == NULL) { in wps_build_m7()
388 if (wps_build_version(msg) || in wps_build_m7()
389 wps_build_msg_type(msg, WPS_M7) || in wps_build_m7()
390 wps_build_registrar_nonce(wps, msg) || in wps_build_m7()
394 wps_build_encr_settings(wps, msg, plain) || in wps_build_m7()
395 wps_build_wfa_ext(msg, 0, NULL, 0) || in wps_build_m7()
396 wps_build_authenticator(wps, msg)) { in wps_build_m7()
398 wpabuf_free(msg); in wps_build_m7()
414 return msg; in wps_build_m7()
420 struct wpabuf *msg; in wps_build_wsc_done() local
424 msg = wpabuf_alloc(1000); in wps_build_wsc_done()
425 if (msg == NULL) in wps_build_wsc_done()
428 if (wps_build_version(msg) || in wps_build_wsc_done()
429 wps_build_msg_type(msg, WPS_WSC_DONE) || in wps_build_wsc_done()
430 wps_build_enrollee_nonce(wps, msg) || in wps_build_wsc_done()
431 wps_build_registrar_nonce(wps, msg) || in wps_build_wsc_done()
432 wps_build_wfa_ext(msg, 0, NULL, 0)) { in wps_build_wsc_done()
433 wpabuf_free(msg); in wps_build_wsc_done()
443 return msg; in wps_build_wsc_done()
450 struct wpabuf *msg; in wps_enrollee_get_msg() local
454 msg = wps_build_m1(wps); in wps_enrollee_get_msg()
458 msg = wps_build_m3(wps); in wps_enrollee_get_msg()
462 msg = wps_build_m5(wps); in wps_enrollee_get_msg()
466 msg = wps_build_m7(wps); in wps_enrollee_get_msg()
471 msg = wps_build_wsc_nack(wps); in wps_enrollee_get_msg()
475 msg = wps_build_wsc_ack(wps); in wps_enrollee_get_msg()
477 if (msg) { in wps_enrollee_get_msg()
483 msg = wps_build_wsc_nack(wps); in wps_enrollee_get_msg()
487 msg = wps_build_wsc_done(wps); in wps_enrollee_get_msg()
493 msg = NULL; in wps_enrollee_get_msg()
497 if (*op_code == WSC_MSG && msg) { in wps_enrollee_get_msg()
501 wps->last_msg = wpabuf_dup(msg); in wps_enrollee_get_msg()
504 return msg; in wps_enrollee_get_msg()
703 struct wpabuf msg; in wps_process_cred_e() local
708 wpabuf_set(&msg, cred, cred_len); in wps_process_cred_e()
709 if (wps_parse_msg(&msg, &attr) < 0 || in wps_process_cred_e()
946 const struct wpabuf *msg, in wps_process_m2() argument
983 wps_process_authenticator(wps, attr->authenticator, msg) || in wps_process_m2()
1082 const struct wpabuf *msg, in wps_process_m4() argument
1098 wps_process_authenticator(wps, attr->authenticator, msg) || in wps_process_m4()
1137 const struct wpabuf *msg, in wps_process_m6() argument
1153 wps_process_authenticator(wps, attr->authenticator, msg)) { in wps_process_m6()
1194 const struct wpabuf *msg, in wps_process_m8() argument
1210 wps_process_authenticator(wps, attr->authenticator, msg)) { in wps_process_m8()
1264 const struct wpabuf *msg) in wps_process_wsc_msg() argument
1271 if (wps_parse_msg(msg, &attr) < 0) in wps_process_wsc_msg()
1288 if (wps_validate_m2(msg) < 0) in wps_process_wsc_msg()
1290 ret = wps_process_m2(wps, msg, &attr); in wps_process_wsc_msg()
1293 if (wps_validate_m2d(msg) < 0) in wps_process_wsc_msg()
1298 if (wps_validate_m4(msg) < 0) in wps_process_wsc_msg()
1300 ret = wps_process_m4(wps, msg, &attr); in wps_process_wsc_msg()
1307 if (wps_validate_m6(msg) < 0) in wps_process_wsc_msg()
1309 ret = wps_process_m6(wps, msg, &attr); in wps_process_wsc_msg()
1316 if (wps_validate_m8(msg) < 0) in wps_process_wsc_msg()
1318 ret = wps_process_m8(wps, msg, &attr); in wps_process_wsc_msg()
1341 wps->last_msg = wpabuf_dup(msg); in wps_process_wsc_msg()
1349 const struct wpabuf *msg) in wps_process_wsc_ack() argument
1355 if (wps_parse_msg(msg, &attr) < 0) in wps_process_wsc_ack()
1395 const struct wpabuf *msg) in wps_process_wsc_nack() argument
1402 if (wps_parse_msg(msg, &attr) < 0) in wps_process_wsc_nack()
1474 const struct wpabuf *msg) in wps_enrollee_process_msg() argument
1479 (unsigned long) wpabuf_len(msg), op_code); in wps_enrollee_process_msg()
1484 if (wps_parse_msg(msg, &attr) == 0 && attr.msg_type) { in wps_enrollee_process_msg()
1495 return wps_process_wsc_msg(wps, msg); in wps_enrollee_process_msg()
1497 if (wps_validate_wsc_ack(msg) < 0) in wps_enrollee_process_msg()
1499 return wps_process_wsc_ack(wps, msg); in wps_enrollee_process_msg()
1501 if (wps_validate_wsc_nack(msg) < 0) in wps_enrollee_process_msg()
1503 return wps_process_wsc_nack(wps, msg); in wps_enrollee_process_msg()