Lines Matching refs:msg

21 int wps_build_public_key(struct wps_data *wps, struct wpabuf *msg)  in wps_build_public_key()  argument
81 wpabuf_put_be16(msg, ATTR_PUBLIC_KEY); in wps_build_public_key()
82 wpabuf_put_be16(msg, wpabuf_len(pubkey)); in wps_build_public_key()
83 wpabuf_put_buf(msg, pubkey); in wps_build_public_key()
97 int wps_build_req_type(struct wpabuf *msg, enum wps_request_type type) in wps_build_req_type() argument
100 wpabuf_put_be16(msg, ATTR_REQUEST_TYPE); in wps_build_req_type()
101 wpabuf_put_be16(msg, 1); in wps_build_req_type()
102 wpabuf_put_u8(msg, type); in wps_build_req_type()
107 int wps_build_resp_type(struct wpabuf *msg, enum wps_response_type type) in wps_build_resp_type() argument
110 wpabuf_put_be16(msg, ATTR_RESPONSE_TYPE); in wps_build_resp_type()
111 wpabuf_put_be16(msg, 1); in wps_build_resp_type()
112 wpabuf_put_u8(msg, type); in wps_build_resp_type()
117 int wps_build_config_methods(struct wpabuf *msg, u16 methods) in wps_build_config_methods() argument
120 wpabuf_put_be16(msg, ATTR_CONFIG_METHODS); in wps_build_config_methods()
121 wpabuf_put_be16(msg, 2); in wps_build_config_methods()
122 wpabuf_put_be16(msg, methods); in wps_build_config_methods()
127 int wps_build_uuid_e(struct wpabuf *msg, const u8 *uuid) in wps_build_uuid_e() argument
129 if (wpabuf_tailroom(msg) < 4 + WPS_UUID_LEN) in wps_build_uuid_e()
132 wpabuf_put_be16(msg, ATTR_UUID_E); in wps_build_uuid_e()
133 wpabuf_put_be16(msg, WPS_UUID_LEN); in wps_build_uuid_e()
134 wpabuf_put_data(msg, uuid, WPS_UUID_LEN); in wps_build_uuid_e()
139 int wps_build_dev_password_id(struct wpabuf *msg, u16 id) in wps_build_dev_password_id() argument
142 wpabuf_put_be16(msg, ATTR_DEV_PASSWORD_ID); in wps_build_dev_password_id()
143 wpabuf_put_be16(msg, 2); in wps_build_dev_password_id()
144 wpabuf_put_be16(msg, id); in wps_build_dev_password_id()
149 int wps_build_config_error(struct wpabuf *msg, u16 err) in wps_build_config_error() argument
152 wpabuf_put_be16(msg, ATTR_CONFIG_ERROR); in wps_build_config_error()
153 wpabuf_put_be16(msg, 2); in wps_build_config_error()
154 wpabuf_put_be16(msg, err); in wps_build_config_error()
159 int wps_build_authenticator(struct wps_data *wps, struct wpabuf *msg) in wps_build_authenticator() argument
176 addr[1] = wpabuf_head(msg); in wps_build_authenticator()
177 len[1] = wpabuf_len(msg); in wps_build_authenticator()
183 wpabuf_put_be16(msg, ATTR_AUTHENTICATOR); in wps_build_authenticator()
184 wpabuf_put_be16(msg, WPS_AUTHENTICATOR_LEN); in wps_build_authenticator()
185 wpabuf_put_data(msg, hash, WPS_AUTHENTICATOR_LEN); in wps_build_authenticator()
191 int wps_build_version(struct wpabuf *msg) in wps_build_version() argument
198 if (wpabuf_tailroom(msg) < 5) in wps_build_version()
201 wpabuf_put_be16(msg, ATTR_VERSION); in wps_build_version()
202 wpabuf_put_be16(msg, 1); in wps_build_version()
203 wpabuf_put_u8(msg, 0x10); in wps_build_version()
208 int wps_build_wfa_ext(struct wpabuf *msg, int req_to_enroll, in wps_build_wfa_ext() argument
219 if (wpabuf_tailroom(msg) < in wps_build_wfa_ext()
223 wpabuf_put_be16(msg, ATTR_VENDOR_EXT); in wps_build_wfa_ext()
224 len = wpabuf_put(msg, 2); /* to be filled */ in wps_build_wfa_ext()
225 wpabuf_put_be24(msg, WPS_VENDOR_ID_WFA); in wps_build_wfa_ext()
228 wpabuf_put_u8(msg, WFA_ELEM_VERSION2); in wps_build_wfa_ext()
229 wpabuf_put_u8(msg, 1); in wps_build_wfa_ext()
230 wpabuf_put_u8(msg, WPS_VERSION); in wps_build_wfa_ext()
234 wpabuf_put_u8(msg, WFA_ELEM_REQUEST_TO_ENROLL); in wps_build_wfa_ext()
235 wpabuf_put_u8(msg, 1); in wps_build_wfa_ext()
236 wpabuf_put_u8(msg, 1); in wps_build_wfa_ext()
243 wpabuf_put_u8(msg, WFA_ELEM_AUTHORIZEDMACS); in wps_build_wfa_ext()
244 wpabuf_put_u8(msg, auth_macs_count * ETH_ALEN); in wps_build_wfa_ext()
245 wpabuf_put_data(msg, auth_macs, auth_macs_count * ETH_ALEN); in wps_build_wfa_ext()
254 wpabuf_put_u8(msg, WFA_ELEM_MULTI_AP); in wps_build_wfa_ext()
255 wpabuf_put_u8(msg, 1); /* length */ in wps_build_wfa_ext()
256 wpabuf_put_u8(msg, multi_ap_subelem); in wps_build_wfa_ext()
259 WPA_PUT_BE16(len, (u8 *) wpabuf_put(msg, 0) - len - 2); in wps_build_wfa_ext()
263 if (wpabuf_tailroom(msg) < 5) in wps_build_wfa_ext()
267 wpabuf_put_be16(msg, ATTR_EXTENSIBILITY_TEST); in wps_build_wfa_ext()
268 wpabuf_put_be16(msg, 1); in wps_build_wfa_ext()
269 wpabuf_put_u8(msg, 42); in wps_build_wfa_ext()
276 int wps_build_msg_type(struct wpabuf *msg, enum wps_msg_type msg_type) in wps_build_msg_type() argument
279 wpabuf_put_be16(msg, ATTR_MSG_TYPE); in wps_build_msg_type()
280 wpabuf_put_be16(msg, 1); in wps_build_msg_type()
281 wpabuf_put_u8(msg, msg_type); in wps_build_msg_type()
286 int wps_build_enrollee_nonce(struct wps_data *wps, struct wpabuf *msg) in wps_build_enrollee_nonce() argument
289 wpabuf_put_be16(msg, ATTR_ENROLLEE_NONCE); in wps_build_enrollee_nonce()
290 wpabuf_put_be16(msg, WPS_NONCE_LEN); in wps_build_enrollee_nonce()
291 wpabuf_put_data(msg, wps->nonce_e, WPS_NONCE_LEN); in wps_build_enrollee_nonce()
296 int wps_build_registrar_nonce(struct wps_data *wps, struct wpabuf *msg) in wps_build_registrar_nonce() argument
299 wpabuf_put_be16(msg, ATTR_REGISTRAR_NONCE); in wps_build_registrar_nonce()
300 wpabuf_put_be16(msg, WPS_NONCE_LEN); in wps_build_registrar_nonce()
301 wpabuf_put_data(msg, wps->nonce_r, WPS_NONCE_LEN); in wps_build_registrar_nonce()
306 int wps_build_auth_type_flags(struct wps_data *wps, struct wpabuf *msg) in wps_build_auth_type_flags() argument
326 wpabuf_put_be16(msg, ATTR_AUTH_TYPE_FLAGS); in wps_build_auth_type_flags()
327 wpabuf_put_be16(msg, 2); in wps_build_auth_type_flags()
328 wpabuf_put_be16(msg, auth_types); in wps_build_auth_type_flags()
333 int wps_build_encr_type_flags(struct wps_data *wps, struct wpabuf *msg) in wps_build_encr_type_flags() argument
350 wpabuf_put_be16(msg, ATTR_ENCR_TYPE_FLAGS); in wps_build_encr_type_flags()
351 wpabuf_put_be16(msg, 2); in wps_build_encr_type_flags()
352 wpabuf_put_be16(msg, encr_types); in wps_build_encr_type_flags()
357 int wps_build_conn_type_flags(struct wps_data *wps, struct wpabuf *msg) in wps_build_conn_type_flags() argument
360 wpabuf_put_be16(msg, ATTR_CONN_TYPE_FLAGS); in wps_build_conn_type_flags()
361 wpabuf_put_be16(msg, 1); in wps_build_conn_type_flags()
362 wpabuf_put_u8(msg, WPS_CONN_ESS); in wps_build_conn_type_flags()
367 int wps_build_assoc_state(struct wps_data *wps, struct wpabuf *msg) in wps_build_assoc_state() argument
370 wpabuf_put_be16(msg, ATTR_ASSOC_STATE); in wps_build_assoc_state()
371 wpabuf_put_be16(msg, 2); in wps_build_assoc_state()
372 wpabuf_put_be16(msg, WPS_ASSOC_NOT_ASSOC); in wps_build_assoc_state()
377 int wps_build_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg) in wps_build_key_wrap_auth() argument
382 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg), in wps_build_key_wrap_auth()
383 wpabuf_len(msg), hash) < 0) in wps_build_key_wrap_auth()
386 wpabuf_put_be16(msg, ATTR_KEY_WRAP_AUTH); in wps_build_key_wrap_auth()
387 wpabuf_put_be16(msg, WPS_KWA_LEN); in wps_build_key_wrap_auth()
388 wpabuf_put_data(msg, hash, WPS_KWA_LEN); in wps_build_key_wrap_auth()
393 int wps_build_encr_settings(struct wps_data *wps, struct wpabuf *msg, in wps_build_encr_settings() argument
406 wpabuf_put_be16(msg, ATTR_ENCR_SETTINGS); in wps_build_encr_settings()
407 wpabuf_put_be16(msg, block_size + wpabuf_len(plain)); in wps_build_encr_settings()
409 iv = wpabuf_put(msg, block_size); in wps_build_encr_settings()
413 data = wpabuf_put(msg, 0); in wps_build_encr_settings()
414 wpabuf_put_buf(msg, plain); in wps_build_encr_settings()
423 int wps_build_oob_dev_pw(struct wpabuf *msg, u16 dev_pw_id, in wps_build_oob_dev_pw() argument
446 wpabuf_put_be16(msg, ATTR_OOB_DEVICE_PASSWORD); in wps_build_oob_dev_pw()
447 wpabuf_put_be16(msg, WPS_OOB_PUBKEY_HASH_LEN + 2 + dev_pw_len); in wps_build_oob_dev_pw()
450 wpabuf_put_data(msg, pubkey_hash, WPS_OOB_PUBKEY_HASH_LEN); in wps_build_oob_dev_pw()
451 wpabuf_put_be16(msg, dev_pw_id); in wps_build_oob_dev_pw()
455 wpabuf_put_data(msg, dev_pw, dev_pw_len); in wps_build_oob_dev_pw()
495 int wps_build_mac_addr(struct wpabuf *msg, const u8 *addr) in wps_build_mac_addr() argument
499 wpabuf_put_be16(msg, ATTR_MAC_ADDR); in wps_build_mac_addr()
500 wpabuf_put_be16(msg, ETH_ALEN); in wps_build_mac_addr()
501 wpabuf_put_data(msg, addr, ETH_ALEN); in wps_build_mac_addr()
506 int wps_build_rf_bands_attr(struct wpabuf *msg, u8 rf_bands) in wps_build_rf_bands_attr() argument
509 wpabuf_put_be16(msg, ATTR_RF_BANDS); in wps_build_rf_bands_attr()
510 wpabuf_put_be16(msg, 1); in wps_build_rf_bands_attr()
511 wpabuf_put_u8(msg, rf_bands); in wps_build_rf_bands_attr()
516 int wps_build_ap_channel(struct wpabuf *msg, u16 ap_channel) in wps_build_ap_channel() argument
519 wpabuf_put_be16(msg, ATTR_AP_CHANNEL); in wps_build_ap_channel()
520 wpabuf_put_be16(msg, 2); in wps_build_ap_channel()
521 wpabuf_put_be16(msg, ap_channel); in wps_build_ap_channel()