summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaNetworkHal.java13
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java50
2 files changed, 59 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
index 8571109cd..0507a8867 100644
--- a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
@@ -884,7 +884,7 @@ public class SupplicantStaNetworkHal {
break;
case WifiConfiguration.GroupCipher.GCMP_256:
mask |= android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
- .GroupCipherMask.GCMP_256;
+ .GroupCipherMask.GCMP_256;
break;
case WifiConfiguration.GroupCipher.SMS4:
mask |= android.hardware.wifi.supplicant.V1_3.ISupplicantStaNetwork
@@ -1126,8 +1126,8 @@ public class SupplicantStaNetworkHal {
mask, ISupplicantStaNetwork.GroupCipherMask.CCMP, bitset,
WifiConfiguration.GroupCipher.CCMP);
mask = supplicantMaskValueToWifiConfigurationBitSet(mask,
- android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork.GroupCipherMask
- .GCMP_256, bitset, WifiConfiguration.GroupCipher.GCMP_256);
+ android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .GroupCipherMask.GCMP_256, bitset, WifiConfiguration.GroupCipher.GCMP_256);
mask = supplicantMaskValueToWifiConfigurationBitSet(
mask, ISupplicantStaNetwork.GroupCipherMask.GTK_NOT_USED, bitset,
WifiConfiguration.GroupCipher.GTK_NOT_USED);
@@ -1432,6 +1432,9 @@ public class SupplicantStaNetworkHal {
* Requires HAL v1.2 or higher */
status = iSupplicantStaNetworkV12.setGroupCipher_1_2(groupCipherMask);
} else {
+ // Clear GCMP_256 group cipher which is not supported before v1.2
+ groupCipherMask &= ~android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .GroupCipherMask.GCMP_256;
status = mISupplicantStaNetwork.setGroupCipher(
groupCipherMask);
}
@@ -1516,6 +1519,9 @@ public class SupplicantStaNetworkHal {
* Requires HAL v1.2 or higher */
status = iSupplicantStaNetworkV12.setPairwiseCipher_1_2(pairwiseCipherMask);
} else {
+ // Clear GCMP_256 pairwise cipher which is not supported before v1.2
+ pairwiseCipherMask &= ~android.hardware.wifi.supplicant.V1_2
+ .ISupplicantStaNetwork.PairwiseCipherMask.GCMP_256;
status =
mISupplicantStaNetwork.setPairwiseCipher(pairwiseCipherMask);
}
@@ -1546,7 +1552,6 @@ public class SupplicantStaNetworkHal {
} else {
return false;
}
-
} catch (RemoteException e) {
handleRemoteException(e, methodStr);
return false;
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
index 0e1c9806b..49ae7a756 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
@@ -196,6 +196,14 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
public void testPskPassphraseNetworkWifiConfigurationSaveLoad() throws Exception {
WifiConfiguration config = WifiConfigurationTestUtil.createPskNetwork();
config.requirePmf = true;
+
+ // Set the new defaults
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
+ config.allowedGroupManagementCiphers
+ .set(WifiConfiguration.GroupMgmtCipher.BIP_GMAC_256);
testWifiConfigurationSaveLoad(config);
verify(mISupplicantStaNetworkMock).setPskPassphrase(anyString());
verify(mISupplicantStaNetworkMock)
@@ -203,6 +211,10 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
verify(mISupplicantStaNetworkMock, never()).setPsk(any(byte[].class));
verify(mISupplicantStaNetworkMock, never())
.getPsk(any(ISupplicantStaNetwork.getPskCallback.class));
+ verify(mISupplicantStaNetworkMock)
+ .setPairwiseCipher(ISupplicantStaNetwork.PairwiseCipherMask.CCMP);
+ verify(mISupplicantStaNetworkMock)
+ .setGroupCipher(ISupplicantStaNetwork.GroupCipherMask.CCMP);
}
/**
@@ -948,6 +960,12 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
}
private void testWifiConfigurationSaveLoad(WifiConfiguration config) {
+ if (mSupplicantNetwork.getSupplicantStaNetworkForV1_2Mockable() == null) {
+ // Clear unsupported settings in HAL v1.0
+ config.allowedPairwiseCiphers.clear(WifiConfiguration.PairwiseCipher.GCMP_256);
+ config.allowedGroupCiphers.clear(WifiConfiguration.GroupCipher.GCMP_256);
+ }
+ // Save the configuration using the default supplicant network HAL v1.0
assertTrue(mSupplicantNetwork.saveWifiConfiguration(config));
WifiConfiguration loadConfig = new WifiConfiguration();
Map<String, String> networkExtras = new HashMap<>();
@@ -1039,6 +1057,38 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
}
/**
+ * Tests the saving/loading of WifiConfiguration to wpa_supplicant with psk passphrase for
+ * HAL v1.2 or higher
+ */
+ @Test
+ public void testPskPassphraseNetworkWifiConfigurationSaveLoad1_2OrHigher() throws Exception {
+ createSupplicantStaNetwork(SupplicantStaNetworkVersion.V1_2);
+ WifiConfiguration config = WifiConfigurationTestUtil.createPskNetwork();
+ config.requirePmf = true;
+
+ // Set the new defaults
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
+ testWifiConfigurationSaveLoad(config);
+ verify(mISupplicantStaNetworkMock).setPskPassphrase(anyString());
+ verify(mISupplicantStaNetworkMock)
+ .getPskPassphrase(any(ISupplicantStaNetwork.getPskPassphraseCallback.class));
+ verify(mISupplicantStaNetworkMock, never()).setPsk(any(byte[].class));
+ verify(mISupplicantStaNetworkMock, never())
+ .getPsk(any(ISupplicantStaNetwork.getPskCallback.class));
+ verify(mISupplicantStaNetworkV12)
+ .setPairwiseCipher_1_2(ISupplicantStaNetwork.PairwiseCipherMask.CCMP
+ | android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .PairwiseCipherMask.GCMP_256);
+ verify(mISupplicantStaNetworkV12)
+ .setGroupCipher_1_2(ISupplicantStaNetwork.GroupCipherMask.CCMP
+ | android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .GroupCipherMask.GCMP_256);
+ }
+
+ /**
* Sets up the HIDL interface mock with all the setters/getter values.
* Note: This only sets up the mock to return success on all methods.
*/