summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2019-05-15 14:53:15 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-05-15 14:53:15 -0700
commit0f9f775c60b6934803401ccf996002dbec781d39 (patch)
tree4cc6644d61543929529df1c8ed32c38e363a6640
parent0dd95f064b3edb86047a06c7ff7fdf1bb8828ac2 (diff)
parent94a8bec91ea21a0f895ca235f357c9707a15fce7 (diff)
Merge "[PSK/EAP] Do not add SHA256 Key mgmt for SupplicantHal < 1.2" into qt-dev am: f339436f90
am: 94a8bec91e Change-Id: I6d12e5432cffcc8c0dd3b8f19b83986d58134c0a
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaNetworkHal.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java30
2 files changed, 38 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
index 059ea797c..9255fc231 100644
--- a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
@@ -3012,6 +3012,14 @@ public class SupplicantStaNetworkHal {
private BitSet addSha256KeyMgmtFlags(BitSet keyManagementFlags) {
synchronized (mLock) {
BitSet modifiedFlags = (BitSet) keyManagementFlags.clone();
+ android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ iSupplicantStaNetworkV12;
+ iSupplicantStaNetworkV12 = getV1_2StaNetwork();
+ if (iSupplicantStaNetworkV12 == null) {
+ // SHA256 key management requires HALv1.2 or higher
+ return modifiedFlags;
+ }
+
if (keyManagementFlags.get(WifiConfiguration.KeyMgmt.WPA_PSK)) {
modifiedFlags.set(WifiConfiguration.KeyMgmt.WPA_PSK_SHA256);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
index f8896f44c..796dce1df 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
@@ -842,6 +842,36 @@ public class SupplicantStaNetworkHalTest {
}
/**
+ * Tests the addition of SHA256 flags (WPA_PSK_SHA256) is ignored on HAL v1.1 or lower
+ */
+ @Test
+ public void testAddPskSha256FlagsHal1_1OrLower() throws Exception {
+ WifiConfiguration config = WifiConfigurationTestUtil.createPskNetwork();
+ assertTrue(mSupplicantNetwork.saveWifiConfiguration(config));
+
+ // Check the supplicant variables to ensure that we have NOT added the SHA256 flags.
+ assertFalse((mSupplicantVariables.keyMgmtMask
+ & android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork.KeyMgmtMask
+ .WPA_PSK_SHA256) == android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .KeyMgmtMask.WPA_PSK_SHA256);
+ }
+
+ /**
+ * Tests the addition of SHA256 flags (WPA_EAP_SHA256) is ignored on HAL v1.1 or lower
+ */
+ @Test
+ public void testAddEapSha256FlagsHal1_1OrLower() throws Exception {
+ WifiConfiguration config = WifiConfigurationTestUtil.createEapNetwork();
+ assertTrue(mSupplicantNetwork.saveWifiConfiguration(config));
+
+ // Check the supplicant variables to ensure that we have NOT added the SHA256 flags.
+ assertFalse((mSupplicantVariables.keyMgmtMask
+ & android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork.KeyMgmtMask
+ .WPA_EAP_SHA256) == android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .KeyMgmtMask.WPA_EAP_SHA256);
+ }
+
+ /**
* Tests the retrieval of WPS NFC token.
*/
@Test