Added support of WPA3-SAE security mode. 84/207984/2 accepted/tizen/unified/20190624.075215 submit/tizen/20190621.094817
authorNiraj Kumar Goit <niraj.g@samsung.com>
Thu, 30 May 2019 10:43:20 +0000 (16:13 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Wed, 19 Jun 2019 07:20:20 +0000 (12:50 +0530)
Change-Id: I8612c52dc0cc078459fa19aa8a639597f070b293
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
gsupplicant/gsupplicant.h
gsupplicant/supplicant.c
include/service.h
plugins/wifi.c
src/config.c
src/service.c

index c3ef5a0..155f846 100644 (file)
@@ -69,7 +69,7 @@ extern "C" {
 #define G_SUPPLICANT_KEYMGMT_WPA_EAP   (1 << 7)
 #define G_SUPPLICANT_KEYMGMT_WPA_EAP_256       (1 << 8)
 #define G_SUPPLICANT_KEYMGMT_WPS               (1 << 9)
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
 #define G_SUPPLICANT_KEYMGMT_SAE               (1 << 10)
 #endif
 
@@ -122,8 +122,6 @@ typedef enum {
 #if defined TIZEN_EXT
        G_SUPPLICANT_SECURITY_FT_PSK,
        G_SUPPLICANT_SECURITY_FT_IEEE8021X,
-#endif
-#if defined TIZEN_EXT_WIFI_MESH
        G_SUPPLICANT_SECURITY_SAE,
 #endif
 } GSupplicantSecurity;
@@ -221,8 +219,6 @@ struct _GSupplicantSSID {
        GSupplicantEapKeymgmt eap_keymgmt;
        const char *phase1;
        const char *pac_file;
-#endif
-#if defined TIZEN_EXT_WIFI_MESH
        uint16_t ieee80211w;
 #endif
 };
index a017e73..a7a7bd0 100644 (file)
@@ -101,7 +101,7 @@ static struct strvalmap keymgmt_map[] = {
        { "wpa-eap",            G_SUPPLICANT_KEYMGMT_WPA_EAP    },
        { "wpa-eap-sha256",     G_SUPPLICANT_KEYMGMT_WPA_EAP_256        },
        { "wps",                G_SUPPLICANT_KEYMGMT_WPS                },
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
        { "sae",                G_SUPPLICANT_KEYMGMT_SAE                },
 #endif
        { }
@@ -255,7 +255,7 @@ struct g_supplicant_bss {
        GSupplicantPhy_mode phy_mode;
 #endif
        unsigned int wps_capabilities;
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
        dbus_bool_t sae;
 #endif
 };
@@ -455,8 +455,6 @@ static const char *security2string(GSupplicantSecurity security)
                return "ft_psk";
        case G_SUPPLICANT_SECURITY_FT_IEEE8021X:
                return "ft_ieee8021x";
-#endif
-#if defined TIZEN_EXT_WIFI_MESH
        case G_SUPPLICANT_SECURITY_SAE:
                return "sae";
 #endif
@@ -1655,6 +1653,9 @@ const char *g_supplicant_network_get_enc_mode(GSupplicantNetwork *network)
                return NULL;
 
        if (network->best_bss->security == G_SUPPLICANT_SECURITY_PSK ||
+#if defined TIZEN_EXT
+           network->best_bss->security == G_SUPPLICANT_SECURITY_SAE ||
+#endif /* TIZEN_EXT */
            network->best_bss->security == G_SUPPLICANT_SECURITY_IEEE8021X) {
                unsigned int pairwise;
 
@@ -1682,6 +1683,11 @@ bool g_supplicant_network_get_rsn_mode(GSupplicantNetwork *network)
        if (network == NULL || network->best_bss == NULL)
                return 0;
 
+#if defined TIZEN_EXT
+       if (network->best_bss->security == G_SUPPLICANT_SECURITY_SAE)
+               return false;
+#endif /* TIZEN_EXT */
+
        if (network->best_bss->rsn_selected) {
                const char *mode = g_supplicant_network_get_enc_mode(network);
                if (g_strcmp0(mode, "aes") == 0 ||
@@ -2488,7 +2494,7 @@ static void bss_compute_security(struct g_supplicant_bss *bss)
                bss->psk = TRUE;
 #endif
 
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
        if (bss->keymgmt & G_SUPPLICANT_KEYMGMT_SAE)
                bss->sae = TRUE;
 #endif
@@ -2503,7 +2509,7 @@ static void bss_compute_security(struct g_supplicant_bss *bss)
        else if (bss->ft_ieee8021x == TRUE)
                bss->security = G_SUPPLICANT_SECURITY_IEEE8021X;
 #endif
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
        else if (bss->sae)
                bss->security = G_SUPPLICANT_SECURITY_SAE;
 #endif
@@ -6165,7 +6171,7 @@ static void add_network_security_proto(DBusMessageIter *dict,
        g_free(proto);
 }
 
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
 static void add_network_ieee80211w(DBusMessageIter *dict, GSupplicantSSID *ssid)
 {
        if (ssid->security != G_SUPPLICANT_SECURITY_SAE)
@@ -6217,8 +6223,6 @@ static void add_network_security(DBusMessageIter *dict, GSupplicantSSID *ssid)
                add_network_security_ciphers(dict, ssid);
                add_network_security_proto(dict, ssid);
                break;
-#endif
-#if defined TIZEN_EXT_WIFI_MESH
        case G_SUPPLICANT_SECURITY_SAE:
                key_mgmt = "SAE";
                add_network_security_psk(dict, ssid);
@@ -6280,7 +6284,7 @@ static void interface_add_network_params(DBusMessageIter *iter, void *user_data)
 
        add_network_security(&dict, ssid);
 
-#if defined TIZEN_EXT_WIFI_MESH
+#if defined TIZEN_EXT
        add_network_ieee80211w(&dict, ssid);
 #endif
 
index 961b594..b276662 100644 (file)
@@ -68,6 +68,9 @@ enum connman_service_security {
        CONNMAN_SERVICE_SECURITY_8021X   = 4,
        CONNMAN_SERVICE_SECURITY_WPA     = 8,
        CONNMAN_SERVICE_SECURITY_RSN     = 9,
+#if defined TIZEN_EXT
+       CONNMAN_SERVICE_SECURITY_SAE     = 10,
+#endif
 };
 
 enum connman_service_state {
index 9cc1d29..a434d5b 100644 (file)
@@ -3176,6 +3176,8 @@ static GSupplicantSecurity network_security(const char *security)
                return G_SUPPLICANT_SECURITY_FT_PSK;
        else if (g_str_equal(security, "ft_ieee8021x") == TRUE)
                return G_SUPPLICANT_SECURITY_FT_IEEE8021X;
+       else if (g_str_equal(security, "sae"))
+               return G_SUPPLICANT_SECURITY_SAE;
 #endif
 
        return G_SUPPLICANT_SECURITY_UNKNOWN;
@@ -3221,6 +3223,9 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
        ssid->scan_ssid = 1;
        security = connman_network_get_string(network, "WiFi.Security");
        ssid->security = network_security(security);
+#if defined TIZEN_EXT
+       ssid->ieee80211w = 1;
+#endif
        ssid->passphrase = connman_network_get_string(network,
                                                "WiFi.Passphrase");
        ssid->eap = connman_network_get_string(network, "WiFi.EAP");
index 11f0bd8..d4ba0b3 100644 (file)
@@ -742,6 +742,7 @@ static bool load_service(GKeyFile *keyfile, const char *group,
                        if (security == CONNMAN_SERVICE_SECURITY_PSK ||
 #if defined TIZEN_EXT
                            security == CONNMAN_SERVICE_SECURITY_RSN ||
+                           security == CONNMAN_SERVICE_SECURITY_SAE ||
 #endif
                                        security == CONNMAN_SERVICE_SECURITY_WEP) {
                                service->security = security;
index 2fd1e50..d1ada48 100644 (file)
@@ -350,6 +350,8 @@ enum connman_service_security __connman_service_string2security(const char *str)
 #if defined TIZEN_EXT
        if (!strcmp(str, "rsn"))
                return CONNMAN_SERVICE_SECURITY_RSN;
+       if (!strcmp(str, "sae"))
+               return CONNMAN_SERVICE_SECURITY_SAE;
 #endif
 
        return CONNMAN_SERVICE_SECURITY_UNKNOWN;
@@ -370,6 +372,8 @@ static const char *security2string(enum connman_service_security security)
                return "psk";
        case CONNMAN_SERVICE_SECURITY_RSN:
                return "rsn";
+       case CONNMAN_SERVICE_SECURITY_SAE:
+               return "sae";
 #else
        case CONNMAN_SERVICE_SECURITY_RSN:
                return "psk";
@@ -2388,6 +2392,9 @@ static void append_security(DBusMessageIter *iter, void *user_data)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
+#if defined TIZEN_EXT
+               case CONNMAN_SERVICE_SECURITY_SAE:
+#endif
                        str = "wps";
                        dbus_message_iter_append_basic(iter,
                                                DBUS_TYPE_STRING, &str);
@@ -4143,6 +4150,8 @@ int __connman_service_check_passphrase(enum connman_service_security security,
        case CONNMAN_SERVICE_SECURITY_PSK:
 #if defined TIZEN_EXT
        case CONNMAN_SERVICE_SECURITY_RSN:
+       /* TO CHECK: We need to check the key length supported by SAE */
+       case CONNMAN_SERVICE_SECURITY_SAE:
 #endif
                /* A raw key is always 64 bytes length,
                 * its content is in hex representation.
@@ -8207,6 +8216,9 @@ static int service_connect(struct connman_service *service)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
+#if defined TIZEN_EXT
+               case CONNMAN_SERVICE_SECURITY_SAE:
+#endif
                        if (service->error == CONNMAN_SERVICE_ERROR_INVALID_KEY)
                                return -ENOKEY;
 
@@ -8277,6 +8289,9 @@ static int service_connect(struct connman_service *service)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
+#if defined TIZEN_EXT
+               case CONNMAN_SERVICE_SECURITY_SAE:
+#endif
                        break;
                case CONNMAN_SERVICE_SECURITY_8021X:
                        prepare_8021x(service);
@@ -9028,6 +9043,8 @@ static enum connman_service_security convert_wifi_security(const char *security)
        else if (g_str_equal(security, "rsn"))
                return CONNMAN_SERVICE_SECURITY_RSN;
 #if defined TIZEN_EXT
+       else if (g_str_equal(security, "sae"))
+               return CONNMAN_SERVICE_SECURITY_SAE;
        else if (g_str_equal(security, "ft_psk") == TRUE)
                return CONNMAN_SERVICE_SECURITY_PSK;
        else if (g_str_equal(security, "ft_ieee8021x") == TRUE)