• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/wpa/src/wps/

Lines Matching refs:msg

477 static int wps_build_wps_state(struct wps_context *wps, struct wpabuf *msg)
481 wpabuf_put_be16(msg, ATTR_WPS_STATE);
482 wpabuf_put_be16(msg, 1);
483 wpabuf_put_u8(msg, wps->wps_state);
502 wpabuf_free(p2->msg);
514 struct wpabuf *msg)
518 wpabuf_put_be16(msg, ATTR_AP_SETUP_LOCKED);
519 wpabuf_put_be16(msg, 1);
520 wpabuf_put_u8(msg, 1);
527 struct wpabuf *msg)
532 wpabuf_put_be16(msg, ATTR_SELECTED_REGISTRAR);
533 wpabuf_put_be16(msg, 1);
534 wpabuf_put_u8(msg, 1);
540 struct wpabuf *msg)
548 wpabuf_put_be16(msg, ATTR_DEV_PASSWORD_ID);
549 wpabuf_put_be16(msg, 2);
550 wpabuf_put_be16(msg, id);
556 struct wpabuf *msg)
565 return wps_build_uuid_e(msg, reg->wps->uuid);
593 struct wpabuf *msg)
608 wpabuf_put_be16(msg, ATTR_SELECTED_REGISTRAR_CONFIG_METHODS);
609 wpabuf_put_be16(msg, 2);
610 wpabuf_put_be16(msg, methods);
616 struct wpabuf *msg)
627 wpabuf_put_be16(msg, ATTR_CONFIG_METHODS);
628 wpabuf_put_be16(msg, 2);
629 wpabuf_put_be16(msg, methods);
635 struct wpabuf *msg)
637 return wps_build_config_methods(msg, reg->wps->config_methods);
1467 static int wps_build_uuid_r(struct wps_data *wps, struct wpabuf *msg)
1470 wpabuf_put_be16(msg, ATTR_UUID_R);
1471 wpabuf_put_be16(msg, WPS_UUID_LEN);
1472 wpabuf_put_data(msg, wps->uuid_r, WPS_UUID_LEN);
1477 static int wps_build_r_hash(struct wps_data *wps, struct wpabuf *msg)
1496 wpabuf_put_be16(msg, ATTR_R_HASH1);
1497 wpabuf_put_be16(msg, SHA256_MAC_LEN);
1498 hash = wpabuf_put(msg, SHA256_MAC_LEN);
1512 wpabuf_put_be16(msg, ATTR_R_HASH2);
1513 wpabuf_put_be16(msg, SHA256_MAC_LEN);
1514 hash = wpabuf_put(msg, SHA256_MAC_LEN);
1525 static int wps_build_r_snonce1(struct wps_data *wps, struct wpabuf *msg)
1528 wpabuf_put_be16(msg, ATTR_R_SNONCE1);
1529 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN);
1530 wpabuf_put_data(msg, wps->snonce, WPS_SECRET_NONCE_LEN);
1535 static int wps_build_r_snonce2(struct wps_data *wps, struct wpabuf *msg)
1538 wpabuf_put_be16(msg, ATTR_R_SNONCE2);
1539 wpabuf_put_be16(msg, WPS_SECRET_NONCE_LEN);
1540 wpabuf_put_data(msg, wps->snonce + WPS_SECRET_NONCE_LEN,
1546 static int wps_build_cred_network_idx(struct wpabuf *msg,
1550 wpabuf_put_be16(msg, ATTR_NETWORK_INDEX);
1551 wpabuf_put_be16(msg, 1);
1552 wpabuf_put_u8(msg, 1);
1557 static int wps_build_cred_ssid(struct wpabuf *msg,
1563 wpabuf_put_be16(msg, ATTR_SSID);
1564 wpabuf_put_be16(msg, cred->ssid_len);
1565 wpabuf_put_data(msg, cred->ssid, cred->ssid_len);
1570 static int wps_build_cred_auth_type(struct wpabuf *msg,
1575 wpabuf_put_be16(msg, ATTR_AUTH_TYPE);
1576 wpabuf_put_be16(msg, 2);
1577 wpabuf_put_be16(msg, cred->auth_type);
1582 static int wps_build_cred_encr_type(struct wpabuf *msg,
1587 wpabuf_put_be16(msg, ATTR_ENCR_TYPE);
1588 wpabuf_put_be16(msg, 2);
1589 wpabuf_put_be16(msg, cred->encr_type);
1594 static int wps_build_cred_network_key(struct wpabuf *msg,
1601 wpabuf_put_be16(msg, ATTR_NETWORK_KEY);
1602 wpabuf_put_be16(msg, cred->key_len);
1603 wpabuf_put_data(msg, cred->key, cred->key_len);
1608 static int wps_build_credential(struct wpabuf *msg,
1611 if (wps_build_cred_network_idx(msg, cred) ||
1612 wps_build_cred_ssid(msg, cred) ||
1613 wps_build_cred_auth_type(msg, cred) ||
1614 wps_build_cred_encr_type(msg, cred) ||
1615 wps_build_cred_network_key(msg, cred) ||
1616 wps_build_mac_addr(msg, cred->mac_addr))
1622 int wps_build_credential_wrap(struct wpabuf *msg,
1633 wpabuf_put_be16(msg, ATTR_CRED);
1634 wpabuf_put_be16(msg, wpabuf_len(wbuf));
1635 wpabuf_put_buf(msg, wbuf);
1641 int wps_build_cred(struct wps_data *wps, struct wpabuf *msg)
1815 wpabuf_put_be16(msg, ATTR_CRED);
1816 wpabuf_put_be16(msg, wpabuf_len(cred));
1817 wpabuf_put_buf(msg, cred);
1832 wpabuf_put_be16(msg, ATTR_CRED);
1833 wpabuf_put_be16(msg, wpabuf_len(cred));
1834 wpabuf_put_buf(msg, cred);
1840 wpabuf_put_buf(msg, wps->wps->registrar->extra_cred);
1847 static int wps_build_ap_settings(struct wps_data *wps, struct wpabuf *msg)
1851 if (wps_build_credential(msg, &wps->cred))
1860 struct wpabuf *msg, *plain;
1862 msg = wpabuf_alloc(1000);
1863 if (msg == NULL)
1868 wpabuf_free(msg);
1874 wpabuf_free(msg);
1878 wpabuf_put_be16(msg, ATTR_CRED);
1879 wpabuf_put_be16(msg, wpabuf_len(plain));
1880 wpabuf_put_buf(msg, plain);
1883 return msg;
1889 struct wpabuf *msg;
1899 msg = wpabuf_alloc(1000);
1900 if (msg == NULL)
1903 if (wps_build_version(msg) ||
1904 wps_build_msg_type(msg, WPS_M2) ||
1905 wps_build_enrollee_nonce(wps, msg) ||
1906 wps_build_registrar_nonce(wps, msg) ||
1907 wps_build_uuid_r(wps, msg) ||
1908 wps_build_public_key(wps, msg) ||
1910 wps_build_auth_type_flags(wps, msg) ||
1911 wps_build_encr_type_flags(wps, msg) ||
1912 wps_build_conn_type_flags(wps, msg) ||
1913 wps_build_config_methods_r(wps->wps->registrar, msg) ||
1914 wps_build_device_attrs(&wps->wps->dev, msg) ||
1915 wps_build_rf_bands(&wps->wps->dev, msg,
1917 wps_build_assoc_state(wps, msg) ||
1918 wps_build_config_error(msg, WPS_CFG_NO_ERROR) ||
1919 wps_build_dev_password_id(msg, wps->dev_pw_id) ||
1920 wps_build_os_version(&wps->wps->dev, msg) ||
1921 wps_build_wfa_ext(msg, 0, NULL, 0, 0)) {
1922 wpabuf_free(msg);
1939 wps_build_encr_settings(wps, msg, plain)) {
1940 wpabuf_free(msg);
1949 if (wps_build_authenticator(wps, msg)) {
1950 wpabuf_free(msg);
1956 return msg;
1962 struct wpabuf *msg;
1966 msg = wpabuf_alloc(1000);
1967 if (msg == NULL)
1974 if (wps_build_version(msg) ||
1975 wps_build_msg_type(msg, WPS_M2D) ||
1976 wps_build_enrollee_nonce(wps, msg) ||
1977 wps_build_registrar_nonce(wps, msg) ||
1978 wps_build_uuid_r(wps, msg) ||
1979 wps_build_auth_type_flags(wps, msg) ||
1980 wps_build_encr_type_flags(wps, msg) ||
1981 wps_build_conn_type_flags(wps, msg) ||
1982 wps_build_config_methods_r(wps->wps->registrar, msg) ||
1983 wps_build_device_attrs(&wps->wps->dev, msg) ||
1984 wps_build_rf_bands(&wps->wps->dev, msg,
1986 wps_build_assoc_state(wps, msg) ||
1987 wps_build_config_error(msg, err) ||
1988 wps_build_os_version(&wps->wps->dev, msg) ||
1989 wps_build_wfa_ext(msg, 0, NULL, 0, 0)) {
1990 wpabuf_free(msg);
1995 return msg;
2001 struct wpabuf *msg, *plain;
2012 msg = wpabuf_alloc(1000);
2013 if (msg == NULL) {
2018 if (wps_build_version(msg) ||
2019 wps_build_msg_type(msg, WPS_M4) ||
2020 wps_build_enrollee_nonce(wps, msg) ||
2021 wps_build_r_hash(wps, msg) ||
2024 wps_build_encr_settings(wps, msg, plain) ||
2025 wps_build_wfa_ext(msg, 0, NULL, 0, 0) ||
2026 wps_build_authenticator(wps, msg)) {
2028 wpabuf_free(msg);
2034 return msg;
2040 struct wpabuf *msg, *plain;
2048 msg = wpabuf_alloc(1000);
2049 if (msg == NULL) {
2054 if (wps_build_version(msg) ||
2055 wps_build_msg_type(msg, WPS_M6) ||
2056 wps_build_enrollee_nonce(wps, msg) ||
2059 wps_build_encr_settings(wps, msg, plain) ||
2060 wps_build_wfa_ext(msg, 0, NULL, 0, 0) ||
2061 wps_build_authenticator(wps, msg)) {
2063 wpabuf_free(msg);
2070 return msg;
2076 struct wpabuf *msg, *plain;
2084 msg = wpabuf_alloc(1000);
2085 if (msg == NULL) {
2090 if (wps_build_version(msg) ||
2091 wps_build_msg_type(msg, WPS_M8) ||
2092 wps_build_enrollee_nonce(wps, msg) ||
2096 wps_build_encr_settings(wps, msg, plain) ||
2097 wps_build_wfa_ext(msg, 0, NULL, 0, 0) ||
2098 wps_build_authenticator(wps, msg)) {
2100 wpabuf_clear_free(msg);
2106 return msg;
2113 struct wpabuf *msg;
2133 msg = p->msg;
2148 return msg;
2161 msg = wps_build_m2d(wps);
2163 msg = wps_build_m2(wps);
2167 msg = wps_build_m2d(wps);
2171 msg = wps_build_m4(wps);
2175 msg = wps_build_m6(wps);
2179 msg = wps_build_m8(wps);
2183 msg = wps_build_wsc_ack(wps);
2187 msg = wps_build_wsc_nack(wps);
2193 msg = NULL;
2197 if (*op_code == WSC_MSG && msg) {
2201 wps->last_msg = wpabuf_dup(msg);
2204 return msg;
2789 const struct wpabuf *msg,
2811 wps_process_authenticator(wps, attr->authenticator, msg) ||
2824 const struct wpabuf *msg,
2849 wps_process_authenticator(wps, attr->authenticator, msg)) {
2923 struct wpabuf *msg;
2951 msg = wps_build_ap_cred(wps);
2952 if (msg == NULL)
2954 wps->cred.cred_attr = wpabuf_head(msg);
2955 wps->cred.cred_attr_len = wpabuf_len(msg);
2960 wpabuf_free(msg);
2967 wpabuf_free(msg);
2975 const struct wpabuf *msg,
3000 wps_process_authenticator(wps, attr->authenticator, msg)) {
3040 const struct wpabuf *msg)
3047 if (wps_parse_msg(msg, &attr) < 0)
3066 if (wps_validate_m1(msg) < 0)
3076 UPNP_WPS_WLANEVENT_TYPE_EAP, msg);
3082 if (wps_validate_m3(msg) < 0)
3084 ret = wps_process_m3(wps, msg, &attr);
3090 if (wps_validate_m5(msg) < 0)
3092 ret = wps_process_m5(wps, msg, &attr);
3098 if (wps_validate_m7(msg) < 0)
3100 ret = wps_process_m7(wps, msg, &attr);
3115 wps->last_msg = wpabuf_dup(msg);
3123 const struct wpabuf *msg)
3129 if (wps_parse_msg(msg, &attr) < 0)
3190 const struct wpabuf *msg)
3201 if (wps_parse_msg(msg, &attr) < 0)
3272 const struct wpabuf *msg)
3285 if (wps_parse_msg(msg, &attr) < 0)
3398 const struct wpabuf *msg)
3404 (unsigned long) wpabuf_len(msg), op_code);
3409 if (wps_parse_msg(msg, &attr) == 0 && attr.msg_type &&
3421 if (wps_parse_msg(msg, &attr) < 0 || attr.msg_type == NULL)
3430 msg);
3442 return wps_process_wsc_msg(wps, msg);
3444 if (wps_validate_wsc_ack(msg) < 0)
3446 return wps_process_wsc_ack(wps, msg);
3448 if (wps_validate_wsc_nack(msg) < 0)
3450 return wps_process_wsc_nack(wps, msg);
3452 if (wps_validate_wsc_done(msg) < 0)
3454 ret = wps_process_wsc_done(wps, msg);