Added support of WPA3-SAE security mode. 85/207985/3 accepted/tizen/unified/20190624.075212 submit/tizen/20190621.094817
authorNiraj Kumar Goit <niraj.g@samsung.com>
Fri, 14 Jun 2019 11:50:13 +0000 (17:20 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Wed, 19 Jun 2019 07:39:15 +0000 (13:09 +0530)
Change-Id: I44114045b9716defe4e467007a1d32d2df38b1ef
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
include/network_wlan.h
include/wifi-manager.h
src/network_interface.c
src/network_internal.c
src/network_signal.c
src/wifi_ap.c
src/wifi_internal.c
test/wifi_manager_test.c
tool/wifi_mgr_tool.c

index cd133d0..58264aa 100755 (executable)
@@ -54,6 +54,11 @@ extern "C" {
 #define NET_WLAN_MAX_PSK_PASSPHRASE_LEN                        65
 
 /**
+ * Length of SAE Key
+ */
+#define NET_WLAN_MAX_SAE_PASSPHRASE_LEN                        65
+
+/**
  * Length of WEP Key
  * Max of 10 Hex digits allowed in case of 64 bit encryption
  * Max of 26 Hex digits allowed in case of 128 bit encryption
@@ -114,6 +119,7 @@ typedef enum {
        WLAN_SEC_MODE_WPA_PSK,                          /** WPA-PSK */
        WLAN_SEC_MODE_WPA2_PSK,                         /** WPA2-PSK */
        WLAN_SEC_MODE_WPA_FT_PSK,
+       WLAN_SEC_MODE_SAE,                              /** SAE */
 } wlan_security_mode_type_e;
 
 /**
@@ -182,6 +188,14 @@ typedef struct {
 } wlan_psk_info_s;
 
 /**
+ * Below structure is used by WPA3-SAE
+ * To see the maximum length of SAE passphrase key.
+ */
+typedef struct {
+       char saeKey[NET_WLAN_MAX_SAE_PASSPHRASE_LEN + 1];       /** key value for WPA3-SAE */
+} wlan_sae_info_s;
+
+/**
  * Below structure is used by WEP
  * To see the maximum length of WEP key.
  */
@@ -220,6 +234,7 @@ typedef union {
        wlan_wep_info_s wep;                                    /** Wep Authentication */
        wlan_psk_info_s psk;                                    /** psk Authentication */
        wlan_eap_info_s eap;                                    /** eap Authentication */
+       wlan_sae_info_s sae;                                    /** sae Authentication */
 } wlan_auth_info_u;
 
 /**
index 60ae2ab..7042845 100755 (executable)
@@ -374,6 +374,7 @@ typedef enum {
        WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK = 3,    /**< WPA2-PSK */
        WIFI_MANAGER_SECURITY_TYPE_EAP = 4,         /**< EAP */
        WIFI_MANAGER_SECURITY_TYPE_WPA_FT_PSK = 5,  /**< FT-PSK (Since 5.0) */
+       WIFI_MANAGER_SECURITY_TYPE_SAE = 6,    /**< SAE (Since 5.5) */
 } wifi_manager_security_type_e;
 
 /**
index 4b63a18..b6c5f0f 100755 (executable)
@@ -858,6 +858,9 @@ static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_s* Prof
                                else if (g_strcmp0(value, "rsn") == 0 &&
                                                 ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
                                        ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA2_PSK;
+                               else if (g_strcmp0(value, "sae") == 0 &&
+                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
+                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_SAE;
                                else if (g_strcmp0(value, "wps") == 0)
                                        ProfInfo->security_info.wps_support = TRUE;
                                else if (ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_NONE)
index 6ecc61b..15f65f2 100755 (executable)
@@ -274,13 +274,19 @@ int _net_open_connection_with_wifi_info(const net_wifi_connection_info_s* wifi_i
                wifi_connection_info.passphrase =
                                (char *)wifi_info->security_info.authentication.psk.pskKey;
                break;
+
        case WLAN_SEC_MODE_WPA_FT_PSK:
                wifi_connection_info.security = "ft_psk";
                wifi_connection_info.passphrase =
                                (char *)wifi_info->security_info.authentication.psk.pskKey;
                break;
 
-
+       /** SAE supported */
+       case WLAN_SEC_MODE_SAE:
+               wifi_connection_info.security = "sae";
+               wifi_connection_info.passphrase =
+                               (char *)wifi_info->security_info.authentication.sae.saeKey;
+               break;
 
        case WLAN_SEC_MODE_IEEE8021X:
                wifi_connection_info.security = "ieee8021x";
index ffd5593..3b88ffd 100755 (executable)
@@ -175,6 +175,10 @@ static wlan_security_mode_type_e __net_get_wlan_sec_mode(int security)
                return WLAN_SEC_MODE_WPA2_PSK;
        case 5:
                return WLAN_SEC_MODE_IEEE8021X;
+       case 6:
+               return WLAN_SEC_MODE_WPA_FT_PSK;
+       case 7:
+               return WLAN_SEC_MODE_SAE;
        default:
                return WLAN_SEC_MODE_NONE;
        }
index c4f3b85..c8f0d45 100755 (executable)
@@ -87,16 +87,19 @@ static char *__wifi_create_profile_name(const char *ssid,
        case WLAN_SEC_MODE_WEP:
                g_sec = "wep";
                break;
+       case WLAN_SEC_MODE_IEEE8021X:
+               g_sec = "ieee8021x";
+               break;
        case WLAN_SEC_MODE_WPA_PSK:
        case WLAN_SEC_MODE_WPA2_PSK:
                g_sec = "psk";
                break;
-       case WLAN_SEC_MODE_IEEE8021X:
-               g_sec = "ieee8021x";
-               break;
        case WLAN_SEC_MODE_WPA_FT_PSK:
                g_sec = "ft_psk";
                break;
+       case WLAN_SEC_MODE_SAE:
+               g_sec = "sae";
+               break;
        default:
                WIFI_LOG(WIFI_ERROR, "Invalid security type");
                return NULL;
@@ -1678,6 +1681,9 @@ EXPORT_API int wifi_manager_ap_get_security_type(wifi_manager_ap_h ap,
        case WLAN_SEC_MODE_WPA_FT_PSK:
                *type = WIFI_MANAGER_SECURITY_TYPE_WPA_FT_PSK;
                break;
+       case WLAN_SEC_MODE_SAE:
+               *type = WIFI_MANAGER_SECURITY_TYPE_SAE;
+               break;
        default:
                /* __NETWORK_CAPI_FUNC_EXIT__; */
                return WIFI_MANAGER_ERROR_OPERATION_FAILED;
@@ -1724,6 +1730,9 @@ EXPORT_API int wifi_manager_ap_set_security_type(wifi_manager_ap_h ap,
        case WIFI_MANAGER_SECURITY_TYPE_WPA_FT_PSK:
                profile_info->security_info.sec_mode = WLAN_SEC_MODE_WPA_FT_PSK;
                break;
+       case WIFI_MANAGER_SECURITY_TYPE_SAE:
+               profile_info->security_info.sec_mode = WLAN_SEC_MODE_SAE;
+               break;
        default:
                __NETWORK_CAPI_FUNC_EXIT__;
                return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
@@ -1854,6 +1863,7 @@ EXPORT_API int wifi_manager_ap_is_passphrase_required(wifi_manager_ap_h ap,
        case WLAN_SEC_MODE_WPA_PSK:
        case WLAN_SEC_MODE_WPA2_PSK:
        case WLAN_SEC_MODE_WPA_FT_PSK:
+       case WLAN_SEC_MODE_SAE:
                *required = true;
                break;
        default:
@@ -1893,6 +1903,10 @@ EXPORT_API int wifi_manager_ap_set_passphrase(wifi_manager_ap_h ap, const char *
                g_strlcpy(profile_info->security_info.authentication.psk.pskKey,
                                passphrase, NET_WLAN_MAX_PSK_PASSPHRASE_LEN+1);
                break;
+       case WLAN_SEC_MODE_SAE:
+               g_strlcpy(profile_info->security_info.authentication.sae.saeKey,
+                               passphrase, NET_WLAN_MAX_SAE_PASSPHRASE_LEN+1);
+               break;
        case WLAN_SEC_MODE_NONE:
        case WLAN_SEC_MODE_IEEE8021X:
        default:
index efa1c57..47a1776 100755 (executable)
@@ -31,6 +31,7 @@ static gboolean multi_scan_type[WIFI_MULTI_SCAN_MAX] = {0, };
 #define WIFI_SECURITY_WEP                      "wep"
 #define WIFI_SECURITY_WPA_PSK                  "psk"
 #define WIFI_SECURITY_WPA_FT_PSK               "ft_psk"
+#define WIFI_SECURITY_SAE                      "sae"
 #define WIFI_SECURITY_EAP                      "ieee8021x"
 
 static __thread GSList *wifi_manager_handle_list = NULL;
@@ -213,6 +214,9 @@ static gchar *__wifi_security_type_to_string(wifi_manager_security_type_e securi
        case WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK:
                return WIFI_SECURITY_WPA_PSK;
 
+       case WIFI_MANAGER_SECURITY_TYPE_SAE:
+               return WIFI_SECURITY_SAE;
+
        case WIFI_MANAGER_SECURITY_TYPE_WPA_FT_PSK:
                return WIFI_SECURITY_WPA_FT_PSK;
 
@@ -471,6 +475,9 @@ static void __update_netlink_scan_profile_iterator(GSList *bss_list)
                        profile->security_info.sec_mode = WLAN_SEC_MODE_WPA2_PSK;
                        break;
                case 4:
+                       profile->security_info.sec_mode = WLAN_SEC_MODE_SAE;
+                       break;
+               case 5:
                        profile->security_info.sec_mode = WLAN_SEC_MODE_IEEE8021X;
                        break;
                default:
@@ -1893,6 +1900,9 @@ int _wifi_get_hidden_aps(wifi_manager_h wifi, const char *essid,
                case WLAN_SEC_MODE_WPA_FT_PSK:
                        type = WIFI_MANAGER_SECURITY_TYPE_WPA_PSK;
                        break;
+               case WLAN_SEC_MODE_SAE:
+                       type = WIFI_MANAGER_SECURITY_TYPE_SAE;
+                       break;
                }
                if (prof_info->is_hidden == TRUE) {
                        if (type == sec_type) {
@@ -1928,6 +1938,10 @@ int _wifi_get_hidden_aps(wifi_manager_h wifi, const char *essid,
                g_strlcpy(profile_info->security_info.authentication.psk.pskKey,
                                passphrase, NET_WLAN_MAX_PSK_PASSPHRASE_LEN+1);
                break;
+       case WLAN_SEC_MODE_SAE:
+               g_strlcpy(profile_info->security_info.authentication.sae.saeKey,
+                               passphrase, NET_WLAN_MAX_SAE_PASSPHRASE_LEN+1);
+               break;
        case WLAN_SEC_MODE_NONE:
                break;
        case WLAN_SEC_MODE_IEEE8021X:
index baae119..1beba73 100755 (executable)
@@ -1459,6 +1459,7 @@ static bool __test_found_specific_ap_callback(wifi_manager_ap_h ap, void *user_d
        case WIFI_MANAGER_SECURITY_TYPE_WEP:
        case WIFI_MANAGER_SECURITY_TYPE_WPA_PSK:
        case WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK:
+       case WIFI_MANAGER_SECURITY_TYPE_SAE:
                {
                        char passphrase[100];
                        printf("Input passphrase for %s : ", ap_name);
index 0b33a92..cfcc767 100755 (executable)
@@ -496,6 +496,8 @@ const char *test_wifi_mgr_sec_type_to_string(wifi_manager_security_type_e type)
                return "EAP";
        case WIFI_MANAGER_SECURITY_TYPE_WPA_FT_PSK:
                return "FT_PSK";
+       case WIFI_MANAGER_SECURITY_TYPE_SAE:
+               return "WPA3";
        }
 
        return "Unknown";