Lines Matching defs:msg
19 static int wps_build_wps_state(struct wps_data *wps, struct wpabuf *msg)
28 wpabuf_put_be16(msg, ATTR_WPS_STATE);
29 wpabuf_put_be16(msg, 1);
30 wpabuf_put_u8(msg, state);
35 static int wps_build_e_hash(struct wps_data *wps, struct wpabuf *msg)
54 wpabuf_put_be16(msg, ATTR_E_HASH1);
55 wpabuf_put_be16(msg, SHA256_MAC_LEN);
56 hash = wpabuf_put(msg, SHA256_MAC_LEN);
70 wpabuf_put_be16(msg, ATTR_E_HASH2);
71 wpabuf_put_be16(msg, SHA256_MAC_LEN);
72 hash = wpabuf_put(msg, SHA256_MAC_LEN);
83 static int wps_build_e_snonce1(struct wps_data *wps, struct wpabuf *msg)
86 wpabuf_put_be16(msg, ATTR_E_SNONCE1);
87 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN);
88 wpabuf_put_data(msg, wps->snonce, WPS_SECRET_NONCE_LEN);
93 static int wps_build_e_snonce2(struct wps_data *wps, struct wpabuf *msg)
96 wpabuf_put_be16(msg, ATTR_E_SNONCE2);
97 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN);
98 wpabuf_put_data(msg, wps->snonce + WPS_SECRET_NONCE_LEN,
106 struct wpabuf *msg;
116 msg = wpabuf_alloc(1000);
117 if (msg == NULL)
141 if (wps_build_version(msg) ||
142 wps_build_msg_type(msg, WPS_M1) ||
143 wps_build_uuid_e(msg, wps->uuid_e) ||
144 wps_build_mac_addr(msg, wps->mac_addr_e) ||
145 wps_build_enrollee_nonce(wps, msg) ||
146 wps_build_public_key(wps, msg) ||
147 wps_build_auth_type_flags(wps, msg) ||
148 wps_build_encr_type_flags(wps, msg) ||
149 wps_build_conn_type_flags(wps, msg) ||
150 wps_build_config_methods(msg, config_methods) ||
151 wps_build_wps_state(wps, msg) ||
152 wps_build_device_attrs(&wps->wps->dev, msg) ||
153 wps_build_rf_bands(&wps->wps->dev, msg,
155 wps_build_assoc_state(wps, msg) ||
156 wps_build_dev_password_id(msg, wps->dev_pw_id) ||
157 wps_build_config_error(msg, WPS_CFG_NO_ERROR) ||
158 wps_build_os_version(&wps->wps->dev, msg) ||
159 wps_build_wfa_ext(msg, 0, NULL, 0, multi_ap_backhaul_sta) ||
160 wps_build_vendor_ext_m1(&wps->wps->dev, msg)) {
161 wpabuf_free(msg);
166 return msg;
172 struct wpabuf *msg;
189 msg = wpabuf_alloc(1000);
190 if (msg == NULL)
193 if (wps_build_version(msg) ||
194 wps_build_msg_type(msg, WPS_M3) ||
195 wps_build_registrar_nonce(wps, msg) ||
196 wps_build_e_hash(wps, msg) ||
197 wps_build_wfa_ext(msg, 0, NULL, 0, 0) ||
198 wps_build_authenticator(wps, msg)) {
199 wpabuf_free(msg);
204 return msg;
210 struct wpabuf *msg, *plain;
218 msg = wpabuf_alloc(1000);
219 if (msg == NULL) {
224 if (wps_build_version(msg) ||
225 wps_build_msg_type(msg, WPS_M5) ||
226 wps_build_registrar_nonce(wps, msg) ||
229 wps_build_encr_settings(wps, msg, plain) ||
230 wps_build_wfa_ext(msg, 0, NULL, 0, 0) ||
231 wps_build_authenticator(wps, msg)) {
233 wpabuf_free(msg);
239 return msg;
243 static int wps_build_cred_ssid(struct wps_data *wps, struct wpabuf *msg)
246 wpabuf_put_be16(msg, ATTR_SSID);
247 wpabuf_put_be16(msg, wps->wps->ssid_len);
248 wpabuf_put_data(msg, wps->wps->ssid, wps->wps->ssid_len);
253 static int wps_build_cred_auth_type(struct wps_data *wps, struct wpabuf *msg)
270 wpabuf_put_be16(msg, ATTR_AUTH_TYPE);
271 wpabuf_put_be16(msg, 2);
272 wpabuf_put_be16(msg, auth_type);
277 static int wps_build_cred_encr_type(struct wps_data *wps, struct wpabuf *msg)
294 wpabuf_put_be16(msg, ATTR_ENCR_TYPE);
295 wpabuf_put_be16(msg, 2);
296 wpabuf_put_be16(msg, encr_type);
301 static int wps_build_cred_network_key(struct wps_data *wps, struct wpabuf *msg)
319 wpabuf_put_be16(msg, ATTR_NETWORK_KEY);
320 wpabuf_put_be16(msg, sizeof(psk) * 2);
321 wpabuf_put_data(msg, hex, sizeof(psk) * 2);
332 wpabuf_put_be16(msg, ATTR_NETWORK_KEY);
333 wpabuf_put_be16(msg, wps->wps->network_key_len);
334 wpabuf_put_data(msg, wps->wps->network_key, wps->wps->network_key_len);
339 static int wps_build_cred_mac_addr(struct wps_data *wps, struct wpabuf *msg)
342 wpabuf_put_be16(msg, ATTR_MAC_ADDR);
343 wpabuf_put_be16(msg, ETH_ALEN);
344 wpabuf_put_data(msg, wps->wps->dev.mac_addr, ETH_ALEN);
379 struct wpabuf *msg, *plain;
387 msg = wpabuf_alloc(1000 + wps->wps->ap_settings_len);
388 if (msg == NULL) {
393 if (wps_build_version(msg) ||
394 wps_build_msg_type(msg, WPS_M7) ||
395 wps_build_registrar_nonce(wps, msg) ||
399 wps_build_encr_settings(wps, msg, plain) ||
400 wps_build_wfa_ext(msg, 0, NULL, 0, 0) ||
401 wps_build_authenticator(wps, msg)) {
403 wpabuf_free(msg);
419 return msg;
425 struct wpabuf *msg;
429 msg = wpabuf_alloc(1000);
430 if (msg == NULL)
433 if (wps_build_version(msg) ||
434 wps_build_msg_type(msg, WPS_WSC_DONE) ||
435 wps_build_enrollee_nonce(wps, msg) ||
436 wps_build_registrar_nonce(wps, msg) ||
437 wps_build_wfa_ext(msg, 0, NULL, 0, 0)) {
438 wpabuf_free(msg);
448 return msg;
455 struct wpabuf *msg;
459 msg = wps_build_m1(wps);
463 msg = wps_build_m3(wps);
467 msg = wps_build_m5(wps);
471 msg = wps_build_m7(wps);
476 msg = wps_build_wsc_nack(wps);
480 msg = wps_build_wsc_ack(wps);
482 if (msg) {
488 msg = wps_build_wsc_nack(wps);
492 msg = wps_build_wsc_done(wps);
498 msg = NULL;
502 if (*op_code == WSC_MSG && msg) {
506 wps->last_msg = wpabuf_dup(msg);
509 return msg;
708 struct wpabuf msg;
713 wpabuf_set(&msg, cred, cred_len);
714 if (wps_parse_msg(&msg, &attr) < 0 ||
960 const struct wpabuf *msg,
997 wps_process_authenticator(wps, attr->authenticator, msg) ||
1096 const struct wpabuf *msg,
1112 wps_process_authenticator(wps, attr->authenticator, msg) ||
1151 const struct wpabuf *msg,
1167 wps_process_authenticator(wps, attr->authenticator, msg)) {
1208 const struct wpabuf *msg,
1224 wps_process_authenticator(wps, attr->authenticator, msg)) {
1278 const struct wpabuf *msg)
1285 if (wps_parse_msg(msg, &attr) < 0)
1302 if (wps_validate_m2(msg) < 0)
1304 ret = wps_process_m2(wps, msg, &attr);
1307 if (wps_validate_m2d(msg) < 0)
1312 if (wps_validate_m4(msg) < 0)
1314 ret = wps_process_m4(wps, msg, &attr);
1321 if (wps_validate_m6(msg) < 0)
1323 ret = wps_process_m6(wps, msg, &attr);
1330 if (wps_validate_m8(msg) < 0)
1332 ret = wps_process_m8(wps, msg, &attr);
1355 wps->last_msg = wpabuf_dup(msg);
1363 const struct wpabuf *msg)
1369 if (wps_parse_msg(msg, &attr) < 0)
1409 const struct wpabuf *msg)
1416 if (wps_parse_msg(msg, &attr) < 0)
1488 const struct wpabuf *msg)
1493 (unsigned long) wpabuf_len(msg), op_code);
1498 if (wps_parse_msg(msg, &attr) == 0 && attr.msg_type) {
1509 return wps_process_wsc_msg(wps, msg);
1511 if (wps_validate_wsc_ack(msg) < 0)
1513 return wps_process_wsc_ack(wps, msg);
1515 if (wps_validate_wsc_nack(msg) < 0)
1517 return wps_process_wsc_nack(wps, msg);