diff options
author | Hai Shalom <haishalom@google.com> | 2020-04-21 17:49:31 -0700 |
---|---|---|
committer | Hai Shalom <haishalom@google.com> | 2020-04-21 17:49:31 -0700 |
commit | 2bdea8391e029b88e8d8fcce0f06205a9e000999 (patch) | |
tree | 9e24ab9b8c3015583e803c2d899588f3c99fbcae /tests | |
parent | 2cdbd0860a83e252ea3b0da27cf4d5d0e86d50d7 (diff) |
[SupplicantHal] Check HAL version before setting GCMP_256
Check SupplicantStaNetworkHal v1.2 or higher before passing
PairwiseCipher and GroupCipher of GCMP_256 down to the HAL.
These bits were added in 1.2, and enabled by default.
Causes connection error when running latest framework version
with a 1.1 or older HAL.
Bug: 153923541
Test: atest SupplicantStaNetworkHalTest
Change-Id: I67cb190a627cb64fb799bad30dc4cc461316ee42
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java | 50 |
1 files changed, 50 insertions, 0 deletions
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. */ |