Merge "DPP [AIDL]: Add support for DPP-AKM based profile configuration."
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index 531ccea..04e84b4 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1559,6 +1559,7 @@
struct wpa_ssid *config)
{
DppAkm securityAkm;
+ DppConnectionKeys aidl_keys{};
std::string aidl_ifname = misc_utils::charBufToString(wpa_s->ifname);
if ((config->key_mgmt & WPA_KEY_MGMT_SAE) &&
@@ -1566,6 +1567,8 @@
securityAkm = DppAkm::SAE;
} else if (config->key_mgmt & WPA_KEY_MGMT_PSK) {
securityAkm = DppAkm::PSK;
+ } else if (config->key_mgmt & WPA_KEY_MGMT_DPP) {
+ securityAkm = DppAkm::DPP;
} else {
/* Unsupported AKM */
wpa_printf(MSG_ERROR, "DPP: Error: Unsupported AKM 0x%X",
@@ -1579,6 +1582,10 @@
config->ssid,
config->ssid + config->ssid_len);
+ if (securityAkm == DppAkm::DPP) {
+ // TODO Add code to fill aidl_keys
+ }
+
/* At this point, the network is already registered, notify about new
* received configuration
*/
@@ -1586,7 +1593,8 @@
std::bind(
&ISupplicantStaIfaceCallback::onDppSuccessConfigReceived,
std::placeholders::_1, aidl_ssid, passphrase,
- byteArrToVec(config->psk, 32), securityAkm));
+ byteArrToVec(config->psk, 32), securityAkm,
+ aidl_keys));
}
/**
diff --git a/wpa_supplicant/aidl/sta_iface.cpp b/wpa_supplicant/aidl/sta_iface.cpp
index 4cee4d8..084ea2c 100644
--- a/wpa_supplicant/aidl/sta_iface.cpp
+++ b/wpa_supplicant/aidl/sta_iface.cpp
@@ -694,13 +694,14 @@
int32_t in_peerBootstrapId, int32_t in_ownBootstrapId,
const std::string& in_ssid, const std::string& in_password,
const std::string& in_psk, DppNetRole in_netRole,
- DppAkm in_securityAkm)
+ DppAkm in_securityAkm, const std::vector<uint8_t>& in_privEcKey,
+ std::vector<uint8_t>* _aidl_return)
{
return validateAndCall(
this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
- &StaIface::startDppConfiguratorInitiatorInternal,
+ &StaIface::startDppConfiguratorInitiatorInternal, _aidl_return,
in_peerBootstrapId,in_ownBootstrapId, in_ssid, in_password,
- in_psk, in_netRole, in_securityAkm);
+ in_psk, in_netRole, in_securityAkm, in_privEcKey);
}
::ndk::ScopedAStatus StaIface::startDppEnrolleeInitiator(
@@ -754,6 +755,14 @@
&StaIface::stopDppResponderInternal, in_ownBootstrapId);
}
+::ndk::ScopedAStatus StaIface::generateSelfDppConfiguration(
+ const std::string& in_ssid, const std::vector<uint8_t>& in_privEcKey)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_IFACE_INVALID,
+ &StaIface::generateSelfDppConfigurationInternal, in_ssid, in_privEcKey);
+}
+
::ndk::ScopedAStatus StaIface::getWpaDriverCapabilities(
WpaDriverCapabilitiesMask* _aidl_return)
{
@@ -1400,10 +1409,12 @@
return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
}
-ndk::ScopedAStatus StaIface::startDppConfiguratorInitiatorInternal(
- uint32_t peer_bootstrap_id, uint32_t own_bootstrap_id,
+std::pair<std::vector<uint8_t>, ndk::ScopedAStatus>
+StaIface::startDppConfiguratorInitiatorInternal(
+ uint32_t peer_bootstrap_id, uint32_t own_bootstrap_id,
const std::string& ssid, const std::string& password,
- const std::string& psk, DppNetRole net_role, DppAkm security_akm)
+ const std::string& psk, DppNetRole net_role, DppAkm security_akm,
+ const std::vector<uint8_t> &privEcKey)
{
#ifdef CONFIG_DPP
struct wpa_supplicant *wpa_s = retrieveIfacePtr();
@@ -1413,7 +1424,8 @@
net_role != DppNetRole::STA) {
wpa_printf(MSG_ERROR,
"DPP: Error: Invalid network role specified: %d", net_role);
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(),
+ createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
cmd += " peer=" + std::to_string(peer_bootstrap_id);
@@ -1422,10 +1434,11 @@
/* Check for supported AKMs */
if (security_akm != DppAkm::PSK && security_akm != DppAkm::SAE &&
- security_akm != DppAkm::PSK_SAE) {
+ security_akm != DppAkm::PSK_SAE && security_akm != DppAkm::DPP) {
wpa_printf(MSG_ERROR, "DPP: Error: invalid AKM specified: %d",
security_akm);
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(),
+ createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
/* SAE AKM requires SSID and password to be initialized */
@@ -1433,17 +1446,20 @@
security_akm == DppAkm::PSK_SAE) &&
(ssid.empty() || password.empty())) {
wpa_printf(MSG_ERROR, "DPP: Error: Password or SSID not specified");
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(),
+ createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
} else if (security_akm == DppAkm::PSK ||
security_akm == DppAkm::PSK_SAE) {
/* PSK AKM requires SSID and password/psk to be initialized */
if (ssid.empty()) {
wpa_printf(MSG_ERROR, "DPP: Error: SSID not specified");
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(),
+ createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
if (password.empty() && psk.empty()) {
wpa_printf(MSG_ERROR, "DPP: Error: Password or PSK not specified");
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(),
+ createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
}
@@ -1477,10 +1493,13 @@
role += "psk-sae";
break;
+ // TODO add code to handle DPP AKM
+ case DppAkm::DPP:
default:
wpa_printf(MSG_ERROR,
"DPP: Invalid or unsupported security AKM specified: %d", security_akm);
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(),
+ createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
cmd += " conf=";
@@ -1495,10 +1514,10 @@
"DPP initiator command: %s", cmd.c_str());
if (wpas_dpp_auth_init(wpa_s, cmd.c_str()) == 0) {
- return ndk::ScopedAStatus::ok();
+ return {std::vector<uint8_t>(), ndk::ScopedAStatus::ok()};
}
#endif
- return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ return {std::vector<uint8_t>(), createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
ndk::ScopedAStatus StaIface::startDppEnrolleeInitiatorInternal(
@@ -1643,6 +1662,17 @@
#endif
}
+ndk::ScopedAStatus StaIface::generateSelfDppConfigurationInternal(const std::string& ssid,
+ const std::vector<uint8_t> &privEcKey)
+{
+#ifdef CONFIG_DPP
+ // TODO Implement this function
+ return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
+#else
+ return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
+#endif
+}
+
std::pair<ConnectionCapabilities, ndk::ScopedAStatus>
StaIface::getConnectionCapabilitiesInternal()
{
diff --git a/wpa_supplicant/aidl/sta_iface.h b/wpa_supplicant/aidl/sta_iface.h
index 0dd684d..44e3ef5 100644
--- a/wpa_supplicant/aidl/sta_iface.h
+++ b/wpa_supplicant/aidl/sta_iface.h
@@ -134,7 +134,9 @@
::ndk::ScopedAStatus startDppConfiguratorInitiator(
int32_t in_peerBootstrapId, int32_t in_ownBootstrapId,
const std::string& in_ssid, const std::string& in_password,
- const std::string& in_psk, DppNetRole in_netRole, DppAkm in_securityAkm) override;
+ const std::string& in_psk, DppNetRole in_netRole, DppAkm in_securityAkm,
+ const std::vector<uint8_t>& in_privEcKey,
+ std::vector<uint8_t>* _aidl_return) override;
::ndk::ScopedAStatus startDppEnrolleeInitiator(
int32_t in_peerBootstrapId, int32_t in_ownBootstrapId) override;
::ndk::ScopedAStatus stopDppInitiator() override;
@@ -147,6 +149,8 @@
DppResponderBootstrapInfo* _aidl_return) override;
::ndk::ScopedAStatus startDppEnrolleeResponder(int32_t in_listenChannel) override;
::ndk::ScopedAStatus stopDppResponder(int32_t in_ownBootstrapId) override;
+ ::ndk::ScopedAStatus generateSelfDppConfiguration(
+ const std::string& in_ssid, const std::vector<uint8_t>& in_privEcKey) override;
::ndk::ScopedAStatus setQosPolicyFeatureEnabled(bool in_enable) override;
::ndk::ScopedAStatus sendQosPolicyResponse(
bool in_morePolicies, const std::vector<QosPolicyStatus>& in_qosPolicyStatusList) override;
@@ -232,10 +236,10 @@
std::pair<KeyMgmtMask, ndk::ScopedAStatus> getKeyMgmtCapabilitiesInternal();
std::pair<uint32_t, ndk::ScopedAStatus> addDppPeerUriInternal(const std::string& uri);
ndk::ScopedAStatus removeDppUriInternal(uint32_t bootstrap_id);
- ndk::ScopedAStatus startDppConfiguratorInitiatorInternal(uint32_t peer_bootstrap_id,
- uint32_t own_bootstrap_id,
- const std::string& ssid, const std::string& password,
- const std::string& psk, DppNetRole net_role, DppAkm security_akm);
+ std::pair<std::vector<uint8_t>, ndk::ScopedAStatus> startDppConfiguratorInitiatorInternal(
+ uint32_t peer_bootstrap_id, uint32_t own_bootstrap_id, const std::string& ssid,
+ const std::string& password, const std::string& psk, DppNetRole net_role,
+ DppAkm security_akm, const std::vector<uint8_t> &privEcKey);
ndk::ScopedAStatus startDppEnrolleeInitiatorInternal(uint32_t peer_bootstrap_id,
uint32_t own_bootstrap_id);
ndk::ScopedAStatus stopDppInitiatorInternal();
@@ -248,6 +252,8 @@
DppCurve curve);
ndk::ScopedAStatus startDppEnrolleeResponderInternal(uint32_t listen_channel);
ndk::ScopedAStatus stopDppResponderInternal(uint32_t own_bootstrap_id);
+ ndk::ScopedAStatus generateSelfDppConfigurationInternal(
+ const std::string& ssid, const std::vector<uint8_t> &privEcKey);
ndk::ScopedAStatus setQosPolicyFeatureEnabledInternal(bool enable);
ndk::ScopedAStatus sendQosPolicyResponseInternal(
bool more_policies, const std::vector<QosPolicyStatus>& qos_policy_status_list);
diff --git a/wpa_supplicant/aidl/sta_network.cpp b/wpa_supplicant/aidl/sta_network.cpp
index c195190..da5decd 100644
--- a/wpa_supplicant/aidl/sta_network.cpp
+++ b/wpa_supplicant/aidl/sta_network.cpp
@@ -176,6 +176,13 @@
&StaNetwork::setBssidInternal, in_bssid);
}
+::ndk::ScopedAStatus StaNetwork::setDppKeys(const DppConnectionKeys& in_keys)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
+ &StaNetwork::setDppKeysInternal, in_keys);
+}
+
::ndk::ScopedAStatus StaNetwork::setScanSsid(bool in_enable)
{
return validateAndCall(
@@ -936,6 +943,16 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus StaNetwork::setDppKeysInternal(const DppConnectionKeys& keys)
+{
+#ifdef CONFIG_DPP
+ // TODO Implement the function
+ return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
+#else
+ return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED);
+#endif
+}
+
ndk::ScopedAStatus StaNetwork::setScanSsidInternal(bool enable)
{
struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
diff --git a/wpa_supplicant/aidl/sta_network.h b/wpa_supplicant/aidl/sta_network.h
index 704ce2e..5105669 100644
--- a/wpa_supplicant/aidl/sta_network.h
+++ b/wpa_supplicant/aidl/sta_network.h
@@ -21,6 +21,7 @@
#include <aidl/android/hardware/wifi/supplicant/NetworkRequestEapSimUmtsAuthParams.h>
#include <aidl/android/hardware/wifi/supplicant/NetworkResponseEapSimUmtsAuthParams.h>
#include <aidl/android/hardware/wifi/supplicant/SaeH2eMode.h>
+#include <aidl/android/hardware/wifi/supplicant/DppConnectionKeys.h>
extern "C"
{
@@ -63,6 +64,7 @@
const std::shared_ptr<ISupplicantStaNetworkCallback>& in_callback) override;
::ndk::ScopedAStatus setSsid(const std::vector<uint8_t>& in_ssid) override;
::ndk::ScopedAStatus setBssid(const std::vector<uint8_t>& in_bssid) override;
+ ::ndk::ScopedAStatus setDppKeys(const DppConnectionKeys& in_keys) override;
::ndk::ScopedAStatus setScanSsid(bool in_enable) override;
::ndk::ScopedAStatus setKeyMgmt(KeyMgmtMask in_keyMgmtMask) override;
::ndk::ScopedAStatus setProto(ProtoMask in_protoMask) override;
@@ -181,6 +183,7 @@
const std::shared_ptr<ISupplicantStaNetworkCallback>& callback);
ndk::ScopedAStatus setSsidInternal(const std::vector<uint8_t>& ssid);
ndk::ScopedAStatus setBssidInternal(const std::vector<uint8_t>& bssid);
+ ndk::ScopedAStatus setDppKeysInternal(const DppConnectionKeys& keys);
ndk::ScopedAStatus setScanSsidInternal(bool enable);
ndk::ScopedAStatus setKeyMgmtInternal(
KeyMgmtMask mask);