if (dpp_check_attrs(buf, len) < 0) {
wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR
" freq=%u type=%d ignore=invalid-attributes",
---- a/src/ap/ucode.c
-+++ b/src/ap/ucode.c
-@@ -1132,6 +1132,56 @@ struct wpabuf *hostapd_ucode_dpp_gas_req
- }
- #endif /* CONFIG_DPP */
-
-+void hostapd_ucode_wps_m7_rx(struct hostapd_data *hapd, const u8 *addr,
-+ const u8 *data, size_t data_len,
-+ struct wpabuf **m8_encr_extra, int *skip_cred)
-+{
-+ uc_value_t *val, *obj;
-+ char addr_str[18];
-+ char *data_b64;
-+ size_t data_b64_len;
-+
-+ if (wpa_ucode_call_prepare("wps_m7_rx"))
-+ return;
-+
-+ os_snprintf(addr_str, sizeof(addr_str), MACSTR, MAC2STR(addr));
-+ data_b64 = base64_encode_no_lf(data, data_len, &data_b64_len);
-+ if (!data_b64) {
-+ ucv_put(wpa_ucode_call(0));
-+ return;
-+ }
-+
-+ uc_value_push(ucv_string_new(hapd->conf->iface));
-+ uc_value_push(ucv_string_new(addr_str));
-+ uc_value_push(ucv_string_new(data_b64));
-+ os_free(data_b64);
-+
-+ val = wpa_ucode_call(3);
-+ if (ucv_type(val) != UC_OBJECT)
-+ goto out;
-+
-+ obj = ucv_object_get(val, "skip_cred", NULL);
-+ if (ucv_is_truish(obj))
-+ *skip_cred = 1;
-+
-+ obj = ucv_object_get(val, "data", NULL);
-+ if (ucv_type(obj) == UC_STRING) {
-+ const char *extra_b64 = ucv_string_get(obj);
-+ unsigned char *extra;
-+ size_t extra_len;
-+
-+ extra = base64_decode(extra_b64, os_strlen(extra_b64),
-+ &extra_len);
-+ if (extra) {
-+ *m8_encr_extra = wpabuf_alloc_copy(extra, extra_len);
-+ os_free(extra);
-+ }
-+ }
-+
-+out:
-+ ucv_put(val);
-+}
-+
- int hostapd_ucode_init(struct hapd_interfaces *ifaces)
- {
- static const uc_function_list_t global_fns[] = {
---- a/src/ap/ucode.h
-+++ b/src/ap/ucode.h
-@@ -32,6 +32,10 @@ void hostapd_ucode_sta_connected(struct
- void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname);
- #endif // def CONFIG_APUP
-
-+void hostapd_ucode_wps_m7_rx(struct hostapd_data *hapd, const u8 *addr,
-+ const u8 *data, size_t data_len,
-+ struct wpabuf **m8_encr_extra, int *skip_cred);
-+
- #ifdef CONFIG_DPP
- int hostapd_ucode_dpp_rx_action(struct hostapd_data *hapd, const u8 *src,
- u8 frame_type, unsigned int freq,
-@@ -66,6 +70,13 @@ static inline void hostapd_ucode_sta_con
- static inline void hostapd_ucode_free_bss(struct hostapd_data *hapd)
- {
- }
-+static inline void hostapd_ucode_wps_m7_rx(struct hostapd_data *hapd,
-+ const u8 *addr,
-+ const u8 *data, size_t data_len,
-+ struct wpabuf **m8_encr_extra,
-+ int *skip_cred)
-+{
-+}
-
- #ifdef CONFIG_DPP
- static inline int hostapd_ucode_dpp_rx_action(struct hostapd_data *hapd,
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -27,6 +27,7 @@
wpabuf_clear_free(decrypted);
wps->state = SEND_M8;
---- a/wpa_supplicant/ucode.c
-+++ b/wpa_supplicant/ucode.c
-@@ -243,6 +243,65 @@ void wpas_ucode_wps_complete(struct wpa_
- #endif /* CONFIG_WPS */
- }
-
-+static uc_value_t *
-+uc_wpas_iface_wps_set_m7(uc_vm_t *vm, size_t nargs)
-+{
-+ struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface");
-+ uc_value_t *data_arg = uc_fn_arg(0);
-+ const char *data_b64;
-+ unsigned char *data;
-+ size_t data_len;
-+
-+ if (!wpa_s || !wpa_s->wps)
-+ return NULL;
-+
-+ wpabuf_free(wpa_s->wps->m7_encr_extra);
-+ wpa_s->wps->m7_encr_extra = NULL;
-+
-+ if (ucv_type(data_arg) != UC_STRING)
-+ return ucv_boolean_new(true);
-+
-+ data_b64 = ucv_string_get(data_arg);
-+ data = base64_decode(data_b64, os_strlen(data_b64), &data_len);
-+ if (!data)
-+ return NULL;
-+
-+ wpa_s->wps->m7_encr_extra = wpabuf_alloc_copy(data, data_len);
-+ os_free(data);
-+
-+ return ucv_boolean_new(wpa_s->wps->m7_encr_extra != NULL);
-+}
-+
-+int wpas_ucode_wps_m8_rx(struct wpa_supplicant *wpa_s,
-+ const u8 *data, size_t data_len)
-+{
-+ uc_value_t *val;
-+ char *data_b64;
-+ size_t data_b64_len;
-+ int ret = 0;
-+
-+ if (wpa_ucode_call_prepare("wps_m8_rx"))
-+ return 0;
-+
-+ data_b64 = base64_encode_no_lf(data, data_len, &data_b64_len);
-+ if (!data_b64) {
-+ ucv_put(wpa_ucode_call(0));
-+ return 0;
-+ }
-+
-+ uc_value_push(ucv_string_new(wpa_s->ifname));
-+ val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
-+ uc_value_push(ucv_get(val));
-+ uc_value_push(ucv_string_new(data_b64));
-+ os_free(data_b64);
-+
-+ val = wpa_ucode_call(3);
-+ ret = ucv_is_truish(val);
-+ ucv_put(val);
-+
-+ return ret;
-+}
-+
- #ifdef CONFIG_DPP
- int wpas_ucode_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src,
- u8 frame_type, unsigned int freq,
-@@ -692,6 +751,7 @@ int wpas_ucode_init(struct wpa_global *g
- { "status", uc_wpas_iface_status },
- { "ctrl", uc_wpas_iface_ctrl },
- { "config", uc_wpas_iface_config },
-+ { "wps_set_m7", uc_wpas_iface_wps_set_m7 },
- #ifdef CONFIG_DPP
- { "dpp_send_action", uc_wpas_iface_dpp_send_action },
- { "dpp_send_gas_req", uc_wpas_iface_dpp_send_gas_req },
---- a/wpa_supplicant/ucode.h
-+++ b/wpa_supplicant/ucode.h
-@@ -26,6 +26,8 @@ void wpas_ucode_ctrl_event(struct wpa_su
- bool wpas_ucode_bss_allowed(struct wpa_supplicant *wpa_s, struct wpa_bss *bss);
- void wpas_ucode_wps_complete(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred);
-+int wpas_ucode_wps_m8_rx(struct wpa_supplicant *wpa_s,
-+ const u8 *data, size_t data_len);
- #ifdef CONFIG_DPP
- int wpas_ucode_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src,
- u8 frame_type, unsigned int freq,
-@@ -85,6 +87,12 @@ static inline void wpas_ucode_wps_comple
- {
- }
-
-+static inline int wpas_ucode_wps_m8_rx(struct wpa_supplicant *wpa_s,
-+ const u8 *data, size_t data_len)
-+{
-+ return 0;
-+}
-+
- static inline int wpas_ucode_dpp_rx_action(struct wpa_supplicant *wpa_s,
- const u8 *src, u8 frame_type,
- unsigned int freq, const u8 *data,