aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2019-04-22 15:03:42 -0700
committerHai Shalom <haishalom@google.com>2019-04-23 15:30:05 +0000
commitbc888641a762ea07c3aadd01adcee0dfbaa787a4 (patch)
treed352900f78afe2edc62aad1eeafa6d16e5c7b202
parent200b74922ba9c9147812b97b8d1defe9b92049ba (diff)
downloadwpa_supplicant_8-bc888641a762ea07c3aadd01adcee0dfbaa787a4.tar.gz
Enable SAE Fast Transition key management in HIDL
Enable SAE Fast Transition key management in HIDL. Keep FT/PSK and FT/EAP in the framework for backward compatibility with older supplicant HALs. Bug: 131102354 Test: Connect to WPA2-Personal network Test: Connect to WPA3-Personal network Test: Connect to WPA3-Enterprise network Test: Connect to OWE network Test: Connect to Open network Test: DPP ACTS: act.py -c ../WifiDppConfig.json -tc WifiDppTest Test: atest SupplicantStaNetworkHalTest Change-Id: Ia43799bdd4be8a6efd5aad643fc33574801b0ee4
-rw-r--r--wpa_supplicant/hidl/1.2/sta_network.cpp45
-rw-r--r--wpa_supplicant/hidl/1.2/sta_network.h2
2 files changed, 45 insertions, 2 deletions
diff --git a/wpa_supplicant/hidl/1.2/sta_network.cpp b/wpa_supplicant/hidl/1.2/sta_network.cpp
index 13540557..9f4e9d2f 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.cpp
+++ b/wpa_supplicant/hidl/1.2/sta_network.cpp
@@ -875,6 +875,7 @@ SupplicantStatus StaNetwork::setKeyMgmtInternal(uint32_t key_mgmt_mask)
if (key_mgmt_mask & ~kAllowedKeyMgmtMask) {
return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
}
+ setFastTransitionKeyMgmt(key_mgmt_mask);
wpa_ssid->key_mgmt = key_mgmt_mask;
wpa_printf(MSG_MSGDUMP, "key_mgmt: 0x%x", wpa_ssid->key_mgmt);
resetInternalStateAfterParamsUpdate();
@@ -1320,8 +1321,10 @@ std::pair<SupplicantStatus, bool> StaNetwork::getScanSsidInternal()
std::pair<SupplicantStatus, uint32_t> StaNetwork::getKeyMgmtInternal()
{
struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
- return {{SupplicantStatusCode::SUCCESS, ""},
- wpa_ssid->key_mgmt & kAllowedKeyMgmtMask};
+ uint32_t key_mgmt_mask = wpa_ssid->key_mgmt & kAllowedKeyMgmtMask;
+
+ resetFastTransitionKeyMgmt(key_mgmt_mask);
+ return {{SupplicantStatusCode::SUCCESS, ""}, key_mgmt_mask};
}
std::pair<SupplicantStatus, uint32_t> StaNetwork::getProtoInternal()
@@ -2120,6 +2123,44 @@ int StaNetwork::setByteArrayKeyFieldAndResetState(
resetInternalStateAfterParamsUpdate();
return 0;
}
+
+/**
+ * Helper function to set the fast transition bits in the key management
+ * bitmask, to allow FT support when possible.
+ */
+void StaNetwork::setFastTransitionKeyMgmt(uint32_t &key_mgmt_mask)
+{
+ if (key_mgmt_mask & WPA_KEY_MGMT_SAE) {
+ key_mgmt_mask |= WPA_KEY_MGMT_FT_SAE;
+ }
+
+ if (key_mgmt_mask & WPA_KEY_MGMT_PSK) {
+ key_mgmt_mask |= WPA_KEY_MGMT_FT_PSK;
+ }
+
+ if (key_mgmt_mask & WPA_KEY_MGMT_IEEE8021X) {
+ key_mgmt_mask |= WPA_KEY_MGMT_FT_IEEE8021X;
+ }
+}
+
+/**
+ * Helper function to reset the fast transition bits in the key management
+ * bitmask.
+ */
+void StaNetwork::resetFastTransitionKeyMgmt(uint32_t &key_mgmt_mask)
+{
+ if (key_mgmt_mask & WPA_KEY_MGMT_SAE) {
+ key_mgmt_mask &= ~WPA_KEY_MGMT_FT_SAE;
+ }
+
+ if (key_mgmt_mask & WPA_KEY_MGMT_PSK) {
+ key_mgmt_mask &= ~WPA_KEY_MGMT_FT_PSK;
+ }
+
+ if (key_mgmt_mask & WPA_KEY_MGMT_IEEE8021X) {
+ key_mgmt_mask &= ~WPA_KEY_MGMT_FT_IEEE8021X;
+ }
+}
} // namespace implementation
} // namespace V1_2
} // namespace supplicant
diff --git a/wpa_supplicant/hidl/1.2/sta_network.h b/wpa_supplicant/hidl/1.2/sta_network.h
index a2352576..16d065e0 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.h
+++ b/wpa_supplicant/hidl/1.2/sta_network.h
@@ -363,6 +363,8 @@ private:
const uint8_t* value, const size_t value_len,
uint8_t** to_update_field, size_t* to_update_field_len,
const char* hexdump_prefix);
+ void setFastTransitionKeyMgmt(uint32_t &key_mgmt_mask);
+ void resetFastTransitionKeyMgmt(uint32_t &key_mgmt_mask);
// Reference to the global wpa_struct. This is assumed to be valid
// for the lifetime of the process.