WPS ER: Deinit ER before WPS registrar/context
[libeap.git] / wpa_supplicant / wps_supplicant.c
index 62d1cd6..5f1a3c6 100644 (file)
@@ -898,6 +898,11 @@ void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
        if (wpa_s->wps == NULL)
                return;
 
+#ifdef CONFIG_WPS_ER
+       wps_er_deinit(wpa_s->wps_er);
+       wpa_s->wps_er = NULL;
+#endif /* CONFIG_WPS_ER */
+
        wps_registrar_deinit(wpa_s->wps->registrar);
        wpabuf_free(wpa_s->wps->dh_pubkey);
        wpabuf_free(wpa_s->wps->dh_privkey);
@@ -906,11 +911,6 @@ void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
        os_free(wpa_s->wps->network_key);
        os_free(wpa_s->wps);
        wpa_s->wps = NULL;
-
-#ifdef CONFIG_WPS_ER
-       wps_er_deinit(wpa_s->wps_er);
-       wpa_s->wps_er = NULL;
-#endif /* CONFIG_WPS_ER */
 }
 
 
@@ -1161,4 +1161,26 @@ int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const char *uuid,
        return wps_registrar_add_pin(wpa_s->wps->registrar, any ? NULL : u,
                                     (const u8 *) pin, os_strlen(pin), 300);
 }
+
+
+int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid)
+{
+       u8 u[UUID_LEN];
+
+       if (uuid_str2bin(uuid, u))
+               return -1;
+       return wps_er_pbc(wpa_s->wps_er, u);
+}
+
+
+int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
+                     const char *pin)
+{
+       u8 u[UUID_LEN];
+
+       if (uuid_str2bin(uuid, u))
+               return -1;
+       return wps_er_learn(wpa_s->wps_er, u, (const u8 *) pin,
+                           os_strlen(pin));
+}
 #endif /* CONFIG_WPS_ER */