From 744ba68df7010ee6a3a962daad47d106998c15fa Mon Sep 17 00:00:00 2001 From: Yu Date: Thu, 25 Jul 2019 13:24:57 +0900 Subject: [PATCH] Add OWE security mode support Change-Id: I03ab90b8ab78e489d1ef70fbec57f10576860a57 Signed-off-by: Yu jiung --- gsupplicant/gsupplicant.h | 2 ++ gsupplicant/supplicant.c | 20 ++++++++++++++++++-- include/service.h | 1 + plugins/wifi.c | 2 ++ src/service.c | 10 ++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 155f846..b9e99a4 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -71,6 +71,7 @@ extern "C" { #define G_SUPPLICANT_KEYMGMT_WPS (1 << 9) #if defined TIZEN_EXT #define G_SUPPLICANT_KEYMGMT_SAE (1 << 10) +#define G_SUPPLICANT_KEYMGMT_OWE (1 << 22) #endif #define G_SUPPLICANT_PROTO_WPA (1 << 0) @@ -123,6 +124,7 @@ typedef enum { G_SUPPLICANT_SECURITY_FT_PSK, G_SUPPLICANT_SECURITY_FT_IEEE8021X, G_SUPPLICANT_SECURITY_SAE, + G_SUPPLICANT_SECURITY_OWE, #endif } GSupplicantSecurity; diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index a7a7bd0..66644c8 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -103,6 +103,7 @@ static struct strvalmap keymgmt_map[] = { { "wps", G_SUPPLICANT_KEYMGMT_WPS }, #if defined TIZEN_EXT { "sae", G_SUPPLICANT_KEYMGMT_SAE }, + { "owe", G_SUPPLICANT_KEYMGMT_OWE }, #endif { } }; @@ -257,6 +258,7 @@ struct g_supplicant_bss { unsigned int wps_capabilities; #if defined TIZEN_EXT dbus_bool_t sae; + dbus_bool_t owe; #endif }; @@ -457,6 +459,8 @@ static const char *security2string(GSupplicantSecurity security) return "ft_ieee8021x"; case G_SUPPLICANT_SECURITY_SAE: return "sae"; + case G_SUPPLICANT_SECURITY_OWE: + return "owe"; #endif } @@ -1655,6 +1659,7 @@ const char *g_supplicant_network_get_enc_mode(GSupplicantNetwork *network) if (network->best_bss->security == G_SUPPLICANT_SECURITY_PSK || #if defined TIZEN_EXT network->best_bss->security == G_SUPPLICANT_SECURITY_SAE || + network->best_bss->security == G_SUPPLICANT_SECURITY_OWE || #endif /* TIZEN_EXT */ network->best_bss->security == G_SUPPLICANT_SECURITY_IEEE8021X) { unsigned int pairwise; @@ -1684,7 +1689,8 @@ bool g_supplicant_network_get_rsn_mode(GSupplicantNetwork *network) return 0; #if defined TIZEN_EXT - if (network->best_bss->security == G_SUPPLICANT_SECURITY_SAE) + if (network->best_bss->security == G_SUPPLICANT_SECURITY_SAE || + network->best_bss->security == G_SUPPLICANT_SECURITY_OWE) return false; #endif /* TIZEN_EXT */ @@ -2497,6 +2503,8 @@ static void bss_compute_security(struct g_supplicant_bss *bss) #if defined TIZEN_EXT if (bss->keymgmt & G_SUPPLICANT_KEYMGMT_SAE) bss->sae = TRUE; + if (bss->keymgmt & G_SUPPLICANT_KEYMGMT_OWE) + bss->owe = TRUE; #endif if (bss->ieee8021x) @@ -2512,6 +2520,8 @@ static void bss_compute_security(struct g_supplicant_bss *bss) #if defined TIZEN_EXT else if (bss->sae) bss->security = G_SUPPLICANT_SECURITY_SAE; + else if (bss->owe) + bss->security = G_SUPPLICANT_SECURITY_OWE; #endif else if (bss->privacy) bss->security = G_SUPPLICANT_SECURITY_WEP; @@ -6174,7 +6184,8 @@ static void add_network_security_proto(DBusMessageIter *dict, #if defined TIZEN_EXT static void add_network_ieee80211w(DBusMessageIter *dict, GSupplicantSSID *ssid) { - if (ssid->security != G_SUPPLICANT_SECURITY_SAE) + if (ssid->security != G_SUPPLICANT_SECURITY_SAE + && ssid->security != G_SUPPLICANT_SECURITY_OWE) return; supplicant_dbus_dict_append_basic(dict, "ieee80211w", DBUS_TYPE_UINT32, @@ -6227,6 +6238,11 @@ static void add_network_security(DBusMessageIter *dict, GSupplicantSSID *ssid) key_mgmt = "SAE"; add_network_security_psk(dict, ssid); break; + case G_SUPPLICANT_SECURITY_OWE: + key_mgmt = "OWE"; + add_network_security_ciphers(dict, ssid); + add_network_security_proto(dict, ssid); + break; #endif } diff --git a/include/service.h b/include/service.h index b276662..a5ee5ef 100644 --- a/include/service.h +++ b/include/service.h @@ -70,6 +70,7 @@ enum connman_service_security { CONNMAN_SERVICE_SECURITY_RSN = 9, #if defined TIZEN_EXT CONNMAN_SERVICE_SECURITY_SAE = 10, + CONNMAN_SERVICE_SECURITY_OWE = 11, #endif }; diff --git a/plugins/wifi.c b/plugins/wifi.c index a434d5b..f3eb28e 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -3178,6 +3178,8 @@ static GSupplicantSecurity network_security(const char *security) return G_SUPPLICANT_SECURITY_FT_IEEE8021X; else if (g_str_equal(security, "sae")) return G_SUPPLICANT_SECURITY_SAE; + else if (g_str_equal(security, "owe")) + return G_SUPPLICANT_SECURITY_OWE; #endif return G_SUPPLICANT_SECURITY_UNKNOWN; diff --git a/src/service.c b/src/service.c index 1b2ed23..7b01002 100644 --- a/src/service.c +++ b/src/service.c @@ -352,6 +352,8 @@ enum connman_service_security __connman_service_string2security(const char *str) return CONNMAN_SERVICE_SECURITY_RSN; if (!strcmp(str, "sae")) return CONNMAN_SERVICE_SECURITY_SAE; + if (!strcmp(str, "owe")) + return CONNMAN_SERVICE_SECURITY_OWE; #endif return CONNMAN_SERVICE_SECURITY_UNKNOWN; @@ -374,6 +376,8 @@ static const char *security2string(enum connman_service_security security) return "rsn"; case CONNMAN_SERVICE_SECURITY_SAE: return "sae"; + case CONNMAN_SERVICE_SECURITY_OWE: + return "owe"; #else case CONNMAN_SERVICE_SECURITY_RSN: return "psk"; @@ -8212,6 +8216,9 @@ static int service_connect(struct connman_service *service) switch (service->security) { case CONNMAN_SERVICE_SECURITY_UNKNOWN: case CONNMAN_SERVICE_SECURITY_NONE: +#if defined TIZEN_EXT + case CONNMAN_SERVICE_SECURITY_OWE: +#endif break; case CONNMAN_SERVICE_SECURITY_WEP: case CONNMAN_SERVICE_SECURITY_PSK: @@ -8292,6 +8299,7 @@ static int service_connect(struct connman_service *service) case CONNMAN_SERVICE_SECURITY_RSN: #if defined TIZEN_EXT case CONNMAN_SERVICE_SECURITY_SAE: + case CONNMAN_SERVICE_SECURITY_OWE: #endif break; case CONNMAN_SERVICE_SECURITY_8021X: @@ -9046,6 +9054,8 @@ static enum connman_service_security convert_wifi_security(const char *security) #if defined TIZEN_EXT else if (g_str_equal(security, "sae")) return CONNMAN_SERVICE_SECURITY_SAE; + else if (g_str_equal(security, "owe")) + return CONNMAN_SERVICE_SECURITY_OWE; else if (g_str_equal(security, "ft_psk") == TRUE) return CONNMAN_SERVICE_SECURITY_PSK; else if (g_str_equal(security, "ft_ieee8021x") == TRUE) -- 2.7.4