summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-05-11 07:01:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-11 07:01:22 +0000
commitb6ef9646566c02792d6c0e765d28669453c4d7b3 (patch)
tree1823d340407b8eda938a0f59b6ca4d8db1879917 /service
parentd8742cdbeaf3b70dbd380912607406367493f277 (diff)
parent822f53641188d6515ba36d417328bec08517de6b (diff)
Merge "wifi: fix setting WAPI psk hex bytes" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaNetworkHal.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
index 0507a8867..cfbbfad0e 100644
--- a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
@@ -207,13 +207,6 @@ public class SupplicantStaNetworkHal {
config.wepKeys[i] = NativeUtil.bytesToHexOrQuotedString(mWepKey);
}
}
- /** PSK pass phrase */
- config.preSharedKey = null;
- if (getPskPassphrase() && !TextUtils.isEmpty(mPskPassphrase)) {
- config.preSharedKey = NativeUtil.addEnclosingQuotes(mPskPassphrase);
- } else if (getPsk() && !ArrayUtils.isEmpty(mPsk)) {
- config.preSharedKey = NativeUtil.hexStringFromByteArray(mPsk);
- } /* Do not read SAE password */
/** allowedKeyManagement */
if (getKeyMgmt()) {
@@ -247,6 +240,18 @@ public class SupplicantStaNetworkHal {
supplicantToWifiConfigurationGroupMgmtCipherMask(mGroupMgmtCipherMask);
}
+ /** PSK pass phrase */
+ config.preSharedKey = null;
+ if (getPskPassphrase() && !TextUtils.isEmpty(mPskPassphrase)) {
+ if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WAPI_PSK)) {
+ config.preSharedKey = mPskPassphrase;
+ } else {
+ config.preSharedKey = NativeUtil.addEnclosingQuotes(mPskPassphrase);
+ }
+ } else if (getPsk() && !ArrayUtils.isEmpty(mPsk)) {
+ config.preSharedKey = NativeUtil.hexStringFromByteArray(mPsk);
+ } /* Do not read SAE password */
+
/** metadata: idstr */
if (getIdStr() && !TextUtils.isEmpty(mIdStr)) {
Map<String, String> metadata = parseNetworkExtra(mIdStr);
@@ -302,7 +307,12 @@ public class SupplicantStaNetworkHal {
// For PSK, this can either be quoted ASCII passphrase or hex string for raw psk.
// For SAE, password must be a quoted ASCII string
if (config.preSharedKey != null) {
- if (config.preSharedKey.startsWith("\"")) {
+ if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WAPI_PSK)) {
+ if (!setPskPassphrase(config.preSharedKey)) {
+ Log.e(TAG, "failed to set wapi psk passphrase");
+ return false;
+ }
+ } else if (config.preSharedKey.startsWith("\"")) {
if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.SAE)) {
/* WPA3 case, field is SAE Password */
if (!setSaePassword(