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
diff --git a/wpa_supplicant/hidl/1.2/sta_network.cpp b/wpa_supplicant/hidl/1.2/sta_network.cpp
index 1354055..9f4e9d2 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.cpp
+++ b/wpa_supplicant/hidl/1.2/sta_network.cpp
@@ -875,6 +875,7 @@
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, 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 @@
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 a235257..16d065e 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.h
+++ b/wpa_supplicant/hidl/1.2/sta_network.h
@@ -363,6 +363,8 @@
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.