]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: ssid64/ssid_charset in Configurator
authorJouni Malinen <jouni@codeaurora.org>
Thu, 28 Nov 2019 13:20:32 +0000 (15:20 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 28 Nov 2019 14:39:09 +0000 (16:39 +0200)
This allows Configurator to be configured to use the ssid64 option in
the discovery object for a station Enrollee.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp.c
src/common/dpp.h

index cb4a03126ddd396a39134f1b0c50d6d175837e20..6c20fc1e6969d9c15b7185a3fab9f0e3d07a9adf 100644 (file)
@@ -4432,6 +4432,16 @@ static int dpp_configuration_parse_helper(struct dpp_authentication *auth,
 #endif /* CONFIG_TESTING_OPTIONS */
        }
 
+       pos = os_strstr(cmd, " ssid_charset=");
+       if (pos) {
+               if (conf_ap) {
+                       wpa_printf(MSG_INFO,
+                                  "DPP: ssid64 option (ssid_charset param) not allowed for AP enrollee");
+                       goto fail;
+               }
+               conf->ssid_charset = atoi(pos + 14);
+       }
+
        pos = os_strstr(cmd, " pass=");
        if (pos) {
                size_t pass_len;
@@ -4657,11 +4667,19 @@ dpp_build_conf_start(struct dpp_authentication *auth,
        }
 #endif /* CONFIG_TESTING_OPTIONS */
        json_start_object(buf, "discovery");
-       if (json_add_string_escape(buf, "ssid", conf->ssid,
-                                  conf->ssid_len) < 0) {
+       if (((!conf->ssid_charset || auth->peer_version < 2) &&
+            json_add_string_escape(buf, "ssid", conf->ssid,
+                                   conf->ssid_len) < 0) ||
+           ((conf->ssid_charset && auth->peer_version >= 2) &&
+            json_add_base64url(buf, "ssid64", conf->ssid,
+                               conf->ssid_len) < 0)) {
                wpabuf_free(buf);
                return NULL;
        }
+       if (conf->ssid_charset > 0) {
+               json_value_sep(buf);
+               json_add_int(buf, "ssid_charset", conf->ssid_charset);
+       }
        json_end_object(buf);
        json_value_sep(buf);
 
index d78e9aa094f4ec58323a7a885cd89cda50df1c31..2a558b63c65aac272866c3ca36f0646fff3563ea 100644 (file)
@@ -169,6 +169,7 @@ enum dpp_netrole {
 struct dpp_configuration {
        u8 ssid[32];
        size_t ssid_len;
+       int ssid_charset;
        enum dpp_akm akm;
        enum dpp_netrole netrole;