From 95141769aa3945773103559e0b09c06388246bc5 Mon Sep 17 00:00:00 2001 From: Mayank Haarit Date: Fri, 21 Jun 2019 11:55:30 +0530 Subject: [PATCH] Added support of SAE security mode. Change-Id: I2e2321bce63af792b23798fb0fb78acfbc76ed1d Signed-off-by: Mayank Haarit --- include/tethering.h | 1 + include/tethering_private.h | 1 + src/tethering.c | 8 +++++++- test/tethering_test.c | 8 +++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/tethering.h b/include/tethering.h index a1a466e..ce2bd87 100644 --- a/include/tethering.h +++ b/include/tethering.h @@ -102,6 +102,7 @@ typedef enum { TETHERING_WIFI_SECURITY_TYPE_NONE = 0, /**< No Security type */ TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK, /**< WPA2_PSK */ TETHERING_WIFI_SECURITY_TYPE_WPS, /**< WPA2_PSK */ + TETHERING_WIFI_SECURITY_TYPE_SAE, /**< SAE */ } tethering_wifi_security_type_e; /** diff --git a/include/tethering_private.h b/include/tethering_private.h index b555868..69e12bf 100644 --- a/include/tethering_private.h +++ b/include/tethering_private.h @@ -251,6 +251,7 @@ typedef enum { #define TETHERING_WIFI_SECURITY_TYPE_OPEN_STR "open" #define TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK_STR "wpa2-psk" #define TETHERING_WIFI_SECURITY_TYPE_WPS_STR "wps" +#define TETHERING_WIFI_SECURITY_TYPE_SAE_STR "sae" #define TETHERING_ERROR_RECOVERY_MAX 3 #define SECURITY_TYPE_LEN 32 #define PSK_ITERATION_COUNT 4096 diff --git a/src/tethering.c b/src/tethering.c index 0e1b1df..46c8168 100755 --- a/src/tethering.c +++ b/src/tethering.c @@ -161,7 +161,8 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_ { if (security_type != TETHERING_WIFI_SECURITY_TYPE_NONE && security_type != TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK && - security_type != TETHERING_WIFI_SECURITY_TYPE_WPS) { + security_type != TETHERING_WIFI_SECURITY_TYPE_WPS && + security_type != TETHERING_WIFI_SECURITY_TYPE_SAE) { ERR("Invalid param\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_INVALID_PARAMETER; } @@ -687,6 +688,8 @@ static void __handle_security_type_changed(GDBusConnection *connection, const gc security_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK; else if (g_strcmp0(buf, TETHERING_WIFI_SECURITY_TYPE_WPS_STR) == 0) security_type = TETHERING_WIFI_SECURITY_TYPE_WPS; + else if (g_strcmp0(buf, TETHERING_WIFI_SECURITY_TYPE_SAE_STR) == 0) + security_type = TETHERING_WIFI_SECURITY_TYPE_SAE; else { SERR("Unknown type : %s\n", buf); //LCOV_EXCL_LINE g_free(buf); @@ -2909,6 +2912,9 @@ API int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_s case TETHERING_WIFI_SECURITY_TYPE_WPS: sec_str = TETHERING_WIFI_SECURITY_TYPE_WPS_STR; break; + case TETHERING_WIFI_SECURITY_TYPE_SAE: + sec_str = TETHERING_WIFI_SECURITY_TYPE_SAE_STR; + break; } __send_dbus_signal(th->client_bus, diff --git a/test/tethering_test.c b/test/tethering_test.c index 0ba2f81..9c153ff 100755 --- a/test/tethering_test.c +++ b/test/tethering_test.c @@ -432,6 +432,9 @@ static void __security_type_changed_cb(tethering_wifi_security_type_e changed_ty case TETHERING_WIFI_SECURITY_TYPE_WPS: sec_str = "wps"; break; + case TETHERING_WIFI_SECURITY_TYPE_SAE: + sec_str = "sae"; + break; default: sec_str = "unknown"; break; @@ -557,6 +560,9 @@ static void __print_wifi_tethering_setting(tethering_h th) case TETHERING_WIFI_SECURITY_TYPE_WPS: sec_str = "wps"; break; + case TETHERING_WIFI_SECURITY_TYPE_SAE: + sec_str = "sae"; + break; default: sec_str = "unknown"; break; @@ -797,7 +803,7 @@ static int test_tethering_wifi_set_security_type(void) int ret; int security_type; - printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK, 2:WPS)"); + printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK, 2:WPS, 3:SAE)"); ret = scanf("%9d", &security_type); if (ret < 0) { printf("scanf is failed!!\n"); -- 2.7.4