[WPA3] Move KeyMgmt capability API from sta_network to sta_iface
Move KeyMgmt capability API from sta_network to sta_iface.
Bug: 112195778
Test: Functional test
Change-Id: I2077cc7026984175fa2cd51ee1517e5efa3396db
diff --git a/wpa_supplicant/hidl/1.2/sta_iface.cpp b/wpa_supplicant/hidl/1.2/sta_iface.cpp
index 8eb729e..1b8e350 100644
--- a/wpa_supplicant/hidl/1.2/sta_iface.cpp
+++ b/wpa_supplicant/hidl/1.2/sta_iface.cpp
@@ -25,7 +25,7 @@
namespace {
using android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
using android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
-using android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface;
+using android::hardware::wifi::supplicant::V1_2::ISupplicantStaIface;
using android::hardware::wifi::supplicant::V1_2::implementation::HidlManager;
constexpr uint32_t kMaxAnqpElems = 100;
@@ -511,6 +511,14 @@
&StaIface::enableAutoReconnectInternal, _hidl_cb, enable);
}
+Return<void> StaIface::getKeyMgmtCapabilities(
+ getKeyMgmtCapabilities_cb _hidl_cb)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
+ &StaIface::getKeyMgmtCapabilitiesInternal, _hidl_cb);
+}
+
std::pair<SupplicantStatus, std::string> StaIface::getNameInternal()
{
return {{SupplicantStatusCode::SUCCESS, ""}, ifname_};
@@ -1016,6 +1024,53 @@
return {SupplicantStatusCode::SUCCESS, ""};
}
+std::pair<SupplicantStatus, uint32_t>
+StaIface::getKeyMgmtCapabilitiesInternal()
+{
+ struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+ struct wpa_driver_capa capa;
+ uint32_t mask = 0;
+
+ /* Get capabilities from driver and populate the key management mask */
+ if (wpa_drv_get_capa(wpa_s, &capa) < 0) {
+ return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, mask};
+ }
+
+ /* Logic from ctrl_iface.c, NONE and IEEE8021X have no capability
+ * flags and always enabled.
+ */
+ mask |=
+ (ISupplicantStaNetwork::KeyMgmtMask::NONE |
+ ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X);
+
+ if (capa.key_mgmt &
+ (WPA_DRIVER_CAPA_KEY_MGMT_WPA | WPA_DRIVER_CAPA_KEY_MGMT_WPA2)) {
+ mask |= ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP;
+ }
+
+ if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK |
+ WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
+ mask |= ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK;
+ }
+#ifdef CONFIG_SUITEB192
+ if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192) {
+ mask |= ISupplicantStaNetwork::KeyMgmtMask::SUITE_B_192;
+ }
+#endif /* CONFIG_SUITEB192 */
+#ifdef CONFIG_OWE
+ if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_OWE) {
+ mask |= ISupplicantStaNetwork::KeyMgmtMask::OWE;
+ }
+#endif /* CONFIG_OWE */
+#ifdef CONFIG_SAE
+ if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE) {
+ mask |= ISupplicantStaNetwork::KeyMgmtMask::SAE;
+ }
+#endif /* CONFIG_SAE */
+
+ return {{SupplicantStatusCode::SUCCESS, ""}, mask};
+}
+
/**
* Retrieve the underlying |wpa_supplicant| struct
* pointer for this iface.
diff --git a/wpa_supplicant/hidl/1.2/sta_iface.h b/wpa_supplicant/hidl/1.2/sta_iface.h
index 2c49364..bda9d93 100644
--- a/wpa_supplicant/hidl/1.2/sta_iface.h
+++ b/wpa_supplicant/hidl/1.2/sta_iface.h
@@ -15,9 +15,9 @@
#include <android-base/macros.h>
-#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.h>
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaNetwork.h>
extern "C"
{
@@ -35,14 +35,14 @@
namespace supplicant {
namespace V1_2 {
namespace implementation {
-using namespace android::hardware::wifi::supplicant::V1_0;
+using namespace android::hardware::wifi::supplicant::V1_2;
/**
* Implementation of StaIface hidl object. Each unique hidl
* object is used for control operations on a specific interface
* controlled by wpa_supplicant.
*/
-class StaIface : public V1_1::ISupplicantStaIface
+class StaIface : public V1_2::ISupplicantStaIface
{
public:
StaIface(struct wpa_global* wpa_global, const char ifname[]);
@@ -159,6 +159,8 @@
uint32_t id, removeExtRadioWork_cb _hidl_cb) override;
Return<void> enableAutoReconnect(
bool enable, enableAutoReconnect_cb _hidl_cb) override;
+ Return<void> getKeyMgmtCapabilities(
+ getKeyMgmtCapabilities_cb _hidl_cb) override;
private:
// Corresponding worker functions for the HIDL methods.
@@ -232,6 +234,7 @@
uint32_t timeout_in_sec);
SupplicantStatus removeExtRadioWorkInternal(uint32_t id);
SupplicantStatus enableAutoReconnectInternal(bool enable);
+ std::pair<SupplicantStatus, uint32_t> getKeyMgmtCapabilitiesInternal();
struct wpa_supplicant* retrieveIfacePtr();
diff --git a/wpa_supplicant/hidl/1.2/sta_network.cpp b/wpa_supplicant/hidl/1.2/sta_network.cpp
index a1bc73d..944c4a9 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.cpp
+++ b/wpa_supplicant/hidl/1.2/sta_network.cpp
@@ -789,14 +789,6 @@
&StaNetwork::setSaePasswordIdInternal, _hidl_cb, sae_password_id);
}
-Return<void> StaNetwork::getKeyMgmtCapabilities(
- getKeyMgmtCapabilities_cb _hidl_cb)
-{
- return validateAndCall(
- this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
- &StaNetwork::getKeyMgmtCapabilitiesInternal, _hidl_cb);
-}
-
std::pair<SupplicantStatus, uint32_t> StaNetwork::getIdInternal()
{
return {{SupplicantStatusCode::SUCCESS, ""}, network_id_};
@@ -1928,58 +1920,6 @@
return {SupplicantStatusCode::SUCCESS, ""};
}
-std::pair<SupplicantStatus, uint32_t>
-StaNetwork::getKeyMgmtCapabilitiesInternal()
-{
- struct wpa_supplicant *wpa_s = retrieveIfacePtr();
- struct wpa_driver_capa capa;
- uint32_t mask = 0;
-
- if (!wpa_s) {
- return {{SupplicantStatusCode::FAILURE_IFACE_UNKNOWN, ""},
- mask};
- }
-
- /* Get capabilities from driver and populate the key management mask */
- if (wpa_drv_get_capa(wpa_s, &capa) < 0) {
- return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, mask};
- }
-
- /* Logic from ctrl_iface.c, NONE and IEEE8021X have no capability
- * flags and always enabled.
- */
- mask |=
- (ISupplicantStaNetwork::KeyMgmtMask::NONE |
- ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X);
-
- if (capa.key_mgmt &
- (WPA_DRIVER_CAPA_KEY_MGMT_WPA | WPA_DRIVER_CAPA_KEY_MGMT_WPA2)) {
- mask |= ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP;
- }
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
- mask |= ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK;
- }
-#ifdef CONFIG_SUITEB192
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192) {
- mask |= ISupplicantStaNetwork::KeyMgmtMask::SUITE_B_192;
- }
-#endif /* CONFIG_SUITEB192 */
-#ifdef CONFIG_OWE
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_OWE) {
- mask |= ISupplicantStaNetwork::KeyMgmtMask::OWE;
- }
-#endif /* CONFIG_OWE */
-#ifdef CONFIG_SAE
- if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE) {
- mask |= ISupplicantStaNetwork::KeyMgmtMask::SAE;
- }
-#endif /* CONFIG_SAE */
-
- return {{SupplicantStatusCode::SUCCESS, ""}, mask};
-}
-
SupplicantStatus StaNetwork::setGroupMgmtCipherInternal(uint32_t
group_mgmt_cipher_mask)
{
diff --git a/wpa_supplicant/hidl/1.2/sta_network.h b/wpa_supplicant/hidl/1.2/sta_network.h
index 5108ef4..a235257 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.h
+++ b/wpa_supplicant/hidl/1.2/sta_network.h
@@ -225,8 +225,6 @@
Return<void> setSaePasswordId(
const hidl_string& sae_password_id,
setSaePasswordId_cb _hidl_cb) override;
- Return<void> getKeyMgmtCapabilities(
- getKeyMgmtCapabilities_cb _hidl_cb) override;
private:
// Corresponding worker functions for the HIDL methods.
@@ -341,7 +339,6 @@
const std::string& sae_password);
SupplicantStatus setSaePasswordIdInternal(
const std::string& sae_password_id);
- std::pair<SupplicantStatus, uint32_t> getKeyMgmtCapabilitiesInternal();
SupplicantStatus setGroupMgmtCipherInternal(uint32_t group_mgmt_cipher_mask);
std::pair<SupplicantStatus, uint32_t> getGroupMgmtCipherInternal();