1 /*
2 * hidl interface for wpa_supplicant daemon
3 * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */
9
10 #include "hidl_manager.h"
11 #include "hidl_return_util.h"
12 #include "misc_utils.h"
13 #include "sta_network.h"
14
15 extern "C"
16 {
17 #include "wps_supplicant.h"
18 }
19
20 namespace {
21 using android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
22 using android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
23 using ISupplicantStaNetworkV1_2 = android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
24 using ISupplicantStaNetworkV1_3 = android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork;
25 using ISupplicantStaNetworkV1_4 = android::hardware::wifi::supplicant::V1_4::ISupplicantStaNetwork;
26
27 constexpr uint8_t kZeroBssid[6] = {0, 0, 0, 0, 0, 0};
28
29 constexpr uint32_t kAllowedKeyMgmtMask =
30 (static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::NONE) |
31 static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK) |
32 static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP) |
33 static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X) |
34 static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::FT_EAP) |
35 static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::FT_PSK) |
36 static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::OSEN) |
37 static_cast<uint32_t>(ISupplicantStaNetworkV1_2::KeyMgmtMask::SAE) |
38 static_cast<uint32_t>(ISupplicantStaNetworkV1_2::KeyMgmtMask::SUITE_B_192) |
39 static_cast<uint32_t>(ISupplicantStaNetworkV1_2::KeyMgmtMask::OWE) |
40 static_cast<uint32_t>(ISupplicantStaNetworkV1_2::KeyMgmtMask::WPA_PSK_SHA256) |
41 static_cast<uint32_t>(ISupplicantStaNetworkV1_2::KeyMgmtMask::WPA_EAP_SHA256) |
42 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::KeyMgmtMask::WAPI_PSK) |
43 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::KeyMgmtMask::WAPI_CERT) |
44 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::KeyMgmtMask::FILS_SHA256) |
45 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::KeyMgmtMask::FILS_SHA384));
46 constexpr uint32_t kAllowedProtoMask =
47 (static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::WPA) |
48 static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::RSN) |
49 static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::OSEN) |
50 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::ProtoMask::WAPI));
51 constexpr uint32_t kAllowedAuthAlgMask =
52 (static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::OPEN) |
53 static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::SHARED) |
54 static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::LEAP) |
55 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::AuthAlgMask::SAE));
56 constexpr uint32_t kAllowedGroupCipherMask =
57 (static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::WEP40) |
58 static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::WEP104) |
59 static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::TKIP) |
60 static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::CCMP) |
61 static_cast<uint32_t>(
62 ISupplicantStaNetwork::GroupCipherMask::GTK_NOT_USED) |
63 static_cast<uint32_t>(ISupplicantStaNetworkV1_2::GroupCipherMask::GCMP_256) |
64 static_cast<uint32_t>(ISupplicantStaNetworkV1_3::GroupCipherMask::SMS4) |
65 static_cast<uint32_t>(ISupplicantStaNetworkV1_4::GroupCipherMask::GCMP_128));
66 constexpr uint32_t kAllowedPairwisewCipherMask =
67 (static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::NONE) |
68 static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::TKIP) |
69 static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::CCMP) |
70 static_cast<uint32_t>(
71 ISupplicantStaNetworkV1_2::PairwiseCipherMask::GCMP_256) |
72 static_cast<uint32_t>(
73 ISupplicantStaNetworkV1_3::PairwiseCipherMask::SMS4) |
74 static_cast<uint32_t>(ISupplicantStaNetworkV1_4::PairwiseCipherMask::GCMP_128));
75 constexpr uint32_t kAllowedGroupMgmtCipherMask =
76 (static_cast<uint32_t>(
77 ISupplicantStaNetworkV1_2::GroupMgmtCipherMask::BIP_GMAC_128) |
78 static_cast<uint32_t>(
79 ISupplicantStaNetworkV1_2::GroupMgmtCipherMask::BIP_GMAC_256) |
80 static_cast<uint32_t>(
81 ISupplicantStaNetworkV1_2::GroupMgmtCipherMask::BIP_CMAC_256));
82
83 constexpr uint32_t kEapMethodMax =
84 static_cast<uint32_t>(ISupplicantStaNetwork::EapMethod::WFA_UNAUTH_TLS) + 1;
85 constexpr char const *kEapMethodStrings[kEapMethodMax] = {
86 "PEAP", "TLS", "TTLS", "PWD", "SIM", "AKA", "AKA'", "WFA-UNAUTH-TLS"};
87 constexpr uint32_t kEapPhase2MethodMax =
88 static_cast<uint32_t>(ISupplicantStaNetwork::EapPhase2Method::AKA_PRIME) +
89 1;
90 constexpr char const *kEapPhase2MethodStrings[kEapPhase2MethodMax] = {
91 "", "PAP", "MSCHAP", "MSCHAPV2", "GTC", "SIM", "AKA", "AKA'"};
92 constexpr char kEapPhase2AuthPrefix[] = "auth=";
93 constexpr char kEapPhase2AuthEapPrefix[] = "autheap=";
94 constexpr char kNetworkEapSimGsmAuthResponse[] = "GSM-AUTH";
95 constexpr char kNetworkEapSimUmtsAuthResponse[] = "UMTS-AUTH";
96 constexpr char kNetworkEapSimUmtsAutsResponse[] = "UMTS-AUTS";
97 constexpr char kNetworkEapSimGsmAuthFailure[] = "GSM-FAIL";
98 constexpr char kNetworkEapSimUmtsAuthFailure[] = "UMTS-FAIL";
99
100 #ifdef CONFIG_WAPI_INTERFACE
101 std::string dummyWapiCertSuite;
102 std::vector<uint8_t> dummyWapiPsk;
103 #endif /* CONFIG_WAPI_INTERFACE */
104 } // namespace
105
106 namespace android {
107 namespace hardware {
108 namespace wifi {
109 namespace supplicant {
110 namespace V1_4 {
111 namespace implementation {
112 using hidl_return_util::validateAndCall;
113 using V1_0::SupplicantStatus;
114 using V1_0::SupplicantStatusCode;
115
StaNetwork(struct wpa_global * wpa_global,const char ifname[],int network_id)116 StaNetwork::StaNetwork(
117 struct wpa_global *wpa_global, const char ifname[], int network_id)
118 : wpa_global_(wpa_global),
119 ifname_(ifname),
120 network_id_(network_id),
121 is_valid_(true)
122 {}
123
invalidate()124 void StaNetwork::invalidate() { is_valid_ = false; }
isValid()125 bool StaNetwork::isValid()
126 {
127 return (is_valid_ && (retrieveNetworkPtr() != nullptr));
128 }
129
getId(getId_cb _hidl_cb)130 Return<void> StaNetwork::getId(getId_cb _hidl_cb)
131 {
132 return validateAndCall(
133 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
134 &StaNetwork::getIdInternal, _hidl_cb);
135 }
136
getInterfaceName(getInterfaceName_cb _hidl_cb)137 Return<void> StaNetwork::getInterfaceName(getInterfaceName_cb _hidl_cb)
138 {
139 return validateAndCall(
140 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
141 &StaNetwork::getInterfaceNameInternal, _hidl_cb);
142 }
143
getType(getType_cb _hidl_cb)144 Return<void> StaNetwork::getType(getType_cb _hidl_cb)
145 {
146 return validateAndCall(
147 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
148 &StaNetwork::getTypeInternal, _hidl_cb);
149 }
150
registerCallback(const sp<ISupplicantStaNetworkCallback> & callback,registerCallback_cb _hidl_cb)151 Return<void> StaNetwork::registerCallback(
152 const sp<ISupplicantStaNetworkCallback> &callback,
153 registerCallback_cb _hidl_cb)
154 {
155 return validateAndCall(
156 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
157 &StaNetwork::registerCallbackInternal, _hidl_cb, callback);
158 }
159
registerCallback_1_4(const sp<V1_4::ISupplicantStaNetworkCallback> & callback,registerCallback_1_4_cb _hidl_cb)160 Return<void> StaNetwork::registerCallback_1_4(
161 const sp<V1_4::ISupplicantStaNetworkCallback> &callback,
162 registerCallback_1_4_cb _hidl_cb)
163 {
164 return validateAndCall(
165 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
166 &StaNetwork::registerCallback_1_4Internal, _hidl_cb, callback);
167 }
168
setSsid(const hidl_vec<uint8_t> & ssid,setSsid_cb _hidl_cb)169 Return<void> StaNetwork::setSsid(
170 const hidl_vec<uint8_t> &ssid, setSsid_cb _hidl_cb)
171 {
172 return validateAndCall(
173 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
174 &StaNetwork::setSsidInternal, _hidl_cb, ssid);
175 }
176
setBssid(const hidl_array<uint8_t,6> & bssid,setBssid_cb _hidl_cb)177 Return<void> StaNetwork::setBssid(
178 const hidl_array<uint8_t, 6> &bssid, setBssid_cb _hidl_cb)
179 {
180 return validateAndCall(
181 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
182 &StaNetwork::setBssidInternal, _hidl_cb, bssid);
183 }
184
setScanSsid(bool enable,setScanSsid_cb _hidl_cb)185 Return<void> StaNetwork::setScanSsid(bool enable, setScanSsid_cb _hidl_cb)
186 {
187 return validateAndCall(
188 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
189 &StaNetwork::setScanSsidInternal, _hidl_cb, enable);
190 }
191
setKeyMgmt(uint32_t key_mgmt_mask,setKeyMgmt_cb _hidl_cb)192 Return<void> StaNetwork::setKeyMgmt(
193 uint32_t key_mgmt_mask, setKeyMgmt_cb _hidl_cb)
194 {
195 return validateAndCall(
196 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
197 &StaNetwork::setKeyMgmtInternal, _hidl_cb, key_mgmt_mask);
198 }
199
setProto(uint32_t proto_mask,setProto_cb _hidl_cb)200 Return<void> StaNetwork::setProto(uint32_t proto_mask, setProto_cb _hidl_cb)
201 {
202 return validateAndCall(
203 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
204 &StaNetwork::setProtoInternal, _hidl_cb, proto_mask);
205 }
206
setAuthAlg(uint32_t auth_alg_mask,std::function<void (const SupplicantStatus & status)> _hidl_cb)207 Return<void> StaNetwork::setAuthAlg(
208 uint32_t auth_alg_mask,
209 std::function<void(const SupplicantStatus &status)> _hidl_cb)
210 {
211 return validateAndCall(
212 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
213 &StaNetwork::setAuthAlgInternal, _hidl_cb, auth_alg_mask);
214 }
215
setGroupCipher(uint32_t group_cipher_mask,setGroupCipher_cb _hidl_cb)216 Return<void> StaNetwork::setGroupCipher(
217 uint32_t group_cipher_mask, setGroupCipher_cb _hidl_cb)
218 {
219 return validateAndCall(
220 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
221 &StaNetwork::setGroupCipherInternal, _hidl_cb, group_cipher_mask);
222 }
223
setPairwiseCipher(uint32_t pairwise_cipher_mask,setPairwiseCipher_cb _hidl_cb)224 Return<void> StaNetwork::setPairwiseCipher(
225 uint32_t pairwise_cipher_mask, setPairwiseCipher_cb _hidl_cb)
226 {
227 return validateAndCall(
228 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
229 &StaNetwork::setPairwiseCipherInternal, _hidl_cb,
230 pairwise_cipher_mask);
231 }
232
setPskPassphrase(const hidl_string & psk,setPskPassphrase_cb _hidl_cb)233 Return<void> StaNetwork::setPskPassphrase(
234 const hidl_string &psk, setPskPassphrase_cb _hidl_cb)
235 {
236 return validateAndCall(
237 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
238 &StaNetwork::setPskPassphraseInternal, _hidl_cb, psk);
239 }
240
setPsk(const hidl_array<uint8_t,32> & psk,setPsk_cb _hidl_cb)241 Return<void> StaNetwork::setPsk(
242 const hidl_array<uint8_t, 32> &psk, setPsk_cb _hidl_cb)
243 {
244 return validateAndCall(
245 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
246 &StaNetwork::setPskInternal, _hidl_cb, psk);
247 }
248
setWepKey(uint32_t key_idx,const hidl_vec<uint8_t> & wep_key,setWepKey_cb _hidl_cb)249 Return<void> StaNetwork::setWepKey(
250 uint32_t key_idx, const hidl_vec<uint8_t> &wep_key, setWepKey_cb _hidl_cb)
251 {
252 return validateAndCall(
253 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
254 &StaNetwork::setWepKeyInternal, _hidl_cb, key_idx, wep_key);
255 }
256
setWepTxKeyIdx(uint32_t key_idx,setWepTxKeyIdx_cb _hidl_cb)257 Return<void> StaNetwork::setWepTxKeyIdx(
258 uint32_t key_idx, setWepTxKeyIdx_cb _hidl_cb)
259 {
260 return validateAndCall(
261 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
262 &StaNetwork::setWepTxKeyIdxInternal, _hidl_cb, key_idx);
263 }
264
setRequirePmf(bool enable,setRequirePmf_cb _hidl_cb)265 Return<void> StaNetwork::setRequirePmf(bool enable, setRequirePmf_cb _hidl_cb)
266 {
267 return validateAndCall(
268 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
269 &StaNetwork::setRequirePmfInternal, _hidl_cb, enable);
270 }
271
setEapMethod(ISupplicantStaNetwork::EapMethod method,setEapMethod_cb _hidl_cb)272 Return<void> StaNetwork::setEapMethod(
273 ISupplicantStaNetwork::EapMethod method, setEapMethod_cb _hidl_cb)
274 {
275 return validateAndCall(
276 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
277 &StaNetwork::setEapMethodInternal, _hidl_cb, method);
278 }
279
setEapPhase2Method(ISupplicantStaNetwork::EapPhase2Method method,setEapPhase2Method_cb _hidl_cb)280 Return<void> StaNetwork::setEapPhase2Method(
281 ISupplicantStaNetwork::EapPhase2Method method,
282 setEapPhase2Method_cb _hidl_cb)
283 {
284 return validateAndCall(
285 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
286 &StaNetwork::setEapPhase2MethodInternal, _hidl_cb, method);
287 }
288
setEapIdentity(const hidl_vec<uint8_t> & identity,setEapIdentity_cb _hidl_cb)289 Return<void> StaNetwork::setEapIdentity(
290 const hidl_vec<uint8_t> &identity, setEapIdentity_cb _hidl_cb)
291 {
292 return validateAndCall(
293 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
294 &StaNetwork::setEapIdentityInternal, _hidl_cb, identity);
295 }
296
setEapEncryptedImsiIdentity(const EapSimEncryptedIdentity & identity,setEapEncryptedImsiIdentity_cb _hidl_cb)297 Return<void> StaNetwork::setEapEncryptedImsiIdentity(
298 const EapSimEncryptedIdentity &identity,
299 setEapEncryptedImsiIdentity_cb _hidl_cb)
300 {
301 return validateAndCall(
302 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
303 &StaNetwork::setEapEncryptedImsiIdentityInternal, _hidl_cb,
304 identity);
305 }
306
setEapAnonymousIdentity(const hidl_vec<uint8_t> & identity,setEapAnonymousIdentity_cb _hidl_cb)307 Return<void> StaNetwork::setEapAnonymousIdentity(
308 const hidl_vec<uint8_t> &identity, setEapAnonymousIdentity_cb _hidl_cb)
309 {
310 return validateAndCall(
311 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
312 &StaNetwork::setEapAnonymousIdentityInternal, _hidl_cb, identity);
313 }
314
setEapPassword(const hidl_vec<uint8_t> & password,setEapPassword_cb _hidl_cb)315 Return<void> StaNetwork::setEapPassword(
316 const hidl_vec<uint8_t> &password, setEapPassword_cb _hidl_cb)
317 {
318 return validateAndCall(
319 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
320 &StaNetwork::setEapPasswordInternal, _hidl_cb, password);
321 }
322
setEapCACert(const hidl_string & path,setEapCACert_cb _hidl_cb)323 Return<void> StaNetwork::setEapCACert(
324 const hidl_string &path, setEapCACert_cb _hidl_cb)
325 {
326 return validateAndCall(
327 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
328 &StaNetwork::setEapCACertInternal, _hidl_cb, path);
329 }
330
setEapCAPath(const hidl_string & path,setEapCAPath_cb _hidl_cb)331 Return<void> StaNetwork::setEapCAPath(
332 const hidl_string &path, setEapCAPath_cb _hidl_cb)
333 {
334 return validateAndCall(
335 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
336 &StaNetwork::setEapCAPathInternal, _hidl_cb, path);
337 }
338
setEapClientCert(const hidl_string & path,setEapClientCert_cb _hidl_cb)339 Return<void> StaNetwork::setEapClientCert(
340 const hidl_string &path, setEapClientCert_cb _hidl_cb)
341 {
342 return validateAndCall(
343 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
344 &StaNetwork::setEapClientCertInternal, _hidl_cb, path);
345 }
346
setEapPrivateKeyId(const hidl_string & id,setEapPrivateKeyId_cb _hidl_cb)347 Return<void> StaNetwork::setEapPrivateKeyId(
348 const hidl_string &id, setEapPrivateKeyId_cb _hidl_cb)
349 {
350 return validateAndCall(
351 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
352 &StaNetwork::setEapPrivateKeyIdInternal, _hidl_cb, id);
353 }
354
setEapSubjectMatch(const hidl_string & match,setEapSubjectMatch_cb _hidl_cb)355 Return<void> StaNetwork::setEapSubjectMatch(
356 const hidl_string &match, setEapSubjectMatch_cb _hidl_cb)
357 {
358 return validateAndCall(
359 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
360 &StaNetwork::setEapSubjectMatchInternal, _hidl_cb, match);
361 }
362
setEapAltSubjectMatch(const hidl_string & match,setEapAltSubjectMatch_cb _hidl_cb)363 Return<void> StaNetwork::setEapAltSubjectMatch(
364 const hidl_string &match, setEapAltSubjectMatch_cb _hidl_cb)
365 {
366 return validateAndCall(
367 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
368 &StaNetwork::setEapAltSubjectMatchInternal, _hidl_cb, match);
369 }
370
setEapEngine(bool enable,setEapEngine_cb _hidl_cb)371 Return<void> StaNetwork::setEapEngine(bool enable, setEapEngine_cb _hidl_cb)
372 {
373 return validateAndCall(
374 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
375 &StaNetwork::setEapEngineInternal, _hidl_cb, enable);
376 }
377
setEapEngineID(const hidl_string & id,setEapEngineID_cb _hidl_cb)378 Return<void> StaNetwork::setEapEngineID(
379 const hidl_string &id, setEapEngineID_cb _hidl_cb)
380 {
381 return validateAndCall(
382 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
383 &StaNetwork::setEapEngineIDInternal, _hidl_cb, id);
384 }
385
setEapDomainSuffixMatch(const hidl_string & match,setEapDomainSuffixMatch_cb _hidl_cb)386 Return<void> StaNetwork::setEapDomainSuffixMatch(
387 const hidl_string &match, setEapDomainSuffixMatch_cb _hidl_cb)
388 {
389 return validateAndCall(
390 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
391 &StaNetwork::setEapDomainSuffixMatchInternal, _hidl_cb, match);
392 }
393
setProactiveKeyCaching(bool enable,setProactiveKeyCaching_cb _hidl_cb)394 Return<void> StaNetwork::setProactiveKeyCaching(
395 bool enable, setProactiveKeyCaching_cb _hidl_cb)
396 {
397 return validateAndCall(
398 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
399 &StaNetwork::setProactiveKeyCachingInternal, _hidl_cb, enable);
400 }
401
setIdStr(const hidl_string & id_str,setIdStr_cb _hidl_cb)402 Return<void> StaNetwork::setIdStr(
403 const hidl_string &id_str, setIdStr_cb _hidl_cb)
404 {
405 return validateAndCall(
406 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
407 &StaNetwork::setIdStrInternal, _hidl_cb, id_str);
408 }
409
setUpdateIdentifier(uint32_t id,setUpdateIdentifier_cb _hidl_cb)410 Return<void> StaNetwork::setUpdateIdentifier(
411 uint32_t id, setUpdateIdentifier_cb _hidl_cb)
412 {
413 return validateAndCall(
414 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
415 &StaNetwork::setUpdateIdentifierInternal, _hidl_cb, id);
416 }
417
setWapiCertSuite(const hidl_string & suite,setWapiCertSuite_cb _hidl_cb)418 Return<void> StaNetwork::setWapiCertSuite(
419 const hidl_string& suite, setWapiCertSuite_cb _hidl_cb) {
420 return validateAndCall(
421 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
422 &StaNetwork::setWapiCertSuiteInternal, _hidl_cb, suite);
423 }
424
setEdmg(bool enable,setEdmg_cb _hidl_cb)425 Return<void> StaNetwork::setEdmg(bool enable, setEdmg_cb _hidl_cb)
426 {
427 return validateAndCall(
428 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
429 &StaNetwork::setEdmgInternal, _hidl_cb, enable);
430 }
431
getSsid(getSsid_cb _hidl_cb)432 Return<void> StaNetwork::getSsid(getSsid_cb _hidl_cb)
433 {
434 return validateAndCall(
435 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
436 &StaNetwork::getSsidInternal, _hidl_cb);
437 }
438
getBssid(getBssid_cb _hidl_cb)439 Return<void> StaNetwork::getBssid(getBssid_cb _hidl_cb)
440 {
441 return validateAndCall(
442 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
443 &StaNetwork::getBssidInternal, _hidl_cb);
444 }
445
getScanSsid(getScanSsid_cb _hidl_cb)446 Return<void> StaNetwork::getScanSsid(getScanSsid_cb _hidl_cb)
447 {
448 return validateAndCall(
449 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
450 &StaNetwork::getScanSsidInternal, _hidl_cb);
451 }
452
getKeyMgmt(getKeyMgmt_cb _hidl_cb)453 Return<void> StaNetwork::getKeyMgmt(getKeyMgmt_cb _hidl_cb)
454 {
455 return validateAndCall(
456 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
457 &StaNetwork::getKeyMgmtInternal, _hidl_cb);
458 }
459
getProto(getProto_cb _hidl_cb)460 Return<void> StaNetwork::getProto(getProto_cb _hidl_cb)
461 {
462 return validateAndCall(
463 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
464 &StaNetwork::getProtoInternal, _hidl_cb);
465 }
466
getAuthAlg(getAuthAlg_cb _hidl_cb)467 Return<void> StaNetwork::getAuthAlg(getAuthAlg_cb _hidl_cb)
468 {
469 return validateAndCall(
470 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
471 &StaNetwork::getAuthAlgInternal, _hidl_cb);
472 }
473
getGroupCipher(getGroupCipher_cb _hidl_cb)474 Return<void> StaNetwork::getGroupCipher(getGroupCipher_cb _hidl_cb)
475 {
476 return validateAndCall(
477 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
478 &StaNetwork::getGroupCipherInternal, _hidl_cb);
479 }
480
getPairwiseCipher(getPairwiseCipher_cb _hidl_cb)481 Return<void> StaNetwork::getPairwiseCipher(getPairwiseCipher_cb _hidl_cb)
482 {
483 return validateAndCall(
484 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
485 &StaNetwork::getPairwiseCipherInternal, _hidl_cb);
486 }
487
getPskPassphrase(getPskPassphrase_cb _hidl_cb)488 Return<void> StaNetwork::getPskPassphrase(getPskPassphrase_cb _hidl_cb)
489 {
490 return validateAndCall(
491 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
492 &StaNetwork::getPskPassphraseInternal, _hidl_cb);
493 }
494
getPsk(getPsk_cb _hidl_cb)495 Return<void> StaNetwork::getPsk(getPsk_cb _hidl_cb)
496 {
497 return validateAndCall(
498 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
499 &StaNetwork::getPskInternal, _hidl_cb);
500 }
501
getSaePassword(getSaePassword_cb _hidl_cb)502 Return<void> StaNetwork::getSaePassword(getSaePassword_cb _hidl_cb)
503 {
504 return validateAndCall(
505 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
506 &StaNetwork::getSaePasswordInternal, _hidl_cb);
507 }
508
getSaePasswordId(getSaePasswordId_cb _hidl_cb)509 Return<void> StaNetwork::getSaePasswordId(getSaePasswordId_cb _hidl_cb)
510 {
511 return validateAndCall(
512 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
513 &StaNetwork::getSaePasswordIdInternal, _hidl_cb);
514 }
515
getWepKey(uint32_t key_idx,getWepKey_cb _hidl_cb)516 Return<void> StaNetwork::getWepKey(uint32_t key_idx, getWepKey_cb _hidl_cb)
517 {
518 return validateAndCall(
519 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
520 &StaNetwork::getWepKeyInternal, _hidl_cb, key_idx);
521 }
522
getWepTxKeyIdx(getWepTxKeyIdx_cb _hidl_cb)523 Return<void> StaNetwork::getWepTxKeyIdx(getWepTxKeyIdx_cb _hidl_cb)
524 {
525 return validateAndCall(
526 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
527 &StaNetwork::getWepTxKeyIdxInternal, _hidl_cb);
528 }
529
getRequirePmf(getRequirePmf_cb _hidl_cb)530 Return<void> StaNetwork::getRequirePmf(getRequirePmf_cb _hidl_cb)
531 {
532 return validateAndCall(
533 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
534 &StaNetwork::getRequirePmfInternal, _hidl_cb);
535 }
536
getEapMethod(getEapMethod_cb _hidl_cb)537 Return<void> StaNetwork::getEapMethod(getEapMethod_cb _hidl_cb)
538 {
539 return validateAndCall(
540 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
541 &StaNetwork::getEapMethodInternal, _hidl_cb);
542 }
543
getEapPhase2Method(getEapPhase2Method_cb _hidl_cb)544 Return<void> StaNetwork::getEapPhase2Method(getEapPhase2Method_cb _hidl_cb)
545 {
546 return validateAndCall(
547 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
548 &StaNetwork::getEapPhase2MethodInternal, _hidl_cb);
549 }
550
getEapIdentity(getEapIdentity_cb _hidl_cb)551 Return<void> StaNetwork::getEapIdentity(getEapIdentity_cb _hidl_cb)
552 {
553 return validateAndCall(
554 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
555 &StaNetwork::getEapIdentityInternal, _hidl_cb);
556 }
557
getEapAnonymousIdentity(getEapAnonymousIdentity_cb _hidl_cb)558 Return<void> StaNetwork::getEapAnonymousIdentity(
559 getEapAnonymousIdentity_cb _hidl_cb)
560 {
561 return validateAndCall(
562 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
563 &StaNetwork::getEapAnonymousIdentityInternal, _hidl_cb);
564 }
565
getEapPassword(getEapPassword_cb _hidl_cb)566 Return<void> StaNetwork::getEapPassword(getEapPassword_cb _hidl_cb)
567 {
568 return validateAndCall(
569 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
570 &StaNetwork::getEapPasswordInternal, _hidl_cb);
571 }
572
getEapCACert(getEapCACert_cb _hidl_cb)573 Return<void> StaNetwork::getEapCACert(getEapCACert_cb _hidl_cb)
574 {
575 return validateAndCall(
576 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
577 &StaNetwork::getEapCACertInternal, _hidl_cb);
578 }
579
getEapCAPath(getEapCAPath_cb _hidl_cb)580 Return<void> StaNetwork::getEapCAPath(getEapCAPath_cb _hidl_cb)
581 {
582 return validateAndCall(
583 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
584 &StaNetwork::getEapCAPathInternal, _hidl_cb);
585 }
586
getEapClientCert(getEapClientCert_cb _hidl_cb)587 Return<void> StaNetwork::getEapClientCert(getEapClientCert_cb _hidl_cb)
588 {
589 return validateAndCall(
590 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
591 &StaNetwork::getEapClientCertInternal, _hidl_cb);
592 }
593
getEapPrivateKeyId(getEapPrivateKeyId_cb _hidl_cb)594 Return<void> StaNetwork::getEapPrivateKeyId(getEapPrivateKeyId_cb _hidl_cb)
595 {
596 return validateAndCall(
597 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
598 &StaNetwork::getEapPrivateKeyIdInternal, _hidl_cb);
599 }
600
getEapSubjectMatch(getEapSubjectMatch_cb _hidl_cb)601 Return<void> StaNetwork::getEapSubjectMatch(getEapSubjectMatch_cb _hidl_cb)
602 {
603 return validateAndCall(
604 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
605 &StaNetwork::getEapSubjectMatchInternal, _hidl_cb);
606 }
607
getEapAltSubjectMatch(getEapAltSubjectMatch_cb _hidl_cb)608 Return<void> StaNetwork::getEapAltSubjectMatch(
609 getEapAltSubjectMatch_cb _hidl_cb)
610 {
611 return validateAndCall(
612 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
613 &StaNetwork::getEapAltSubjectMatchInternal, _hidl_cb);
614 }
615
getEapEngine(getEapEngine_cb _hidl_cb)616 Return<void> StaNetwork::getEapEngine(getEapEngine_cb _hidl_cb)
617 {
618 return validateAndCall(
619 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
620 &StaNetwork::getEapEngineInternal, _hidl_cb);
621 }
622
getEapEngineID(getEapEngineID_cb _hidl_cb)623 Return<void> StaNetwork::getEapEngineID(getEapEngineID_cb _hidl_cb)
624 {
625 return validateAndCall(
626 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
627 &StaNetwork::getEapEngineIDInternal, _hidl_cb);
628 }
629
getEapDomainSuffixMatch(getEapDomainSuffixMatch_cb _hidl_cb)630 Return<void> StaNetwork::getEapDomainSuffixMatch(
631 getEapDomainSuffixMatch_cb _hidl_cb)
632 {
633 return validateAndCall(
634 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
635 &StaNetwork::getEapDomainSuffixMatchInternal, _hidl_cb);
636 }
637
getIdStr(getIdStr_cb _hidl_cb)638 Return<void> StaNetwork::getIdStr(getIdStr_cb _hidl_cb)
639 {
640 return validateAndCall(
641 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
642 &StaNetwork::getIdStrInternal, _hidl_cb);
643 }
644
getWpsNfcConfigurationToken(getWpsNfcConfigurationToken_cb _hidl_cb)645 Return<void> StaNetwork::getWpsNfcConfigurationToken(
646 getWpsNfcConfigurationToken_cb _hidl_cb)
647 {
648 return validateAndCall(
649 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
650 &StaNetwork::getWpsNfcConfigurationTokenInternal, _hidl_cb);
651 }
652
getWapiCertSuite(getWapiCertSuite_cb _hidl_cb)653 Return<void> StaNetwork::getWapiCertSuite(getWapiCertSuite_cb _hidl_cb)
654 {
655 return validateAndCall(
656 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
657 &StaNetwork::getWapiCertSuiteInternal, _hidl_cb);
658 }
659
getEdmg(getEdmg_cb _hidl_cb)660 Return<void> StaNetwork::getEdmg(getEdmg_cb _hidl_cb)
661 {
662 return validateAndCall(
663 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
664 &StaNetwork::getEdmgInternal, _hidl_cb);
665 }
666
enable(bool no_connect,enable_cb _hidl_cb)667 Return<void> StaNetwork::enable(bool no_connect, enable_cb _hidl_cb)
668 {
669 return validateAndCall(
670 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
671 &StaNetwork::enableInternal, _hidl_cb, no_connect);
672 }
673
disable(disable_cb _hidl_cb)674 Return<void> StaNetwork::disable(disable_cb _hidl_cb)
675 {
676 return validateAndCall(
677 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
678 &StaNetwork::disableInternal, _hidl_cb);
679 }
680
select(select_cb _hidl_cb)681 Return<void> StaNetwork::select(select_cb _hidl_cb)
682 {
683 return validateAndCall(
684 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
685 &StaNetwork::selectInternal, _hidl_cb);
686 }
687
sendNetworkEapSimGsmAuthResponse(const hidl_vec<ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams> & vec_params,sendNetworkEapSimGsmAuthResponse_cb _hidl_cb)688 Return<void> StaNetwork::sendNetworkEapSimGsmAuthResponse(
689 const hidl_vec<ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams>
690 &vec_params,
691 sendNetworkEapSimGsmAuthResponse_cb _hidl_cb)
692 {
693 return validateAndCall(
694 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
695 &StaNetwork::sendNetworkEapSimGsmAuthResponseInternal, _hidl_cb,
696 vec_params);
697 }
698
sendNetworkEapSimGsmAuthFailure(sendNetworkEapSimGsmAuthFailure_cb _hidl_cb)699 Return<void> StaNetwork::sendNetworkEapSimGsmAuthFailure(
700 sendNetworkEapSimGsmAuthFailure_cb _hidl_cb)
701 {
702 return validateAndCall(
703 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
704 &StaNetwork::sendNetworkEapSimGsmAuthFailureInternal, _hidl_cb);
705 }
706
sendNetworkEapSimUmtsAuthResponse(const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams & params,sendNetworkEapSimUmtsAuthResponse_cb _hidl_cb)707 Return<void> StaNetwork::sendNetworkEapSimUmtsAuthResponse(
708 const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams ¶ms,
709 sendNetworkEapSimUmtsAuthResponse_cb _hidl_cb)
710 {
711 return validateAndCall(
712 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
713 &StaNetwork::sendNetworkEapSimUmtsAuthResponseInternal, _hidl_cb,
714 params);
715 }
716
sendNetworkEapSimUmtsAutsResponse(const hidl_array<uint8_t,14> & auts,sendNetworkEapSimUmtsAutsResponse_cb _hidl_cb)717 Return<void> StaNetwork::sendNetworkEapSimUmtsAutsResponse(
718 const hidl_array<uint8_t, 14> &auts,
719 sendNetworkEapSimUmtsAutsResponse_cb _hidl_cb)
720 {
721 return validateAndCall(
722 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
723 &StaNetwork::sendNetworkEapSimUmtsAutsResponseInternal, _hidl_cb,
724 auts);
725 }
726
sendNetworkEapSimUmtsAuthFailure(sendNetworkEapSimUmtsAuthFailure_cb _hidl_cb)727 Return<void> StaNetwork::sendNetworkEapSimUmtsAuthFailure(
728 sendNetworkEapSimUmtsAuthFailure_cb _hidl_cb)
729 {
730 return validateAndCall(
731 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
732 &StaNetwork::sendNetworkEapSimUmtsAuthFailureInternal, _hidl_cb);
733 }
734
sendNetworkEapIdentityResponse(const hidl_vec<uint8_t> & identity,sendNetworkEapIdentityResponse_cb _hidl_cb)735 Return<void> StaNetwork::sendNetworkEapIdentityResponse(
736 const hidl_vec<uint8_t> &identity,
737 sendNetworkEapIdentityResponse_cb _hidl_cb)
738 {
739 return validateAndCall(
740 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
741 &StaNetwork::sendNetworkEapIdentityResponseInternal, _hidl_cb,
742 identity);
743 }
744
sendNetworkEapIdentityResponse_1_1(const EapSimIdentity & identity,const EapSimEncryptedIdentity & encrypted_imsi_identity,sendNetworkEapIdentityResponse_1_1_cb _hidl_cb)745 Return<void> StaNetwork::sendNetworkEapIdentityResponse_1_1(
746 const EapSimIdentity &identity,
747 const EapSimEncryptedIdentity &encrypted_imsi_identity,
748 sendNetworkEapIdentityResponse_1_1_cb _hidl_cb)
749 {
750 return validateAndCall(
751 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
752 &StaNetwork::sendNetworkEapIdentityResponseInternal_1_1, _hidl_cb,
753 identity, encrypted_imsi_identity);
754 }
755
setKeyMgmt_1_2(uint32_t key_mgmt_mask,setKeyMgmt_1_2_cb _hidl_cb)756 Return<void> StaNetwork::setKeyMgmt_1_2(
757 uint32_t key_mgmt_mask, setKeyMgmt_1_2_cb _hidl_cb)
758 {
759 return validateAndCall(
760 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
761 &StaNetwork::setKeyMgmtInternal, _hidl_cb, key_mgmt_mask);
762 }
763
setGroupCipher_1_2(uint32_t group_cipher_mask,setGroupCipher_1_2_cb _hidl_cb)764 Return<void> StaNetwork::setGroupCipher_1_2(
765 uint32_t group_cipher_mask, setGroupCipher_1_2_cb _hidl_cb)
766 {
767 return validateAndCall(
768 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
769 &StaNetwork::setGroupCipherInternal, _hidl_cb, group_cipher_mask);
770 }
771
setGroupMgmtCipher(uint32_t group_mgmt_cipher_mask,setGroupMgmtCipher_cb _hidl_cb)772 Return<void> StaNetwork::setGroupMgmtCipher(
773 uint32_t group_mgmt_cipher_mask, setGroupMgmtCipher_cb _hidl_cb)
774 {
775 return validateAndCall(
776 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
777 &StaNetwork::setGroupMgmtCipherInternal,
778 _hidl_cb, group_mgmt_cipher_mask);
779 }
780
getGroupMgmtCipher(getGroupMgmtCipher_cb _hidl_cb)781 Return<void> StaNetwork::getGroupMgmtCipher(getGroupMgmtCipher_cb _hidl_cb)
782 {
783 return validateAndCall(
784 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
785 &StaNetwork::getGroupMgmtCipherInternal, _hidl_cb);
786 }
787
setPairwiseCipher_1_2(uint32_t pairwise_cipher_mask,setPairwiseCipher_1_2_cb _hidl_cb)788 Return<void> StaNetwork::setPairwiseCipher_1_2(
789 uint32_t pairwise_cipher_mask, setPairwiseCipher_1_2_cb _hidl_cb)
790 {
791 return validateAndCall(
792 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
793 &StaNetwork::setPairwiseCipherInternal, _hidl_cb,
794 pairwise_cipher_mask);
795 }
796
getKeyMgmt_1_2(getKeyMgmt_1_2_cb _hidl_cb)797 Return<void> StaNetwork::getKeyMgmt_1_2(getKeyMgmt_1_2_cb _hidl_cb)
798 {
799 return validateAndCall(
800 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
801 &StaNetwork::getKeyMgmtInternal, _hidl_cb);
802 }
803
getGroupCipher_1_2(getGroupCipher_1_2_cb _hidl_cb)804 Return<void> StaNetwork::getGroupCipher_1_2(getGroupCipher_1_2_cb _hidl_cb)
805 {
806 return validateAndCall(
807 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
808 &StaNetwork::getGroupCipherInternal, _hidl_cb);
809 }
810
getPairwiseCipher_1_2(getPairwiseCipher_1_2_cb _hidl_cb)811 Return<void> StaNetwork::getPairwiseCipher_1_2(
812 getPairwiseCipher_1_2_cb _hidl_cb)
813 {
814 return validateAndCall(
815 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
816 &StaNetwork::getPairwiseCipherInternal, _hidl_cb);
817 }
818
enableTlsSuiteBEapPhase1Param(bool enable,enableTlsSuiteBEapPhase1Param_cb _hidl_cb)819 Return<void> StaNetwork::enableTlsSuiteBEapPhase1Param(
820 bool enable, enableTlsSuiteBEapPhase1Param_cb _hidl_cb)
821 {
822 return validateAndCall(
823 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
824 &StaNetwork::enableTlsSuiteBEapPhase1ParamInternal, _hidl_cb, enable);
825 }
826
enableSuiteBEapOpenSslCiphers(enableSuiteBEapOpenSslCiphers_cb _hidl_cb)827 Return<void> StaNetwork::enableSuiteBEapOpenSslCiphers(
828 enableSuiteBEapOpenSslCiphers_cb _hidl_cb)
829 {
830 return validateAndCall(
831 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
832 &StaNetwork::enableSuiteBEapOpenSslCiphersInternal, _hidl_cb);
833 }
834
setSaePassword(const hidl_string & sae_password,setSaePassword_cb _hidl_cb)835 Return<void> StaNetwork::setSaePassword(
836 const hidl_string &sae_password, setSaePassword_cb _hidl_cb)
837 {
838 return validateAndCall(
839 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
840 &StaNetwork::setSaePasswordInternal, _hidl_cb, sae_password);
841 }
842
setSaePasswordId(const hidl_string & sae_password_id,setSaePasswordId_cb _hidl_cb)843 Return<void> StaNetwork::setSaePasswordId(
844 const hidl_string &sae_password_id, setSaePasswordId_cb _hidl_cb)
845 {
846 return validateAndCall(
847 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
848 &StaNetwork::setSaePasswordIdInternal, _hidl_cb, sae_password_id);
849 }
850
setOcsp(V1_3::OcspType ocspType,setOcsp_cb _hidl_cb)851 Return<void> StaNetwork::setOcsp(
852 V1_3::OcspType ocspType, setOcsp_cb _hidl_cb) {
853 return validateAndCall(
854 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
855 &StaNetwork::setOcspInternal, _hidl_cb, ocspType);
856 }
857
getOcsp(getOcsp_cb _hidl_cb)858 Return<void> StaNetwork::getOcsp(
859 getOcsp_cb _hidl_cb)
860 {
861 return validateAndCall(
862 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
863 &StaNetwork::getOcspInternal, _hidl_cb);
864 }
865
setPmkCache(const hidl_vec<uint8_t> & serializedEntry,setPmkCache_cb _hidl_cb)866 Return<void> StaNetwork::setPmkCache(const hidl_vec<uint8_t> &serializedEntry,
867 setPmkCache_cb _hidl_cb)
868 {
869 return validateAndCall(
870 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
871 &StaNetwork::setPmkCacheInternal, _hidl_cb, serializedEntry);
872 }
873
setKeyMgmt_1_3(uint32_t key_mgmt_mask,setKeyMgmt_1_3_cb _hidl_cb)874 Return<void> StaNetwork::setKeyMgmt_1_3(
875 uint32_t key_mgmt_mask, setKeyMgmt_1_3_cb _hidl_cb)
876 {
877 return validateAndCall(
878 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
879 &StaNetwork::setKeyMgmt_1_3Internal, _hidl_cb, key_mgmt_mask);
880 }
881
getKeyMgmt_1_3(getKeyMgmt_1_3_cb _hidl_cb)882 Return<void> StaNetwork::getKeyMgmt_1_3(getKeyMgmt_1_3_cb _hidl_cb)
883 {
884 return validateAndCall(
885 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
886 &StaNetwork::getKeyMgmt_1_3Internal, _hidl_cb);
887 }
888
setProto_1_3(uint32_t proto_mask,setProto_1_3_cb _hidl_cb)889 Return<void> StaNetwork::setProto_1_3(uint32_t proto_mask, setProto_1_3_cb _hidl_cb)
890 {
891 return validateAndCall(
892 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
893 &StaNetwork::setProto_1_3Internal, _hidl_cb, proto_mask);
894 }
895
getProto_1_3(getProto_1_3_cb _hidl_cb)896 Return<void> StaNetwork::getProto_1_3(getProto_1_3_cb _hidl_cb)
897 {
898 return validateAndCall(
899 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
900 &StaNetwork::getProto_1_3Internal, _hidl_cb);
901 }
902
setGroupCipher_1_3(uint32_t group_cipher_mask,setGroupCipher_1_3_cb _hidl_cb)903 Return<void> StaNetwork::setGroupCipher_1_3(
904 uint32_t group_cipher_mask, setGroupCipher_1_3_cb _hidl_cb)
905 {
906 return validateAndCall(
907 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
908 &StaNetwork::setGroupCipher_1_3Internal, _hidl_cb, group_cipher_mask);
909 }
910
getGroupCipher_1_3(getGroupCipher_1_3_cb _hidl_cb)911 Return<void> StaNetwork::getGroupCipher_1_3(getGroupCipher_1_3_cb _hidl_cb)
912 {
913 return validateAndCall(
914 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
915 &StaNetwork::getGroupCipher_1_3Internal, _hidl_cb);
916 }
917
setPairwiseCipher_1_3(uint32_t pairwise_cipher_mask,setPairwiseCipher_1_3_cb _hidl_cb)918 Return<void> StaNetwork::setPairwiseCipher_1_3(
919 uint32_t pairwise_cipher_mask, setPairwiseCipher_1_3_cb _hidl_cb)
920 {
921 return validateAndCall(
922 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
923 &StaNetwork::setPairwiseCipher_1_3Internal, _hidl_cb,
924 pairwise_cipher_mask);
925 }
926
getPairwiseCipher_1_3(getPairwiseCipher_1_3_cb _hidl_cb)927 Return<void> StaNetwork::getPairwiseCipher_1_3(
928 getPairwiseCipher_1_3_cb _hidl_cb)
929 {
930 return validateAndCall(
931 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
932 &StaNetwork::getPairwiseCipher_1_3Internal, _hidl_cb);
933 }
934
getAuthAlg_1_3(getAuthAlg_cb _hidl_cb)935 Return<void> StaNetwork::getAuthAlg_1_3(getAuthAlg_cb _hidl_cb)
936 {
937 return validateAndCall(
938 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
939 &StaNetwork::getAuthAlgInternal, _hidl_cb);
940 }
941
setAuthAlg_1_3(uint32_t auth_alg_mask,std::function<void (const SupplicantStatus & status)> _hidl_cb)942 Return<void> StaNetwork::setAuthAlg_1_3(
943 uint32_t auth_alg_mask,
944 std::function<void(const SupplicantStatus &status)> _hidl_cb)
945 {
946 return validateAndCall(
947 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
948 &StaNetwork::setAuthAlgInternal, _hidl_cb, auth_alg_mask);
949 }
950
setEapErp(bool enable,setEapErp_cb _hidl_cb)951 Return<void> StaNetwork::setEapErp(bool enable, setEapErp_cb _hidl_cb)
952 {
953 return validateAndCall(
954 this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
955 &StaNetwork::setEapErpInternal, _hidl_cb, enable);
956 }
957
setGroupCipher_1_4(uint32_t group_cipher_mask,setGroupCipher_1_4_cb _hidl_cb)958 Return<void> StaNetwork::setGroupCipher_1_4(
959 uint32_t group_cipher_mask, setGroupCipher_1_4_cb _hidl_cb)
960 {
961 return validateAndCall(
962 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
963 &StaNetwork::setGroupCipher_1_4Internal, _hidl_cb, group_cipher_mask);
964 }
965
getGroupCipher_1_4(getGroupCipher_1_4_cb _hidl_cb)966 Return<void> StaNetwork::getGroupCipher_1_4(getGroupCipher_1_4_cb _hidl_cb)
967 {
968 return validateAndCall(
969 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
970 &StaNetwork::getGroupCipher_1_4Internal, _hidl_cb);
971 }
972
setPairwiseCipher_1_4(uint32_t pairwise_cipher_mask,setPairwiseCipher_1_4_cb _hidl_cb)973 Return<void> StaNetwork::setPairwiseCipher_1_4(
974 uint32_t pairwise_cipher_mask, setPairwiseCipher_1_4_cb _hidl_cb)
975 {
976 return validateAndCall(
977 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
978 &StaNetwork::setPairwiseCipher_1_4Internal, _hidl_cb,
979 pairwise_cipher_mask);
980 }
981
getPairwiseCipher_1_4(getPairwiseCipher_1_4_cb _hidl_cb)982 Return<void> StaNetwork::getPairwiseCipher_1_4(
983 getPairwiseCipher_1_4_cb _hidl_cb)
984 {
985 return validateAndCall(
986 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
987 &StaNetwork::getPairwiseCipher_1_4Internal, _hidl_cb);
988 }
989
setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode mode,setSaeH2eMode_cb _hidl_cb)990 Return<void> StaNetwork::setSaeH2eMode(
991 ISupplicantStaNetworkV1_4::SaeH2eMode mode, setSaeH2eMode_cb _hidl_cb)
992 {
993 return validateAndCall(
994 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
995 &StaNetwork::setSaeH2eModeInternal, _hidl_cb, mode);
996 }
997
enableSaePkOnlyMode(bool enable,enableSaePkOnlyMode_cb _hidl_cb)998 Return<void> StaNetwork::enableSaePkOnlyMode(bool enable, enableSaePkOnlyMode_cb _hidl_cb)
999 {
1000 return validateAndCall(
1001 this, V1_4::SupplicantStatusCode::FAILURE_NETWORK_INVALID,
1002 &StaNetwork::enableSaePkOnlyModeInternal, _hidl_cb, enable);
1003 }
1004
getIdInternal()1005 std::pair<SupplicantStatus, uint32_t> StaNetwork::getIdInternal()
1006 {
1007 return {{SupplicantStatusCode::SUCCESS, ""}, network_id_};
1008 }
1009
getInterfaceNameInternal()1010 std::pair<SupplicantStatus, std::string> StaNetwork::getInterfaceNameInternal()
1011 {
1012 return {{SupplicantStatusCode::SUCCESS, ""}, ifname_};
1013 }
1014
getTypeInternal()1015 std::pair<SupplicantStatus, IfaceType> StaNetwork::getTypeInternal()
1016 {
1017 return {{SupplicantStatusCode::SUCCESS, ""}, IfaceType::STA};
1018 }
1019
registerCallbackInternal(const sp<ISupplicantStaNetworkCallback> & callback)1020 SupplicantStatus StaNetwork::registerCallbackInternal(
1021 const sp<ISupplicantStaNetworkCallback> &callback)
1022 {
1023 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
1024 }
1025
registerCallback_1_4Internal(const sp<V1_4::ISupplicantStaNetworkCallback> & callback)1026 V1_4::SupplicantStatus StaNetwork::registerCallback_1_4Internal(
1027 const sp<V1_4::ISupplicantStaNetworkCallback> &callback)
1028 {
1029 HidlManager *hidl_manager = HidlManager::getInstance();
1030 if (!hidl_manager || hidl_manager->addStaNetworkCallbackHidlObject(
1031 ifname_, network_id_, callback)) {
1032 return {V1_4::SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1033 }
1034 return {V1_4::SupplicantStatusCode::SUCCESS, ""};
1035 }
1036
setSsidInternal(const std::vector<uint8_t> & ssid)1037 SupplicantStatus StaNetwork::setSsidInternal(const std::vector<uint8_t> &ssid)
1038 {
1039 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1040 if (ssid.size() == 0 ||
1041 ssid.size() >
1042 static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
1043 SSID_MAX_LEN_IN_BYTES)) {
1044 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1045 }
1046 if (setByteArrayFieldAndResetState(
1047 ssid.data(), ssid.size(), &(wpa_ssid->ssid),
1048 &(wpa_ssid->ssid_len), "ssid")) {
1049 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1050 }
1051 if (wpa_ssid->passphrase) {
1052 wpa_config_update_psk(wpa_ssid);
1053 }
1054 return {SupplicantStatusCode::SUCCESS, ""};
1055 }
1056
setBssidInternal(const std::array<uint8_t,6> & bssid)1057 SupplicantStatus StaNetwork::setBssidInternal(
1058 const std::array<uint8_t, 6> &bssid)
1059 {
1060 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1061 int prev_bssid_set = wpa_ssid->bssid_set;
1062 u8 prev_bssid[ETH_ALEN];
1063 os_memcpy(prev_bssid, wpa_ssid->bssid, ETH_ALEN);
1064 // Zero'ed array is used to clear out the BSSID value.
1065 if (os_memcmp(bssid.data(), kZeroBssid, ETH_ALEN) == 0) {
1066 wpa_ssid->bssid_set = 0;
1067 wpa_printf(MSG_MSGDUMP, "BSSID any");
1068 } else {
1069 os_memcpy(wpa_ssid->bssid, bssid.data(), ETH_ALEN);
1070 wpa_ssid->bssid_set = 1;
1071 wpa_hexdump(MSG_MSGDUMP, "BSSID", wpa_ssid->bssid, ETH_ALEN);
1072 }
1073 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
1074 if ((wpa_ssid->bssid_set != prev_bssid_set ||
1075 os_memcmp(wpa_ssid->bssid, prev_bssid, ETH_ALEN) != 0)) {
1076 wpas_notify_network_bssid_set_changed(wpa_s, wpa_ssid);
1077 }
1078 return {SupplicantStatusCode::SUCCESS, ""};
1079 }
1080
setScanSsidInternal(bool enable)1081 SupplicantStatus StaNetwork::setScanSsidInternal(bool enable)
1082 {
1083 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1084 wpa_ssid->scan_ssid = enable ? 1 : 0;
1085 resetInternalStateAfterParamsUpdate();
1086 return {SupplicantStatusCode::SUCCESS, ""};
1087 }
1088
setKeyMgmtInternal(uint32_t key_mgmt_mask)1089 SupplicantStatus StaNetwork::setKeyMgmtInternal(uint32_t key_mgmt_mask)
1090 {
1091 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
1092 }
1093
setProtoInternal(uint32_t proto_mask)1094 SupplicantStatus StaNetwork::setProtoInternal(uint32_t proto_mask)
1095 {
1096 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
1097 }
1098
setAuthAlgInternal(uint32_t auth_alg_mask)1099 SupplicantStatus StaNetwork::setAuthAlgInternal(uint32_t auth_alg_mask)
1100 {
1101 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1102 if (auth_alg_mask & ~kAllowedAuthAlgMask) {
1103 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1104 }
1105 wpa_ssid->auth_alg = auth_alg_mask;
1106 wpa_printf(MSG_MSGDUMP, "auth_alg: 0x%x", wpa_ssid->auth_alg);
1107 resetInternalStateAfterParamsUpdate();
1108 return {SupplicantStatusCode::SUCCESS, ""};
1109 }
1110
setEdmgInternal(bool enable)1111 V1_4::SupplicantStatus StaNetwork::setEdmgInternal(bool enable)
1112 {
1113 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1114 wpa_ssid->enable_edmg = enable ? 1 : 0;
1115 resetInternalStateAfterParamsUpdate();
1116 return {V1_4::SupplicantStatusCode::SUCCESS, ""};
1117 }
1118
setGroupCipherInternal(uint32_t group_cipher_mask)1119 SupplicantStatus StaNetwork::setGroupCipherInternal(uint32_t group_cipher_mask)
1120 {
1121 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
1122 }
1123
setPairwiseCipherInternal(uint32_t pairwise_cipher_mask)1124 SupplicantStatus StaNetwork::setPairwiseCipherInternal(
1125 uint32_t pairwise_cipher_mask)
1126 {
1127 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
1128 }
1129
setPskPassphraseInternal(const std::string & rawPsk)1130 SupplicantStatus StaNetwork::setPskPassphraseInternal(const std::string &rawPsk)
1131 {
1132 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1133 std::string psk = rawPsk;
1134 #ifdef CONFIG_WAPI_INTERFACE
1135 if (wpa_ssid->key_mgmt & WPA_KEY_MGMT_WAPI_PSK) {
1136 if (rawPsk.size() > 2 && rawPsk.front()== '"' && rawPsk.back() == '"') {
1137 psk = rawPsk.substr(1, rawPsk.size() - 2);
1138 } else {
1139 if ((rawPsk.size() & 1)) {
1140 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1141 }
1142 size_t len = psk.size() / 2;
1143 uint8_t *buf = (uint8_t *) os_malloc(len);
1144 if (hexstr2bin(psk.c_str(), buf, len) < 0) {
1145 os_free(buf);
1146 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1147 }
1148 std::vector<uint8_t> bytes(buf, buf + len);
1149 os_free(buf);
1150 return setWapiPskInternal(bytes);
1151 }
1152 }
1153 #endif
1154 if (isPskPassphraseValid(psk)) {
1155 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1156 }
1157 if (wpa_ssid->passphrase &&
1158 os_strlen(wpa_ssid->passphrase) == psk.size() &&
1159 os_memcmp(wpa_ssid->passphrase, psk.c_str(), psk.size()) == 0) {
1160 return {SupplicantStatusCode::SUCCESS, ""};
1161 }
1162 // Flag to indicate if raw psk is calculated or not using
1163 // |wpa_config_update_psk|. Deferred if ssid not already set.
1164 wpa_ssid->psk_set = 0;
1165 if (setStringKeyFieldAndResetState(
1166 psk.c_str(), &(wpa_ssid->passphrase), "psk passphrase")) {
1167 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1168 }
1169 if (wpa_ssid->ssid_len) {
1170 wpa_config_update_psk(wpa_ssid);
1171 }
1172 return {SupplicantStatusCode::SUCCESS, ""};
1173 }
1174
setPskInternal(const std::array<uint8_t,32> & psk)1175 SupplicantStatus StaNetwork::setPskInternal(const std::array<uint8_t, 32> &psk)
1176 {
1177 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1178 WPA_ASSERT(psk.size() == sizeof(wpa_ssid->psk));
1179 str_clear_free(wpa_ssid->passphrase);
1180 wpa_ssid->passphrase = nullptr;
1181 os_memcpy(wpa_ssid->psk, psk.data(), sizeof(wpa_ssid->psk));
1182 wpa_ssid->psk_set = 1;
1183 resetInternalStateAfterParamsUpdate();
1184 return {SupplicantStatusCode::SUCCESS, ""};
1185 }
1186
setWepKeyInternal(uint32_t key_idx,const std::vector<uint8_t> & wep_key)1187 SupplicantStatus StaNetwork::setWepKeyInternal(
1188 uint32_t key_idx, const std::vector<uint8_t> &wep_key)
1189 {
1190 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1191 if (key_idx >=
1192 static_cast<uint32_t>(
1193 ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
1194 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1195 }
1196 if (wep_key.size() !=
1197 static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
1198 WEP40_KEY_LEN_IN_BYTES) &&
1199 wep_key.size() !=
1200 static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
1201 WEP104_KEY_LEN_IN_BYTES)) {
1202 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1203 }
1204 os_memcpy(wpa_ssid->wep_key[key_idx], wep_key.data(), wep_key.size());
1205 wpa_ssid->wep_key_len[key_idx] = wep_key.size();
1206 std::string msg_dump_title("wep_key" + std::to_string(key_idx));
1207 wpa_hexdump_key(
1208 MSG_MSGDUMP, msg_dump_title.c_str(), wpa_ssid->wep_key[key_idx],
1209 wpa_ssid->wep_key_len[key_idx]);
1210 resetInternalStateAfterParamsUpdate();
1211 return {SupplicantStatusCode::SUCCESS, ""};
1212 }
1213
setWepTxKeyIdxInternal(uint32_t key_idx)1214 SupplicantStatus StaNetwork::setWepTxKeyIdxInternal(uint32_t key_idx)
1215 {
1216 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1217 if (key_idx >=
1218 static_cast<uint32_t>(
1219 ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
1220 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1221 }
1222 wpa_ssid->wep_tx_keyidx = key_idx;
1223 resetInternalStateAfterParamsUpdate();
1224 return {SupplicantStatusCode::SUCCESS, ""};
1225 }
1226
setRequirePmfInternal(bool enable)1227 SupplicantStatus StaNetwork::setRequirePmfInternal(bool enable)
1228 {
1229 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1230 if (enable) {
1231 wpa_ssid->ieee80211w = MGMT_FRAME_PROTECTION_REQUIRED;
1232 }
1233 resetInternalStateAfterParamsUpdate();
1234 return {SupplicantStatusCode::SUCCESS, ""};
1235 }
1236
setEapMethodInternal(ISupplicantStaNetwork::EapMethod method)1237 SupplicantStatus StaNetwork::setEapMethodInternal(
1238 ISupplicantStaNetwork::EapMethod method)
1239 {
1240 uint32_t eap_method_idx = static_cast<
1241 std::underlying_type<ISupplicantStaNetwork::EapMethod>::type>(
1242 method);
1243 if (eap_method_idx >= kEapMethodMax) {
1244 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1245 }
1246
1247 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1248 int retrieved_vendor, retrieved_method;
1249 const char *method_str = kEapMethodStrings[eap_method_idx];
1250 // This string lookup is needed to check if the device supports the
1251 // corresponding EAP type.
1252 retrieved_method = eap_peer_get_type(method_str, &retrieved_vendor);
1253 if (retrieved_vendor == EAP_VENDOR_IETF &&
1254 retrieved_method == EAP_TYPE_NONE) {
1255 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1256 }
1257 if (wpa_ssid->eap.eap_methods) {
1258 os_free(wpa_ssid->eap.eap_methods);
1259 }
1260 // wpa_supplicant can support setting multiple eap methods for each
1261 // network. But, this is not really used by Android. So, just adding
1262 // support for setting one EAP method for each network. The additional
1263 // |eap_method_type| member in the array is used to indicate the end
1264 // of list.
1265 wpa_ssid->eap.eap_methods =
1266 (eap_method_type *)os_malloc(sizeof(eap_method_type) * 2);
1267 if (!wpa_ssid->eap.eap_methods) {
1268 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1269 }
1270 wpa_ssid->eap.eap_methods[0].vendor = retrieved_vendor;
1271 wpa_ssid->eap.eap_methods[0].method = retrieved_method;
1272 wpa_ssid->eap.eap_methods[1].vendor = EAP_VENDOR_IETF;
1273 wpa_ssid->eap.eap_methods[1].method = EAP_TYPE_NONE;
1274
1275 wpa_ssid->leap = 0;
1276 wpa_ssid->non_leap = 0;
1277 if (retrieved_vendor == EAP_VENDOR_IETF &&
1278 retrieved_method == EAP_TYPE_LEAP) {
1279 wpa_ssid->leap++;
1280 } else {
1281 wpa_ssid->non_leap++;
1282 }
1283 wpa_hexdump(
1284 MSG_MSGDUMP, "eap methods", (u8 *)wpa_ssid->eap.eap_methods,
1285 sizeof(eap_method_type) * 2);
1286 resetInternalStateAfterParamsUpdate();
1287 return {SupplicantStatusCode::SUCCESS, ""};
1288 }
1289
setEapPhase2MethodInternal(ISupplicantStaNetwork::EapPhase2Method method)1290 SupplicantStatus StaNetwork::setEapPhase2MethodInternal(
1291 ISupplicantStaNetwork::EapPhase2Method method)
1292 {
1293 uint32_t eap_phase2_method_idx = static_cast<
1294 std::underlying_type<ISupplicantStaNetwork::EapPhase2Method>::type>(
1295 method);
1296 if (eap_phase2_method_idx >= kEapPhase2MethodMax) {
1297 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
1298 }
1299
1300 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1301 // EAP method needs to be set for us to construct the eap
1302 // phase 2 method string.
1303 SupplicantStatus status;
1304 ISupplicantStaNetwork::EapMethod eap_method;
1305 std::tie(status, eap_method) = getEapMethodInternal();
1306 if (status.code != SupplicantStatusCode::SUCCESS) {
1307 return {SupplicantStatusCode::FAILURE_UNKNOWN,
1308 "EAP method not set"};
1309 }
1310 std::string eap_phase2_str;
1311 if (method == ISupplicantStaNetwork::EapPhase2Method::NONE) {
1312 eap_phase2_str = "";
1313 } else if (
1314 eap_method == ISupplicantStaNetwork::EapMethod::TTLS &&
1315 method == ISupplicantStaNetwork::EapPhase2Method::GTC) {
1316 eap_phase2_str = kEapPhase2AuthEapPrefix;
1317 } else {
1318 eap_phase2_str = kEapPhase2AuthPrefix;
1319 }
1320 eap_phase2_str += kEapPhase2MethodStrings[eap_phase2_method_idx];
1321 if (setStringFieldAndResetState(
1322 eap_phase2_str.c_str(), &(wpa_ssid->eap.phase2),
1323 "eap phase2")) {
1324 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1325 }
1326 return {SupplicantStatusCode::SUCCESS, ""};
1327 }
1328
setEapIdentityInternal(const std::vector<uint8_t> & identity)1329 SupplicantStatus StaNetwork::setEapIdentityInternal(
1330 const std::vector<uint8_t> &identity)
1331 {
1332 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1333 if (setByteArrayFieldAndResetState(
1334 identity.data(), identity.size(), &(wpa_ssid->eap.identity),
1335 &(wpa_ssid->eap.identity_len), "eap identity")) {
1336 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1337 }
1338 // plain IMSI identity
1339 if (setByteArrayFieldAndResetState(
1340 identity.data(), identity.size(),
1341 &(wpa_ssid->eap.imsi_identity),
1342 &(wpa_ssid->eap.imsi_identity_len), "eap imsi identity")) {
1343 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1344 }
1345 return {SupplicantStatusCode::SUCCESS, ""};
1346 }
1347
setEapEncryptedImsiIdentityInternal(const std::vector<uint8_t> & identity)1348 SupplicantStatus StaNetwork::setEapEncryptedImsiIdentityInternal(
1349 const std::vector<uint8_t> &identity)
1350 {
1351 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1352 // encrypted IMSI identity
1353 if (setByteArrayFieldAndResetState(
1354 identity.data(), identity.size(), &(wpa_ssid->eap.identity),
1355 &(wpa_ssid->eap.identity_len), "eap encrypted imsi identity")) {
1356 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1357 }
1358 return {SupplicantStatusCode::SUCCESS, ""};
1359 }
1360
setEapAnonymousIdentityInternal(const std::vector<uint8_t> & identity)1361 SupplicantStatus StaNetwork::setEapAnonymousIdentityInternal(
1362 const std::vector<uint8_t> &identity)
1363 {
1364 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1365 if (setByteArrayFieldAndResetState(
1366 identity.data(), identity.size(),
1367 &(wpa_ssid->eap.anonymous_identity),
1368 &(wpa_ssid->eap.anonymous_identity_len),
1369 "eap anonymous_identity")) {
1370 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1371 }
1372 return {SupplicantStatusCode::SUCCESS, ""};
1373 }
1374
setEapPasswordInternal(const std::vector<uint8_t> & password)1375 SupplicantStatus StaNetwork::setEapPasswordInternal(
1376 const std::vector<uint8_t> &password)
1377 {
1378 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1379 if (setByteArrayKeyFieldAndResetState(
1380 password.data(), password.size(), &(wpa_ssid->eap.password),
1381 &(wpa_ssid->eap.password_len), "eap password")) {
1382 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1383 }
1384 wpa_ssid->eap.flags &= ~EAP_CONFIG_FLAGS_PASSWORD_NTHASH;
1385 wpa_ssid->eap.flags &= ~EAP_CONFIG_FLAGS_EXT_PASSWORD;
1386 return {SupplicantStatusCode::SUCCESS, ""};
1387 }
1388
setEapCACertInternal(const std::string & path)1389 SupplicantStatus StaNetwork::setEapCACertInternal(const std::string &path)
1390 {
1391 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1392 if (setStringFieldAndResetState(
1393 path.c_str(), &(wpa_ssid->eap.cert.ca_cert), "eap ca_cert")) {
1394 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1395 }
1396 return {SupplicantStatusCode::SUCCESS, ""};
1397 }
1398
setEapCAPathInternal(const std::string & path)1399 SupplicantStatus StaNetwork::setEapCAPathInternal(const std::string &path)
1400 {
1401 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1402 if (setStringFieldAndResetState(
1403 path.c_str(), &(wpa_ssid->eap.cert.ca_path), "eap ca_path")) {
1404 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1405 }
1406 return {SupplicantStatusCode::SUCCESS, ""};
1407 }
1408
setEapClientCertInternal(const std::string & path)1409 SupplicantStatus StaNetwork::setEapClientCertInternal(const std::string &path)
1410 {
1411 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1412 if (setStringFieldAndResetState(
1413 path.c_str(), &(wpa_ssid->eap.cert.client_cert),
1414 "eap client_cert")) {
1415 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1416 }
1417 return {SupplicantStatusCode::SUCCESS, ""};
1418 }
1419
setEapPrivateKeyIdInternal(const std::string & id)1420 SupplicantStatus StaNetwork::setEapPrivateKeyIdInternal(const std::string &id)
1421 {
1422 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1423 if (setStringFieldAndResetState(
1424 id.c_str(), &(wpa_ssid->eap.cert.key_id), "eap key_id")) {
1425 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1426 }
1427 return {SupplicantStatusCode::SUCCESS, ""};
1428 }
1429
setEapSubjectMatchInternal(const std::string & match)1430 SupplicantStatus StaNetwork::setEapSubjectMatchInternal(
1431 const std::string &match)
1432 {
1433 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1434 if (setStringFieldAndResetState(
1435 match.c_str(), &(wpa_ssid->eap.cert.subject_match),
1436 "eap subject_match")) {
1437 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1438 }
1439 return {SupplicantStatusCode::SUCCESS, ""};
1440 }
1441
setEapAltSubjectMatchInternal(const std::string & match)1442 SupplicantStatus StaNetwork::setEapAltSubjectMatchInternal(
1443 const std::string &match)
1444 {
1445 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1446 if (setStringFieldAndResetState(
1447 match.c_str(), &(wpa_ssid->eap.cert.altsubject_match),
1448 "eap altsubject_match")) {
1449 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1450 }
1451 return {SupplicantStatusCode::SUCCESS, ""};
1452 }
1453
setEapEngineInternal(bool enable)1454 SupplicantStatus StaNetwork::setEapEngineInternal(bool enable)
1455 {
1456 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1457 wpa_ssid->eap.cert.engine = enable ? 1 : 0;
1458 return {SupplicantStatusCode::SUCCESS, ""};
1459 }
1460
setEapEngineIDInternal(const std::string & id)1461 SupplicantStatus StaNetwork::setEapEngineIDInternal(const std::string &id)
1462 {
1463 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1464 if (setStringFieldAndResetState(
1465 id.c_str(), &(wpa_ssid->eap.cert.engine_id), "eap engine_id")) {
1466 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1467 }
1468 return {SupplicantStatusCode::SUCCESS, ""};
1469 }
1470
setEapDomainSuffixMatchInternal(const std::string & match)1471 SupplicantStatus StaNetwork::setEapDomainSuffixMatchInternal(
1472 const std::string &match)
1473 {
1474 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1475 if (setStringFieldAndResetState(
1476 match.c_str(), &(wpa_ssid->eap.cert.domain_suffix_match),
1477 "eap domain_suffix_match")) {
1478 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1479 }
1480 return {SupplicantStatusCode::SUCCESS, ""};
1481 }
1482
setProactiveKeyCachingInternal(bool enable)1483 SupplicantStatus StaNetwork::setProactiveKeyCachingInternal(bool enable)
1484 {
1485 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1486 wpa_ssid->proactive_key_caching = enable ? 1 : 0;
1487 resetInternalStateAfterParamsUpdate();
1488 return {SupplicantStatusCode::SUCCESS, ""};
1489 }
1490
setIdStrInternal(const std::string & id_str)1491 SupplicantStatus StaNetwork::setIdStrInternal(const std::string &id_str)
1492 {
1493 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1494 if (setStringFieldAndResetState(
1495 id_str.c_str(), &(wpa_ssid->id_str), "id_str")) {
1496 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1497 }
1498 return {SupplicantStatusCode::SUCCESS, ""};
1499 }
1500
setUpdateIdentifierInternal(uint32_t id)1501 SupplicantStatus StaNetwork::setUpdateIdentifierInternal(uint32_t id)
1502 {
1503 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1504 wpa_ssid->update_identifier = id;
1505 wpa_printf(
1506 MSG_MSGDUMP, "update_identifier: %d", wpa_ssid->update_identifier);
1507 resetInternalStateAfterParamsUpdate();
1508 return {SupplicantStatusCode::SUCCESS, ""};
1509 }
1510
setWapiCertSuiteInternal(const std::string & suite)1511 SupplicantStatus StaNetwork::setWapiCertSuiteInternal(const std::string &suite)
1512 {
1513 #ifdef CONFIG_WAPI_INTERFACE
1514 dummyWapiCertSuite = suite;
1515 return {SupplicantStatusCode::SUCCESS, "Dummy implementation"};
1516 #else
1517 return {SupplicantStatusCode::FAILURE_UNKNOWN, "Not implemented"};
1518 #endif
1519 }
1520
setWapiPskInternal(const std::vector<uint8_t> & psk)1521 SupplicantStatus StaNetwork::setWapiPskInternal(const std::vector<uint8_t> &psk)
1522 {
1523 #ifdef CONFIG_WAPI_INTERFACE
1524 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1525 str_clear_free(wpa_ssid->passphrase);
1526 wpa_ssid->passphrase = nullptr;
1527
1528 dummyWapiPsk = psk;
1529
1530 wpa_ssid->psk_set = 1;
1531 resetInternalStateAfterParamsUpdate();
1532 return {SupplicantStatusCode::SUCCESS, "Dummy implementation"};
1533 #else
1534 return {SupplicantStatusCode::FAILURE_UNKNOWN, "Not implemented"};
1535 #endif
1536 }
1537
getSsidInternal()1538 std::pair<SupplicantStatus, std::vector<uint8_t>> StaNetwork::getSsidInternal()
1539 {
1540 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1541 std::vector<uint8_t> ssid;
1542 ssid.assign(wpa_ssid->ssid, wpa_ssid->ssid + wpa_ssid->ssid_len);
1543 return {{SupplicantStatusCode::SUCCESS, ""}, std::move(ssid)};
1544 }
1545
1546 std::pair<SupplicantStatus, std::array<uint8_t, 6>>
getBssidInternal()1547 StaNetwork::getBssidInternal()
1548 {
1549 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1550 std::array<uint8_t, 6> bssid{};
1551 os_memcpy(bssid.data(), kZeroBssid, ETH_ALEN);
1552 if (wpa_ssid->bssid_set) {
1553 os_memcpy(bssid.data(), wpa_ssid->bssid, ETH_ALEN);
1554 }
1555 return {{SupplicantStatusCode::SUCCESS, ""}, std::move(bssid)};
1556 }
1557
getScanSsidInternal()1558 std::pair<SupplicantStatus, bool> StaNetwork::getScanSsidInternal()
1559 {
1560 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1561 return {{SupplicantStatusCode::SUCCESS, ""},
1562 (wpa_ssid->scan_ssid == 1)};
1563 }
1564
getKeyMgmtInternal()1565 std::pair<SupplicantStatus, uint32_t> StaNetwork::getKeyMgmtInternal()
1566 {
1567 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"}, 0};
1568 }
1569
getProtoInternal()1570 std::pair<SupplicantStatus, uint32_t> StaNetwork::getProtoInternal()
1571 {
1572 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"}, 0};
1573 }
1574
getAuthAlgInternal()1575 std::pair<SupplicantStatus, uint32_t> StaNetwork::getAuthAlgInternal()
1576 {
1577 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1578 return {{SupplicantStatusCode::SUCCESS, ""},
1579 wpa_ssid->auth_alg & kAllowedAuthAlgMask};
1580 }
1581
getGroupCipherInternal()1582 std::pair<SupplicantStatus, uint32_t> StaNetwork::getGroupCipherInternal()
1583 {
1584 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"}, 0};
1585 }
1586
getPairwiseCipherInternal()1587 std::pair<SupplicantStatus, uint32_t> StaNetwork::getPairwiseCipherInternal()
1588 {
1589 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"}, 0};
1590 }
1591
getPskPassphraseInternal()1592 std::pair<SupplicantStatus, std::string> StaNetwork::getPskPassphraseInternal()
1593 {
1594 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1595 #ifdef CONFIG_WAPI_INTERFACE
1596 if (wpa_ssid->key_mgmt & WPA_KEY_MGMT_WAPI_PSK) {
1597 if (wpa_ssid->psk_set) {
1598 std::pair<SupplicantStatus, std::vector<uint8_t>> ret = getWapiPskInternal();
1599 std::string psk;
1600 char buf[3] = {0};
1601 for (int i = 0; i < ret.second.size(); i++) {
1602 snprintf(buf, sizeof(buf), "%02x", ret.second[i]);
1603 psk.append(buf);
1604 }
1605 return {{SupplicantStatusCode::SUCCESS, ""}, psk};
1606 } else {
1607 if (!wpa_ssid->passphrase) {
1608 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1609 }
1610 std::string passphrase;
1611 passphrase.append("\"");
1612 passphrase.append(wpa_ssid->passphrase);
1613 passphrase.append("\"");
1614 return {{SupplicantStatusCode::SUCCESS, ""}, passphrase};
1615 }
1616 }
1617 #endif
1618 if (!wpa_ssid->passphrase) {
1619 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1620 }
1621 return {{SupplicantStatusCode::SUCCESS, ""}, wpa_ssid->passphrase};
1622 }
1623
1624 std::pair<SupplicantStatus, std::array<uint8_t, 32>>
getPskInternal()1625 StaNetwork::getPskInternal()
1626 {
1627 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1628 WPA_ASSERT(psk.size() == sizeof(wpa_ssid->psk));
1629 if (!wpa_ssid->psk_set) {
1630 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1631 }
1632 std::array<uint8_t, 32> psk;
1633 os_memcpy(psk.data(), wpa_ssid->psk, psk.size());
1634 return {{SupplicantStatusCode::SUCCESS, ""}, psk};
1635 }
1636
getSaePasswordInternal()1637 std::pair<SupplicantStatus, std::string> StaNetwork::getSaePasswordInternal()
1638 {
1639 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1640 if (!wpa_ssid->sae_password) {
1641 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1642 }
1643 return {{SupplicantStatusCode::SUCCESS, ""}, wpa_ssid->sae_password};
1644 }
1645
getSaePasswordIdInternal()1646 std::pair<SupplicantStatus, std::string> StaNetwork::getSaePasswordIdInternal()
1647 {
1648 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1649 if (!wpa_ssid->sae_password_id) {
1650 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1651 }
1652 return {{SupplicantStatusCode::SUCCESS, ""}, wpa_ssid->sae_password_id};
1653 }
1654
getWepKeyInternal(uint32_t key_idx)1655 std::pair<SupplicantStatus, std::vector<uint8_t>> StaNetwork::getWepKeyInternal(
1656 uint32_t key_idx)
1657 {
1658 std::vector<uint8_t> wep_key;
1659 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1660 if (key_idx >=
1661 static_cast<uint32_t>(
1662 ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
1663 return {{SupplicantStatusCode::FAILURE_ARGS_INVALID, ""},
1664 wep_key};
1665 }
1666 wep_key.assign(
1667 wpa_ssid->wep_key[key_idx],
1668 wpa_ssid->wep_key[key_idx] + wpa_ssid->wep_key_len[key_idx]);
1669 return {{SupplicantStatusCode::SUCCESS, ""}, std::move(wep_key)};
1670 }
1671
getWepTxKeyIdxInternal()1672 std::pair<SupplicantStatus, uint32_t> StaNetwork::getWepTxKeyIdxInternal()
1673 {
1674 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1675 return {{SupplicantStatusCode::SUCCESS, ""}, wpa_ssid->wep_tx_keyidx};
1676 }
1677
getRequirePmfInternal()1678 std::pair<SupplicantStatus, bool> StaNetwork::getRequirePmfInternal()
1679 {
1680 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1681 return {{SupplicantStatusCode::SUCCESS, ""},
1682 (wpa_ssid->ieee80211w == MGMT_FRAME_PROTECTION_REQUIRED)};
1683 }
1684
1685 std::pair<SupplicantStatus, ISupplicantStaNetwork::EapMethod>
getEapMethodInternal()1686 StaNetwork::getEapMethodInternal()
1687 {
1688 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1689 if (!wpa_ssid->eap.eap_methods) {
1690 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1691 }
1692 // wpa_supplicant can support setting multiple eap methods for each
1693 // network. But, this is not really used by Android. So, just reading
1694 // the first EAP method for each network.
1695 const std::string eap_method_str = eap_get_name(
1696 wpa_ssid->eap.eap_methods[0].vendor,
1697 static_cast<enum eap_type>(wpa_ssid->eap.eap_methods[0].method));
1698 size_t eap_method_idx =
1699 std::find(
1700 std::begin(kEapMethodStrings), std::end(kEapMethodStrings),
1701 eap_method_str) -
1702 std::begin(kEapMethodStrings);
1703 if (eap_method_idx >= kEapMethodMax) {
1704 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1705 }
1706 return {{SupplicantStatusCode::SUCCESS, ""},
1707 static_cast<ISupplicantStaNetwork::EapMethod>(eap_method_idx)};
1708 }
1709
1710 std::pair<SupplicantStatus, ISupplicantStaNetwork::EapPhase2Method>
getEapPhase2MethodInternal()1711 StaNetwork::getEapPhase2MethodInternal()
1712 {
1713 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1714 if (!wpa_ssid->eap.phase2) {
1715 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1716 }
1717 const std::string eap_phase2_method_str_with_prefix =
1718 wpa_ssid->eap.phase2;
1719 std::string eap_phase2_method_str;
1720 // Strip out the phase 2 method prefix before doing a reverse lookup
1721 // of phase 2 string to the Eap Phase 2 type.
1722 if (eap_phase2_method_str_with_prefix.find(kEapPhase2AuthPrefix) == 0) {
1723 eap_phase2_method_str =
1724 eap_phase2_method_str_with_prefix.substr(
1725 strlen(kEapPhase2AuthPrefix),
1726 eap_phase2_method_str_with_prefix.size());
1727 } else if (
1728 eap_phase2_method_str_with_prefix.find(kEapPhase2AuthEapPrefix) ==
1729 0) {
1730 eap_phase2_method_str =
1731 eap_phase2_method_str_with_prefix.substr(
1732 strlen(kEapPhase2AuthEapPrefix),
1733 eap_phase2_method_str_with_prefix.size());
1734 }
1735 size_t eap_phase2_method_idx =
1736 std::find(
1737 std::begin(kEapPhase2MethodStrings),
1738 std::end(kEapPhase2MethodStrings), eap_phase2_method_str) -
1739 std::begin(kEapPhase2MethodStrings);
1740 if (eap_phase2_method_idx >= kEapPhase2MethodMax) {
1741 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1742 }
1743 return {{SupplicantStatusCode::SUCCESS, ""},
1744 static_cast<ISupplicantStaNetwork::EapPhase2Method>(
1745 eap_phase2_method_idx)};
1746 }
1747
1748 std::pair<SupplicantStatus, std::vector<uint8_t>>
getEapIdentityInternal()1749 StaNetwork::getEapIdentityInternal()
1750 {
1751 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1752 if (!wpa_ssid->eap.identity) {
1753 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1754 }
1755 return {{SupplicantStatusCode::SUCCESS, ""},
1756 std::vector<uint8_t>(
1757 wpa_ssid->eap.identity,
1758 wpa_ssid->eap.identity + wpa_ssid->eap.identity_len)};
1759 }
1760
1761 std::pair<SupplicantStatus, std::vector<uint8_t>>
getEapAnonymousIdentityInternal()1762 StaNetwork::getEapAnonymousIdentityInternal()
1763 {
1764 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1765 if (!wpa_ssid->eap.anonymous_identity) {
1766 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1767 }
1768 return {{SupplicantStatusCode::SUCCESS, ""},
1769 std::vector<uint8_t>(
1770 wpa_ssid->eap.anonymous_identity,
1771 wpa_ssid->eap.anonymous_identity +
1772 wpa_ssid->eap.anonymous_identity_len)};
1773 }
1774
1775 std::pair<SupplicantStatus, std::vector<uint8_t>>
getEapPasswordInternal()1776 StaNetwork::getEapPasswordInternal()
1777 {
1778 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1779 if (!wpa_ssid->eap.password) {
1780 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1781 }
1782 return {{SupplicantStatusCode::SUCCESS, ""},
1783 std::vector<uint8_t>(
1784 wpa_ssid->eap.password,
1785 wpa_ssid->eap.password + wpa_ssid->eap.password_len)};
1786 }
1787
getEapCACertInternal()1788 std::pair<SupplicantStatus, std::string> StaNetwork::getEapCACertInternal()
1789 {
1790 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1791 if (!wpa_ssid->eap.cert.ca_cert) {
1792 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1793 }
1794 return {{SupplicantStatusCode::SUCCESS, ""},
1795 reinterpret_cast<char *>(wpa_ssid->eap.cert.ca_cert)};
1796 }
1797
getEapCAPathInternal()1798 std::pair<SupplicantStatus, std::string> StaNetwork::getEapCAPathInternal()
1799 {
1800 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1801 if (!wpa_ssid->eap.cert.ca_path) {
1802 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1803 }
1804 return {{SupplicantStatusCode::SUCCESS, ""},
1805 reinterpret_cast<char *>(wpa_ssid->eap.cert.ca_path)};
1806 }
1807
getEapClientCertInternal()1808 std::pair<SupplicantStatus, std::string> StaNetwork::getEapClientCertInternal()
1809 {
1810 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1811 if (!wpa_ssid->eap.cert.client_cert) {
1812 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1813 }
1814 return {{SupplicantStatusCode::SUCCESS, ""},
1815 reinterpret_cast<char *>(wpa_ssid->eap.cert.client_cert)};
1816 }
1817
1818 std::pair<SupplicantStatus, std::string>
getEapPrivateKeyIdInternal()1819 StaNetwork::getEapPrivateKeyIdInternal()
1820 {
1821 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1822 if (!wpa_ssid->eap.cert.key_id) {
1823 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1824 }
1825 return {{SupplicantStatusCode::SUCCESS, ""}, wpa_ssid->eap.cert.key_id};
1826 }
1827
1828 std::pair<SupplicantStatus, std::string>
getEapSubjectMatchInternal()1829 StaNetwork::getEapSubjectMatchInternal()
1830 {
1831 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1832 if (!wpa_ssid->eap.cert.subject_match) {
1833 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1834 }
1835 return {{SupplicantStatusCode::SUCCESS, ""},
1836 reinterpret_cast<char *>(wpa_ssid->eap.cert.subject_match)};
1837 }
1838
1839 std::pair<SupplicantStatus, std::string>
getEapAltSubjectMatchInternal()1840 StaNetwork::getEapAltSubjectMatchInternal()
1841 {
1842 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1843 if (!wpa_ssid->eap.cert.altsubject_match) {
1844 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1845 }
1846 return {{SupplicantStatusCode::SUCCESS, ""},
1847 reinterpret_cast<char *>(wpa_ssid->eap.cert.altsubject_match)};
1848 }
1849
getEapEngineInternal()1850 std::pair<SupplicantStatus, bool> StaNetwork::getEapEngineInternal()
1851 {
1852 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1853 return {{SupplicantStatusCode::SUCCESS, ""}, wpa_ssid->eap.cert.engine == 1};
1854 }
1855
getEapEngineIDInternal()1856 std::pair<SupplicantStatus, std::string> StaNetwork::getEapEngineIDInternal()
1857 {
1858 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1859 if (!wpa_ssid->eap.cert.engine_id) {
1860 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1861 }
1862 return {{SupplicantStatusCode::SUCCESS, ""}, {wpa_ssid->eap.cert.engine_id}};
1863 }
1864
1865 std::pair<SupplicantStatus, std::string>
getEapDomainSuffixMatchInternal()1866 StaNetwork::getEapDomainSuffixMatchInternal()
1867 {
1868 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1869 if (!wpa_ssid->eap.cert.domain_suffix_match) {
1870 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1871 }
1872 return {{SupplicantStatusCode::SUCCESS, ""},
1873 {wpa_ssid->eap.cert.domain_suffix_match}};
1874 }
1875
getIdStrInternal()1876 std::pair<SupplicantStatus, std::string> StaNetwork::getIdStrInternal()
1877 {
1878 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1879 if (!wpa_ssid->id_str) {
1880 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1881 }
1882 return {{SupplicantStatusCode::SUCCESS, ""}, {wpa_ssid->id_str}};
1883 }
1884
getEdmgInternal()1885 std::pair<V1_4::SupplicantStatus, bool> StaNetwork::getEdmgInternal()
1886 {
1887 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1888 return {{V1_4::SupplicantStatusCode::SUCCESS, ""},
1889 (wpa_ssid->enable_edmg == 1)};
1890 }
1891
1892 std::pair<SupplicantStatus, std::vector<uint8_t>>
getWpsNfcConfigurationTokenInternal()1893 StaNetwork::getWpsNfcConfigurationTokenInternal()
1894 {
1895 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
1896 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1897 auto token_buf = misc_utils::createWpaBufUniquePtr(
1898 wpas_wps_network_config_token(wpa_s, 0, wpa_ssid));
1899 if (!token_buf) {
1900 return {{SupplicantStatusCode::FAILURE_UNKNOWN, ""}, {}};
1901 }
1902 return {{SupplicantStatusCode::SUCCESS, ""},
1903 misc_utils::convertWpaBufToVector(token_buf.get())};
1904 }
1905
getWapiCertSuiteInternal()1906 std::pair<SupplicantStatus, std::string> StaNetwork::getWapiCertSuiteInternal()
1907 {
1908 #ifdef CONFIG_WAPI_INTERFACE
1909 return {{SupplicantStatusCode::SUCCESS, "Dummy implementation"}, dummyWapiCertSuite};
1910 #else
1911 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "Not implemented"}, {}};
1912 #endif
1913 }
1914
getWapiPskInternal()1915 std::pair<SupplicantStatus, std::vector<uint8_t>> StaNetwork::getWapiPskInternal()
1916 {
1917 #ifdef CONFIG_WAPI_INTERFACE
1918 return {{SupplicantStatusCode::SUCCESS, "Dummy implementation"}, dummyWapiPsk};
1919 #else
1920 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "Not implemented"}, {}};
1921 #endif
1922 }
1923
enableInternal(bool no_connect)1924 SupplicantStatus StaNetwork::enableInternal(bool no_connect)
1925 {
1926 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1927 if (wpa_ssid->disabled == 2) {
1928 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1929 }
1930 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
1931 if (no_connect) {
1932 wpa_ssid->disabled = 0;
1933 } else {
1934 wpa_s->scan_min_time.sec = 0;
1935 wpa_s->scan_min_time.usec = 0;
1936 wpa_supplicant_enable_network(wpa_s, wpa_ssid);
1937 }
1938 return {SupplicantStatusCode::SUCCESS, ""};
1939 }
1940
disableInternal()1941 SupplicantStatus StaNetwork::disableInternal()
1942 {
1943 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1944 if (wpa_ssid->disabled == 2) {
1945 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1946 }
1947 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
1948 wpa_supplicant_disable_network(wpa_s, wpa_ssid);
1949 return {SupplicantStatusCode::SUCCESS, ""};
1950 }
1951
selectInternal()1952 SupplicantStatus StaNetwork::selectInternal()
1953 {
1954 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1955 if (wpa_ssid->disabled == 2) {
1956 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1957 }
1958 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
1959 wpa_s->scan_min_time.sec = 0;
1960 wpa_s->scan_min_time.usec = 0;
1961 wpa_supplicant_select_network(wpa_s, wpa_ssid);
1962 return {SupplicantStatusCode::SUCCESS, ""};
1963 }
1964
sendNetworkEapSimGsmAuthResponseInternal(const std::vector<ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams> & vec_params)1965 SupplicantStatus StaNetwork::sendNetworkEapSimGsmAuthResponseInternal(
1966 const std::vector<ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams>
1967 &vec_params)
1968 {
1969 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
1970 // Convert the incoming parameters to a string to pass to
1971 // wpa_supplicant.
1972 std::string ctrl_rsp_param = std::string(kNetworkEapSimGsmAuthResponse);
1973 for (const auto ¶ms : vec_params) {
1974 uint32_t kc_hex_len = params.kc.size() * 2 + 1;
1975 std::vector<char> kc_hex(kc_hex_len);
1976 uint32_t sres_hex_len = params.sres.size() * 2 + 1;
1977 std::vector<char> sres_hex(sres_hex_len);
1978 wpa_snprintf_hex(
1979 kc_hex.data(), kc_hex.size(), params.kc.data(),
1980 params.kc.size());
1981 wpa_snprintf_hex(
1982 sres_hex.data(), sres_hex.size(), params.sres.data(),
1983 params.sres.size());
1984 ctrl_rsp_param += ":" + std::string(kc_hex.data()) + ":" +
1985 std::string(sres_hex.data());
1986 }
1987 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_SIM;
1988 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
1989 if (wpa_supplicant_ctrl_rsp_handle(
1990 wpa_s, wpa_ssid, rtype, ctrl_rsp_param.c_str(),
1991 ctrl_rsp_param.size())) {
1992 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
1993 }
1994 eapol_sm_notify_ctrl_response(wpa_s->eapol);
1995 wpa_hexdump_ascii_key(
1996 MSG_DEBUG, "network sim gsm auth response param",
1997 (const u8 *)ctrl_rsp_param.c_str(), ctrl_rsp_param.size());
1998 return {SupplicantStatusCode::SUCCESS, ""};
1999 }
2000
sendNetworkEapSimGsmAuthFailureInternal()2001 SupplicantStatus StaNetwork::sendNetworkEapSimGsmAuthFailureInternal()
2002 {
2003 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2004 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2005 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_SIM;
2006 if (wpa_supplicant_ctrl_rsp_handle(
2007 wpa_s, wpa_ssid, rtype, kNetworkEapSimGsmAuthFailure,
2008 strlen(kNetworkEapSimGsmAuthFailure))) {
2009 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2010 }
2011 eapol_sm_notify_ctrl_response(wpa_s->eapol);
2012 return {SupplicantStatusCode::SUCCESS, ""};
2013 }
2014
sendNetworkEapSimUmtsAuthResponseInternal(const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams & params)2015 SupplicantStatus StaNetwork::sendNetworkEapSimUmtsAuthResponseInternal(
2016 const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams ¶ms)
2017 {
2018 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2019 // Convert the incoming parameters to a string to pass to
2020 // wpa_supplicant.
2021 uint32_t ik_hex_len = params.ik.size() * 2 + 1;
2022 std::vector<char> ik_hex(ik_hex_len);
2023 uint32_t ck_hex_len = params.ck.size() * 2 + 1;
2024 std::vector<char> ck_hex(ck_hex_len);
2025 uint32_t res_hex_len = params.res.size() * 2 + 1;
2026 std::vector<char> res_hex(res_hex_len);
2027 wpa_snprintf_hex(
2028 ik_hex.data(), ik_hex.size(), params.ik.data(), params.ik.size());
2029 wpa_snprintf_hex(
2030 ck_hex.data(), ck_hex.size(), params.ck.data(), params.ck.size());
2031 wpa_snprintf_hex(
2032 res_hex.data(), res_hex.size(), params.res.data(),
2033 params.res.size());
2034 std::string ctrl_rsp_param =
2035 std::string(kNetworkEapSimUmtsAuthResponse) + ":" +
2036 std::string(ik_hex.data()) + ":" + std::string(ck_hex.data()) +
2037 ":" + std::string(res_hex.data());
2038 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_SIM;
2039 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2040 if (wpa_supplicant_ctrl_rsp_handle(
2041 wpa_s, wpa_ssid, rtype, ctrl_rsp_param.c_str(),
2042 ctrl_rsp_param.size())) {
2043 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2044 }
2045 eapol_sm_notify_ctrl_response(wpa_s->eapol);
2046 wpa_hexdump_ascii_key(
2047 MSG_DEBUG, "network sim umts auth response param",
2048 (const u8 *)ctrl_rsp_param.c_str(), ctrl_rsp_param.size());
2049 return {SupplicantStatusCode::SUCCESS, ""};
2050 }
2051
sendNetworkEapSimUmtsAutsResponseInternal(const std::array<uint8_t,14> & auts)2052 SupplicantStatus StaNetwork::sendNetworkEapSimUmtsAutsResponseInternal(
2053 const std::array<uint8_t, 14> &auts)
2054 {
2055 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2056 uint32_t auts_hex_len = auts.size() * 2 + 1;
2057 std::vector<char> auts_hex(auts_hex_len);
2058 wpa_snprintf_hex(
2059 auts_hex.data(), auts_hex.size(), auts.data(), auts.size());
2060 std::string ctrl_rsp_param =
2061 std::string(kNetworkEapSimUmtsAutsResponse) + ":" +
2062 std::string(auts_hex.data());
2063 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_SIM;
2064 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2065 if (wpa_supplicant_ctrl_rsp_handle(
2066 wpa_s, wpa_ssid, rtype, ctrl_rsp_param.c_str(),
2067 ctrl_rsp_param.size())) {
2068 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2069 }
2070 eapol_sm_notify_ctrl_response(wpa_s->eapol);
2071 wpa_hexdump_ascii_key(
2072 MSG_DEBUG, "network sim umts auts response param",
2073 (const u8 *)ctrl_rsp_param.c_str(), ctrl_rsp_param.size());
2074 return {SupplicantStatusCode::SUCCESS, ""};
2075 }
2076
sendNetworkEapSimUmtsAuthFailureInternal()2077 SupplicantStatus StaNetwork::sendNetworkEapSimUmtsAuthFailureInternal()
2078 {
2079 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2080 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2081 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_SIM;
2082 if (wpa_supplicant_ctrl_rsp_handle(
2083 wpa_s, wpa_ssid, rtype, kNetworkEapSimUmtsAuthFailure,
2084 strlen(kNetworkEapSimUmtsAuthFailure))) {
2085 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2086 }
2087 eapol_sm_notify_ctrl_response(wpa_s->eapol);
2088 return {SupplicantStatusCode::SUCCESS, ""};
2089 }
2090
sendNetworkEapIdentityResponseInternal(const std::vector<uint8_t> & identity)2091 SupplicantStatus StaNetwork::sendNetworkEapIdentityResponseInternal(
2092 const std::vector<uint8_t> &identity)
2093 {
2094 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2095 std::string ctrl_rsp_param(identity.begin(), identity.end());
2096 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_EAP_IDENTITY;
2097 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2098 if (wpa_supplicant_ctrl_rsp_handle(
2099 wpa_s, wpa_ssid, rtype, ctrl_rsp_param.c_str(),
2100 ctrl_rsp_param.size())) {
2101 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2102 }
2103 eapol_sm_notify_ctrl_response(wpa_s->eapol);
2104 wpa_hexdump_ascii_key(
2105 MSG_DEBUG, "network identity response param",
2106 (const u8 *)ctrl_rsp_param.c_str(), ctrl_rsp_param.size());
2107 return {SupplicantStatusCode::SUCCESS, ""};
2108 }
2109
sendNetworkEapIdentityResponseInternal_1_1(const std::vector<uint8_t> & identity,const std::vector<uint8_t> & encrypted_imsi_identity)2110 SupplicantStatus StaNetwork::sendNetworkEapIdentityResponseInternal_1_1(
2111 const std::vector<uint8_t> &identity,
2112 const std::vector<uint8_t> &encrypted_imsi_identity)
2113 {
2114 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2115 // format: plain identity + ":" + encrypted
2116 // identity(encrypted_imsi_identity)
2117 std::string ctrl_rsp_param =
2118 std::string(identity.begin(), identity.end()) + ":" +
2119 std::string(
2120 encrypted_imsi_identity.begin(), encrypted_imsi_identity.end());
2121 enum wpa_ctrl_req_type rtype = WPA_CTRL_REQ_EAP_IDENTITY;
2122 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2123 if (wpa_supplicant_ctrl_rsp_handle(
2124 wpa_s, wpa_ssid, rtype, ctrl_rsp_param.c_str(),
2125 ctrl_rsp_param.size())) {
2126 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2127 }
2128 eapol_sm_notify_ctrl_response(wpa_s->eapol);
2129 wpa_hexdump_ascii_key(
2130 MSG_DEBUG, "network identity response param",
2131 (const u8 *)ctrl_rsp_param.c_str(), ctrl_rsp_param.size());
2132 return {SupplicantStatusCode::SUCCESS, ""};
2133 }
2134
enableTlsSuiteBEapPhase1ParamInternal(bool enable)2135 SupplicantStatus StaNetwork::enableTlsSuiteBEapPhase1ParamInternal(bool enable)
2136 {
2137 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2138 int val = enable == true ? 1 : 0;
2139 std::string suiteb_phase1("tls_suiteb=" + std::to_string(val));
2140
2141 if (setStringKeyFieldAndResetState(
2142 suiteb_phase1.c_str(), &(wpa_ssid->eap.phase1), "phase1")) {
2143 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2144 }
2145 return {SupplicantStatusCode::SUCCESS, ""};
2146 }
2147
enableSuiteBEapOpenSslCiphersInternal()2148 SupplicantStatus StaNetwork::enableSuiteBEapOpenSslCiphersInternal()
2149 {
2150 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2151 const char openssl_suiteb_cipher[] = "SUITEB192";
2152
2153 if (setStringKeyFieldAndResetState(
2154 openssl_suiteb_cipher, &(wpa_ssid->eap.openssl_ciphers),
2155 "openssl_ciphers")) {
2156 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2157 }
2158 return {SupplicantStatusCode::SUCCESS, ""};
2159 }
2160
setSaePasswordInternal(const std::string & sae_password)2161 SupplicantStatus StaNetwork::setSaePasswordInternal(
2162 const std::string &sae_password)
2163 {
2164 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2165 if (sae_password.length() < 1) {
2166 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2167 }
2168 if (wpa_ssid->sae_password &&
2169 os_strlen(wpa_ssid->sae_password) == sae_password.length() &&
2170 os_memcmp(
2171 wpa_ssid->sae_password, sae_password.c_str(),
2172 sae_password.length()) == 0) {
2173 return {SupplicantStatusCode::SUCCESS, ""};
2174 }
2175 wpa_ssid->psk_set = 1;
2176 if (setStringKeyFieldAndResetState(
2177 sae_password.c_str(), &(wpa_ssid->sae_password),
2178 "sae password")) {
2179 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2180 }
2181 return {SupplicantStatusCode::SUCCESS, ""};
2182 }
2183
setSaePasswordIdInternal(const std::string & sae_password_id)2184 SupplicantStatus StaNetwork::setSaePasswordIdInternal(
2185 const std::string &sae_password_id)
2186 {
2187 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2188 if (sae_password_id.length() < 1) {
2189 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2190 }
2191 if (wpa_ssid->sae_password_id &&
2192 os_strlen(wpa_ssid->sae_password_id) == sae_password_id.length() &&
2193 os_memcmp(
2194 wpa_ssid->sae_password_id, sae_password_id.c_str(),
2195 sae_password_id.length()) == 0) {
2196 return {SupplicantStatusCode::SUCCESS, ""};
2197 }
2198 wpa_ssid->psk_set = 1;
2199 if (setStringKeyFieldAndResetState(
2200 sae_password_id.c_str(), &(wpa_ssid->sae_password_id),
2201 "sae password id")) {
2202 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2203 }
2204 return {SupplicantStatusCode::SUCCESS, ""};
2205 }
2206
setGroupMgmtCipherInternal(uint32_t group_mgmt_cipher_mask)2207 SupplicantStatus StaNetwork::setGroupMgmtCipherInternal(uint32_t
2208 group_mgmt_cipher_mask)
2209 {
2210 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2211 if (group_mgmt_cipher_mask & ~kAllowedGroupMgmtCipherMask) {
2212 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2213 }
2214 wpa_ssid->group_mgmt_cipher = group_mgmt_cipher_mask;
2215 wpa_printf(MSG_MSGDUMP, "group_mgmt_cipher: 0x%x",
2216 wpa_ssid->group_mgmt_cipher);
2217 resetInternalStateAfterParamsUpdate();
2218 return {SupplicantStatusCode::SUCCESS, ""};
2219 }
2220
getGroupMgmtCipherInternal()2221 std::pair<SupplicantStatus, uint32_t> StaNetwork::getGroupMgmtCipherInternal()
2222 {
2223 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2224 return {{SupplicantStatusCode::SUCCESS, ""},
2225 wpa_ssid->group_mgmt_cipher & kAllowedGroupMgmtCipherMask};
2226 }
2227
setOcspInternal(V1_3::OcspType ocspType)2228 SupplicantStatus StaNetwork::setOcspInternal(V1_3::OcspType ocspType) {
2229 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2230 if (ocspType < V1_3::OcspType::NONE || ocspType > V1_3::OcspType::REQUIRE_ALL_CERTS_STATUS) {
2231 return{ SupplicantStatusCode::FAILURE_ARGS_INVALID, "" };
2232 }
2233 wpa_ssid->eap.cert.ocsp = (int) ocspType;
2234 wpa_printf(
2235 MSG_MSGDUMP, "ocsp: %d", wpa_ssid->eap.cert.ocsp);
2236 resetInternalStateAfterParamsUpdate();
2237 return {SupplicantStatusCode::SUCCESS, ""};
2238 }
2239
getOcspInternal()2240 std::pair<SupplicantStatus, V1_3::OcspType> StaNetwork::getOcspInternal()
2241 {
2242 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2243 return {{SupplicantStatusCode::SUCCESS, ""},
2244 (V1_3::OcspType) wpa_ssid->eap.cert.ocsp};
2245 }
2246
setPmkCacheInternal(const std::vector<uint8_t> & serializedEntry)2247 SupplicantStatus StaNetwork::setPmkCacheInternal(const std::vector<uint8_t>& serializedEntry) {
2248 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2249 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2250 struct rsn_pmksa_cache_entry *new_entry = NULL;
2251
2252 new_entry = (struct rsn_pmksa_cache_entry *) os_zalloc(sizeof(*new_entry));
2253 if (!new_entry) {
2254 return {SupplicantStatusCode::FAILURE_UNKNOWN, "Allocating memory failed"};
2255 }
2256
2257 std::stringstream ss(
2258 std::stringstream::in | std::stringstream::out | std::stringstream::binary);
2259 ss.write((char *) serializedEntry.data(), std::streamsize(serializedEntry.size()));
2260 misc_utils::deserializePmkCacheEntry(ss, new_entry);
2261 new_entry->network_ctx = wpa_ssid;
2262 wpa_sm_pmksa_cache_add_entry(wpa_s->wpa, new_entry);
2263
2264 return {SupplicantStatusCode::SUCCESS, ""};
2265 }
2266
setKeyMgmt_1_3Internal(uint32_t key_mgmt_mask)2267 SupplicantStatus StaNetwork::setKeyMgmt_1_3Internal(uint32_t key_mgmt_mask)
2268 {
2269 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2270 if (key_mgmt_mask & ~kAllowedKeyMgmtMask) {
2271 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2272 }
2273 setFastTransitionKeyMgmt(key_mgmt_mask);
2274
2275 if (key_mgmt_mask & WPA_KEY_MGMT_OWE) {
2276 // Do not allow to connect to Open network when OWE is selected
2277 wpa_ssid->owe_only = 1;
2278 }
2279 wpa_ssid->key_mgmt = key_mgmt_mask;
2280 wpa_printf(MSG_MSGDUMP, "key_mgmt: 0x%x", wpa_ssid->key_mgmt);
2281 resetInternalStateAfterParamsUpdate();
2282 return {SupplicantStatusCode::SUCCESS, ""};
2283 }
2284
getKeyMgmt_1_3Internal()2285 std::pair<SupplicantStatus, uint32_t> StaNetwork::getKeyMgmt_1_3Internal()
2286 {
2287 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2288 uint32_t key_mgmt_mask = wpa_ssid->key_mgmt & kAllowedKeyMgmtMask;
2289
2290 resetFastTransitionKeyMgmt(key_mgmt_mask);
2291 return {{SupplicantStatusCode::SUCCESS, ""}, key_mgmt_mask};
2292 }
2293
setProto_1_3Internal(uint32_t proto_mask)2294 SupplicantStatus StaNetwork::setProto_1_3Internal(uint32_t proto_mask)
2295 {
2296 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2297 if (proto_mask & ~kAllowedProtoMask) {
2298 return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2299 }
2300 wpa_ssid->proto = proto_mask;
2301 wpa_printf(MSG_MSGDUMP, "proto: 0x%x", wpa_ssid->proto);
2302 resetInternalStateAfterParamsUpdate();
2303 return {SupplicantStatusCode::SUCCESS, ""};
2304 }
2305
getProto_1_3Internal()2306 std::pair<SupplicantStatus, uint32_t> StaNetwork::getProto_1_3Internal()
2307 {
2308 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2309 return {{SupplicantStatusCode::SUCCESS, ""},
2310 wpa_ssid->proto & kAllowedProtoMask};
2311 }
2312
setGroupCipher_1_3Internal(uint32_t group_cipher_mask)2313 SupplicantStatus StaNetwork::setGroupCipher_1_3Internal(uint32_t group_cipher_mask)
2314 {
2315 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
2316 }
2317
getGroupCipher_1_3Internal()2318 std::pair<SupplicantStatus, uint32_t> StaNetwork::getGroupCipher_1_3Internal()
2319 {
2320 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"}, 0};
2321 }
2322
setPairwiseCipher_1_3Internal(uint32_t pairwise_cipher_mask)2323 SupplicantStatus StaNetwork::setPairwiseCipher_1_3Internal(
2324 uint32_t pairwise_cipher_mask)
2325 {
2326 return {SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"};
2327 }
2328
getPairwiseCipher_1_3Internal()2329 std::pair<SupplicantStatus, uint32_t> StaNetwork::getPairwiseCipher_1_3Internal()
2330 {
2331 return {{SupplicantStatusCode::FAILURE_UNKNOWN, "deprecated"}, 0};
2332 }
2333
setGroupCipher_1_4Internal(uint32_t group_cipher_mask)2334 V1_4::SupplicantStatus StaNetwork::setGroupCipher_1_4Internal(uint32_t group_cipher_mask)
2335 {
2336 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2337 if (group_cipher_mask & ~kAllowedGroupCipherMask) {
2338 return {V1_4::SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2339 }
2340 wpa_ssid->group_cipher = group_cipher_mask;
2341 wpa_printf(MSG_MSGDUMP, "group_cipher: 0x%x", wpa_ssid->group_cipher);
2342 resetInternalStateAfterParamsUpdate();
2343 return {V1_4::SupplicantStatusCode::SUCCESS, ""};
2344 }
2345
getGroupCipher_1_4Internal()2346 std::pair<V1_4::SupplicantStatus, uint32_t> StaNetwork::getGroupCipher_1_4Internal()
2347 {
2348 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2349 return {{V1_4::SupplicantStatusCode::SUCCESS, ""},
2350 wpa_ssid->group_cipher & kAllowedGroupCipherMask};
2351 }
2352
setPairwiseCipher_1_4Internal(uint32_t pairwise_cipher_mask)2353 V1_4::SupplicantStatus StaNetwork::setPairwiseCipher_1_4Internal(
2354 uint32_t pairwise_cipher_mask)
2355 {
2356 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2357 if (pairwise_cipher_mask & ~kAllowedPairwisewCipherMask) {
2358 return {V1_4::SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
2359 }
2360 wpa_ssid->pairwise_cipher = pairwise_cipher_mask;
2361 wpa_printf(
2362 MSG_MSGDUMP, "pairwise_cipher: 0x%x", wpa_ssid->pairwise_cipher);
2363 resetInternalStateAfterParamsUpdate();
2364 return {V1_4::SupplicantStatusCode::SUCCESS, ""};
2365 }
2366
getPairwiseCipher_1_4Internal()2367 std::pair<V1_4::SupplicantStatus, uint32_t> StaNetwork::getPairwiseCipher_1_4Internal()
2368 {
2369 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2370 return {{V1_4::SupplicantStatusCode::SUCCESS, ""},
2371 wpa_ssid->pairwise_cipher & kAllowedPairwisewCipherMask};
2372 }
2373
2374 /**
2375 * Retrieve the underlying |wpa_ssid| struct pointer for
2376 * this network.
2377 * If the underlying network is removed or the interface
2378 * this network belong to
2379 * is removed, all RPC method calls on this object will
2380 * return failure.
2381 */
retrieveNetworkPtr()2382 struct wpa_ssid *StaNetwork::retrieveNetworkPtr()
2383 {
2384 wpa_supplicant *wpa_s = retrieveIfacePtr();
2385 if (!wpa_s)
2386 return nullptr;
2387 return wpa_config_get_network(wpa_s->conf, network_id_);
2388 }
2389
2390 /**
2391 * Retrieve the underlying |wpa_supplicant| struct
2392 * pointer for
2393 * this network.
2394 */
retrieveIfacePtr()2395 struct wpa_supplicant *StaNetwork::retrieveIfacePtr()
2396 {
2397 return wpa_supplicant_get_iface(wpa_global_, ifname_.c_str());
2398 }
2399
2400 /**
2401 * Check if the provided psk passhrase is valid or not.
2402 *
2403 * Returns 0 if valid, 1 otherwise.
2404 */
isPskPassphraseValid(const std::string & psk)2405 int StaNetwork::isPskPassphraseValid(const std::string &psk)
2406 {
2407 if (psk.size() <
2408 static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
2409 PSK_PASSPHRASE_MIN_LEN_IN_BYTES) ||
2410 psk.size() >
2411 static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
2412 PSK_PASSPHRASE_MAX_LEN_IN_BYTES)) {
2413 return 1;
2414 }
2415 if (has_ctrl_char((u8 *)psk.c_str(), psk.size())) {
2416 return 1;
2417 }
2418 return 0;
2419 }
2420
2421 /**
2422 * Reset internal wpa_supplicant state machine state
2423 * after params update (except
2424 * bssid).
2425 */
resetInternalStateAfterParamsUpdate()2426 void StaNetwork::resetInternalStateAfterParamsUpdate()
2427 {
2428 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2429 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2430
2431 wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_ssid);
2432
2433 if (wpa_s->current_ssid == wpa_ssid || wpa_s->current_ssid == NULL) {
2434 /*
2435 * Invalidate the EAP session cache if
2436 * anything in the
2437 * current or previously used
2438 * configuration changes.
2439 */
2440 eapol_sm_invalidate_cached_session(wpa_s->eapol);
2441 }
2442 }
2443
2444 /**
2445 * Helper function to set value in a string field in |wpa_ssid| structue
2446 * instance for this network.
2447 * This function frees any existing data in these fields.
2448 */
setStringFieldAndResetState(const char * value,uint8_t ** to_update_field,const char * hexdump_prefix)2449 int StaNetwork::setStringFieldAndResetState(
2450 const char *value, uint8_t **to_update_field, const char *hexdump_prefix)
2451 {
2452 return setStringFieldAndResetState(
2453 value, (char **)to_update_field, hexdump_prefix);
2454 }
2455
2456 /**
2457 * Helper function to set value in a string field in |wpa_ssid| structue
2458 * instance for this network.
2459 * This function frees any existing data in these fields.
2460 */
setStringFieldAndResetState(const char * value,char ** to_update_field,const char * hexdump_prefix)2461 int StaNetwork::setStringFieldAndResetState(
2462 const char *value, char **to_update_field, const char *hexdump_prefix)
2463 {
2464 int value_len = strlen(value);
2465 if (*to_update_field) {
2466 os_free(*to_update_field);
2467 }
2468 *to_update_field = dup_binstr(value, value_len);
2469 if (!(*to_update_field)) {
2470 return 1;
2471 }
2472 wpa_hexdump_ascii(
2473 MSG_MSGDUMP, hexdump_prefix, *to_update_field, value_len);
2474 resetInternalStateAfterParamsUpdate();
2475 return 0;
2476 }
2477
2478 /**
2479 * Helper function to set value in a string key field in |wpa_ssid| structue
2480 * instance for this network.
2481 * This function frees any existing data in these fields.
2482 */
setStringKeyFieldAndResetState(const char * value,char ** to_update_field,const char * hexdump_prefix)2483 int StaNetwork::setStringKeyFieldAndResetState(
2484 const char *value, char **to_update_field, const char *hexdump_prefix)
2485 {
2486 int value_len = strlen(value);
2487 if (*to_update_field) {
2488 str_clear_free(*to_update_field);
2489 }
2490 *to_update_field = dup_binstr(value, value_len);
2491 if (!(*to_update_field)) {
2492 return 1;
2493 }
2494 wpa_hexdump_ascii_key(
2495 MSG_MSGDUMP, hexdump_prefix, *to_update_field, value_len);
2496 resetInternalStateAfterParamsUpdate();
2497 return 0;
2498 }
2499
2500 /**
2501 * Helper function to set value in a string field with a corresponding length
2502 * field in |wpa_ssid| structue instance for this network.
2503 * This function frees any existing data in these fields.
2504 */
setByteArrayFieldAndResetState(const uint8_t * value,const size_t value_len,uint8_t ** to_update_field,size_t * to_update_field_len,const char * hexdump_prefix)2505 int StaNetwork::setByteArrayFieldAndResetState(
2506 const uint8_t *value, const size_t value_len, uint8_t **to_update_field,
2507 size_t *to_update_field_len, const char *hexdump_prefix)
2508 {
2509 if (*to_update_field) {
2510 os_free(*to_update_field);
2511 }
2512 *to_update_field = (uint8_t *)os_malloc(value_len);
2513 if (!(*to_update_field)) {
2514 return 1;
2515 }
2516 os_memcpy(*to_update_field, value, value_len);
2517 *to_update_field_len = value_len;
2518
2519 wpa_hexdump_ascii(
2520 MSG_MSGDUMP, hexdump_prefix, *to_update_field,
2521 *to_update_field_len);
2522 resetInternalStateAfterParamsUpdate();
2523 return 0;
2524 }
2525
2526 /**
2527 * Helper function to set value in a string key field with a corresponding
2528 * length field in |wpa_ssid| structue instance for this network.
2529 * This function frees any existing data in these fields.
2530 */
setByteArrayKeyFieldAndResetState(const uint8_t * value,const size_t value_len,uint8_t ** to_update_field,size_t * to_update_field_len,const char * hexdump_prefix)2531 int StaNetwork::setByteArrayKeyFieldAndResetState(
2532 const uint8_t *value, const size_t value_len, uint8_t **to_update_field,
2533 size_t *to_update_field_len, const char *hexdump_prefix)
2534 {
2535 if (*to_update_field) {
2536 bin_clear_free(*to_update_field, *to_update_field_len);
2537 }
2538 *to_update_field = (uint8_t *)os_malloc(value_len);
2539 if (!(*to_update_field)) {
2540 return 1;
2541 }
2542 os_memcpy(*to_update_field, value, value_len);
2543 *to_update_field_len = value_len;
2544
2545 wpa_hexdump_ascii_key(
2546 MSG_MSGDUMP, hexdump_prefix, *to_update_field,
2547 *to_update_field_len);
2548 resetInternalStateAfterParamsUpdate();
2549 return 0;
2550 }
2551
2552 /**
2553 * Helper function to set the fast transition bits in the key management
2554 * bitmask, to allow FT support when possible.
2555 */
setFastTransitionKeyMgmt(uint32_t & key_mgmt_mask)2556 void StaNetwork::setFastTransitionKeyMgmt(uint32_t &key_mgmt_mask)
2557 {
2558 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2559 int res;
2560 struct wpa_driver_capa capa;
2561
2562 if (key_mgmt_mask & WPA_KEY_MGMT_PSK) {
2563 key_mgmt_mask |= WPA_KEY_MGMT_FT_PSK;
2564 }
2565
2566 if (key_mgmt_mask & WPA_KEY_MGMT_IEEE8021X) {
2567 key_mgmt_mask |= WPA_KEY_MGMT_FT_IEEE8021X;
2568 }
2569
2570 res = wpa_drv_get_capa(wpa_s, &capa);
2571 if (res == 0) {
2572 #ifdef CONFIG_IEEE80211R
2573 #ifdef CONFIG_SAE
2574 if ((key_mgmt_mask & WPA_KEY_MGMT_SAE) &&
2575 (capa.key_mgmt_iftype[WPA_IF_STATION] & WPA_DRIVER_CAPA_KEY_MGMT_FT_SAE)) {
2576 key_mgmt_mask |= WPA_KEY_MGMT_FT_SAE;
2577 }
2578 #endif
2579 #endif
2580 }
2581
2582 }
2583
2584 /**
2585 * Helper function to reset the fast transition bits in the key management
2586 * bitmask.
2587 */
resetFastTransitionKeyMgmt(uint32_t & key_mgmt_mask)2588 void StaNetwork::resetFastTransitionKeyMgmt(uint32_t &key_mgmt_mask)
2589 {
2590 if (key_mgmt_mask & WPA_KEY_MGMT_PSK) {
2591 key_mgmt_mask &= ~WPA_KEY_MGMT_FT_PSK;
2592 }
2593
2594 if (key_mgmt_mask & WPA_KEY_MGMT_IEEE8021X) {
2595 key_mgmt_mask &= ~WPA_KEY_MGMT_FT_IEEE8021X;
2596 }
2597 #ifdef CONFIG_IEEE80211R
2598 #ifdef CONFIG_SAE
2599 if (key_mgmt_mask & WPA_KEY_MGMT_SAE) {
2600 key_mgmt_mask &= ~WPA_KEY_MGMT_FT_SAE;
2601 }
2602 #endif
2603 #endif
2604 }
2605
2606 /**
2607 * Helper function to enable erp keys generation while connecting to FILS
2608 * enabled APs.
2609 */
setEapErpInternal(bool enable)2610 SupplicantStatus StaNetwork::setEapErpInternal(bool enable)
2611 {
2612 #ifdef CONFIG_FILS
2613 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2614 wpa_ssid->eap.erp = enable ? 1 : 0;
2615 return {SupplicantStatusCode::SUCCESS, ""};
2616 #else /* CONFIG_FILS */
2617 return {SupplicantStatusCode::FAILURE_UNKNOWN, ""};
2618 #endif /* CONFIG_FILS */
2619 }
2620
setSaeH2eModeInternal(ISupplicantStaNetworkV1_4::SaeH2eMode mode)2621 V1_4::SupplicantStatus StaNetwork::setSaeH2eModeInternal(
2622 ISupplicantStaNetworkV1_4::SaeH2eMode mode)
2623 {
2624 struct wpa_supplicant *wpa_s = retrieveIfacePtr();
2625 switch (mode) {
2626 case ISupplicantStaNetworkV1_4::SaeH2eMode::DISABLED:
2627 wpa_s->conf->sae_pwe = 0;
2628 break;
2629 case ISupplicantStaNetworkV1_4::SaeH2eMode::H2E_MANDATORY:
2630 wpa_s->conf->sae_pwe = 1;
2631 break;
2632 case ISupplicantStaNetworkV1_4::SaeH2eMode::H2E_OPTIONAL:
2633 wpa_s->conf->sae_pwe = 2;
2634 break;
2635 }
2636 resetInternalStateAfterParamsUpdate();
2637 return {V1_4::SupplicantStatusCode::SUCCESS, ""};
2638 }
2639
enableSaePkOnlyModeInternal(bool enable)2640 V1_4::SupplicantStatus StaNetwork::enableSaePkOnlyModeInternal(bool enable)
2641 {
2642 #ifdef CONFIG_SAE_PK
2643 struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
2644 wpa_ssid->sae_pk = enable ? SAE_PK_MODE_ONLY : SAE_PK_MODE_AUTOMATIC;
2645 resetInternalStateAfterParamsUpdate();
2646 return {V1_4::SupplicantStatusCode::SUCCESS, ""};
2647 #else
2648 return {V1_4::SupplicantStatusCode::FAILURE_UNSUPPORTED, ""};
2649 #endif
2650 }
2651
2652 } // namespace implementation
2653 } // namespace V1_4
2654 } // namespace supplicant
2655 } // namespace wifi
2656 } // namespace hardware
2657 } // namespace android
2658