]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/config_winreg.c
EAP: Increase the maximum number of message exchanges
[thirdparty/hostap.git] / wpa_supplicant / config_winreg.c
index ea3a2acd60baec01f4f2c2d5ae14fbe1d1678670..3ea5c80770ee907bc293bea1b9ec33b6a1a0799c 100644 (file)
@@ -2,14 +2,8 @@
  * WPA Supplicant / Configuration backend: Windows registry
  * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  *
  * This file implements a configuration backend for Windows registry. All the
  * configuration information is stored in the registry and the format for
@@ -105,13 +99,12 @@ static int wpa_config_read_blobs(struct wpa_config *config, HKEY hk)
                        break;
                }
                blob->name = os_strdup((char *) name);
-               blob->data = os_malloc(datalen);
+               blob->data = os_memdup(data, datalen);
                if (blob->name == NULL || blob->data == NULL) {
                        wpa_config_free_blob(blob);
                        errors++;
                        break;
                }
-               os_memcpy(blob->data, data, datalen);
                blob->len = datalen;
 
                wpa_config_set_blob(config, blob);
@@ -208,6 +201,7 @@ static int wpa_config_read_global_os_version(struct wpa_config *config,
 static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
 {
        int errors = 0;
+       int val;
 
        wpa_config_read_reg_dword(hk, TEXT("ap_scan"), &config->ap_scan);
        wpa_config_read_reg_dword(hk, TEXT("fast_reauth"),
@@ -239,6 +233,7 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
 #ifdef CONFIG_WPS
        if (wpa_config_read_global_uuid(config, hk))
                errors++;
+       wpa_config_read_reg_dword(hk, TEXT("auto_uuid"), &config->auto_uuid);
        config->device_name = wpa_config_read_reg_string(
                hk, TEXT("device_name"));
        config->manufacturer = wpa_config_read_reg_string(
@@ -260,6 +255,8 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
                errors++;
        wpa_config_read_reg_dword(hk, TEXT("wps_cred_processing"),
                                  &config->wps_cred_processing);
+       wpa_config_read_reg_dword(hk, TEXT("wps_cred_add_sae"),
+                                 &config->wps_cred_add_sae);
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_P2P
        config->p2p_ssid_postfix = wpa_config_read_reg_string(
@@ -277,6 +274,10 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
        wpa_config_read_reg_dword(hk, TEXT("disassoc_low_ack"),
                                  (int *) &config->disassoc_low_ack);
 
+       wpa_config_read_reg_dword(hk, TEXT("okc"), &config->okc);
+       wpa_config_read_reg_dword(hk, TEXT("pmf"), &val);
+       config->pmf = val;
+
        return errors ? -1 : 0;
 }
 
@@ -303,6 +304,7 @@ static struct wpa_ssid * wpa_config_read_network(HKEY hk, const TCHAR *netw,
                RegCloseKey(nhk);
                return NULL;
        }
+       dl_list_init(&ssid->psk_list);
        ssid->id = id;
 
        wpa_config_set_network_defaults(ssid);
@@ -350,15 +352,6 @@ static struct wpa_ssid * wpa_config_read_network(HKEY hk, const TCHAR *netw,
                wpa_config_update_psk(ssid);
        }
 
-       if ((ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_FT_PSK |
-                              WPA_KEY_MGMT_PSK_SHA256)) &&
-           !ssid->psk_set) {
-               wpa_printf(MSG_ERROR, "WPA-PSK accepted for key management, "
-                          "but no PSK configured for network '" TSTR "'.",
-                          netw);
-               errors++;
-       }
-
        if ((ssid->group_cipher & WPA_CIPHER_CCMP) &&
            !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) &&
            !(ssid->pairwise_cipher & WPA_CIPHER_NONE)) {
@@ -444,7 +437,7 @@ static int wpa_config_read_networks(struct wpa_config *config, HKEY hk)
 }
 
 
-struct wpa_config * wpa_config_read(const char *name)
+struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp)
 {
        TCHAR buf[256];
        int errors = 0;
@@ -452,7 +445,12 @@ struct wpa_config * wpa_config_read(const char *name)
        HKEY hk;
        LONG ret;
 
-       config = wpa_config_alloc_empty(NULL, NULL);
+       if (name == NULL)
+               return NULL;
+       if (cfgp)
+               config = cfgp;
+       else
+               config = wpa_config_alloc_empty(NULL, NULL);
        if (config == NULL)
                return NULL;
        wpa_printf(MSG_DEBUG, "Reading configuration profile '%s'", name);
@@ -584,6 +582,8 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
                uuid_bin2str(config->uuid, buf, sizeof(buf));
                wpa_config_write_reg_string(hk, "uuid", buf);
        }
+       wpa_config_write_reg_dword(hk, TEXT("auto_uuid"), config->auto_uuid,
+                                  0);
        wpa_config_write_reg_string(hk, "device_name", config->device_name);
        wpa_config_write_reg_string(hk, "manufacturer", config->manufacturer);
        wpa_config_write_reg_string(hk, "model_name", config->model_name);
@@ -606,6 +606,8 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
        }
        wpa_config_write_reg_dword(hk, TEXT("wps_cred_processing"),
                                   config->wps_cred_processing, 0);
+       wpa_config_write_reg_dword(hk, TEXT("wps_cred_add_sae"),
+                                  config->wps_cred_add_sae, 0);
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_P2P
        wpa_config_write_reg_string(hk, "p2p_ssid_postfix",
@@ -621,9 +623,17 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
                                   config->filter_ssids, 0);
        wpa_config_write_reg_dword(hk, TEXT("max_num_sta"),
                                   config->max_num_sta, DEFAULT_MAX_NUM_STA);
+       wpa_config_write_reg_dword(hk, TEXT("ap_isolate"),
+                                  config->ap_isolate, DEFAULT_AP_ISOLATE);
        wpa_config_write_reg_dword(hk, TEXT("disassoc_low_ack"),
                                   config->disassoc_low_ack, 0);
 
+       wpa_config_write_reg_dword(hk, TEXT("okc"), config->okc, 0);
+       wpa_config_write_reg_dword(hk, TEXT("pmf"), config->pmf, 0);
+
+       wpa_config_write_reg_dword(hk, TEXT("external_sim"),
+                                  config->external_sim, 0);
+
        return 0;
 }
 
@@ -866,6 +876,8 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
        INT(scan_ssid);
        write_bssid(netw, ssid);
        write_psk(netw, ssid);
+       STR(sae_password);
+       STR(sae_password_id);
        write_proto(netw, ssid);
        write_key_mgmt(netw, ssid);
        write_pairwise(netw, ssid);
@@ -875,6 +887,7 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
        write_eap(netw, ssid);
        STR(identity);
        STR(anonymous_identity);
+       STR(imsi_identity);
        STR(password);
        STR(ca_cert);
        STR(ca_path);
@@ -883,6 +896,7 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
        STR(private_key_passwd);
        STR(dh_file);
        STR(subject_match);
+       STR(check_cert_subject);
        STR(altsubject_match);
        STR(ca_cert2);
        STR(ca_path2);
@@ -891,6 +905,7 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
        STR(private_key2_passwd);
        STR(dh_file2);
        STR(subject_match2);
+       STR(check_cert_subject2);
        STR(altsubject_match2);
        STR(phase1);
        STR(phase2);
@@ -919,13 +934,19 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
        INT_DEFe(fragment_size, DEFAULT_FRAGMENT_SIZE);
 #endif /* IEEE8021X_EAPOL */
        INT(mode);
-       INT(proactive_key_caching);
+       write_int(netw, "proactive_key_caching", ssid->proactive_key_caching,
+                 -1);
        INT(disabled);
-       INT(peerkey);
 #ifdef CONFIG_IEEE80211W
-       INT(ieee80211w);
+       write_int(netw, "ieee80211w", ssid->ieee80211w,
+                 MGMT_FRAME_PROTECTION_DEFAULT);
 #endif /* CONFIG_IEEE80211W */
        STR(id_str);
+#ifdef CONFIG_HS20
+       INT(update_identifier);
+#endif /* CONFIG_HS20 */
+       INT(group_rekey);
+       INT(ft_eap_pmksa_caching);
 
 #undef STR
 #undef INT