diff options
author | Hai Shalom <haishalom@google.com> | 2020-01-09 00:40:08 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-01-09 00:40:08 +0000 |
commit | c0d7e7318edaf31fd921472b0c0802457eb0c754 (patch) | |
tree | c0aabb290a56924515c82dd84bd568761d8a16e7 | |
parent | 5f3537a700d1183ede89e215b0f1ac1b80f4ff3e (diff) | |
parent | 25f89010a9807302ecfcbbcf50e067a31ea976bc (diff) |
Merge "[SAE] Add support to add SAE Authentication algorithm"
4 files changed, 38 insertions, 24 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java index 6f17af432..604641533 100644 --- a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java +++ b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java @@ -400,7 +400,6 @@ public class SupplicantStaNetworkHal { } /** Auth Algorithm */ if (config.allowedAuthAlgorithms.cardinality() != 0 - && isAuthAlgNeeded(config) && !setAuthAlg(wifiConfigurationToSupplicantAuthAlgMask( config.allowedAuthAlgorithms))) { Log.e(TAG, "failed to set AuthAlgorithm"); @@ -467,22 +466,6 @@ public class SupplicantStaNetworkHal { } /** - * Check if Auth Alg is needed to be sent by wificonfiguration object - * Supplicant internally sets auth_alg and is not needed by framework - * to set the same - */ - private boolean isAuthAlgNeeded(WifiConfiguration config) { - BitSet keyMgmtMask = config.allowedKeyManagement; - if (keyMgmtMask.get(WifiConfiguration.KeyMgmt.SAE)) { - if (mVerboseLoggingEnabled) { - Log.d(TAG, "No need to set Auth Algorithm for SAE"); - } - return false; - } - return true; - } - - /** * Read network variables from wpa_supplicant into the provided WifiEnterpriseConfig object. * * @param ssid SSID of the network. (Used for logging purposes only) @@ -865,6 +848,10 @@ public class SupplicantStaNetworkHal { case WifiConfiguration.AuthAlgorithm.LEAP: mask |= ISupplicantStaNetwork.AuthAlgMask.LEAP; break; + case WifiConfiguration.AuthAlgorithm.SAE: + mask |= android.hardware.wifi.supplicant.V1_3.ISupplicantStaNetwork.AuthAlgMask + .SAE; + break; default: throw new IllegalArgumentException( "Invalid authAlgMask bit in wificonfig: " + bit); @@ -1106,6 +1093,9 @@ public class SupplicantStaNetworkHal { mask = supplicantMaskValueToWifiConfigurationBitSet( mask, ISupplicantStaNetwork.AuthAlgMask.LEAP, bitset, WifiConfiguration.AuthAlgorithm.LEAP); + mask = supplicantMaskValueToWifiConfigurationBitSet(mask, + android.hardware.wifi.supplicant.V1_3.ISupplicantStaNetwork.AuthAlgMask + .SAE, bitset, WifiConfiguration.AuthAlgorithm.SAE); if (mask != 0) { throw new IllegalArgumentException( "invalid auth alg mask from supplicant: " + mask); @@ -1400,7 +1390,13 @@ public class SupplicantStaNetworkHal { final String methodStr = "setAuthAlg"; if (!checkISupplicantStaNetworkAndLogFailure(methodStr)) return false; try { - SupplicantStatus status = mISupplicantStaNetwork.setAuthAlg(authAlgMask); + SupplicantStatus status; + if (null != getV1_3StaNetwork()) { + /* Support for SAE Authentication algorithm requires HAL v1.3 or higher */ + status = getV1_3StaNetwork().setAuthAlg_1_3(authAlgMask); + } else { + status = mISupplicantStaNetwork.setAuthAlg(authAlgMask); + } return checkStatusAndLogFailure(status, methodStr); } catch (RemoteException e) { handleRemoteException(e, methodStr); @@ -2162,6 +2158,9 @@ public class SupplicantStaNetworkHal { synchronized (mLock) { final String methodStr = "getAuthAlg"; if (!checkISupplicantStaNetworkAndLogFailure(methodStr)) return false; + if (getV1_3StaNetwork() != null) { + return getAuthAlg_1_3(); + } try { MutableBoolean statusOk = new MutableBoolean(false); mISupplicantStaNetwork.getAuthAlg((SupplicantStatus status, @@ -2181,6 +2180,26 @@ public class SupplicantStaNetworkHal { } } + private boolean getAuthAlg_1_3() { + final String methodStr = "getAuthAlg_1_3"; + try { + MutableBoolean statusOk = new MutableBoolean(false); + getV1_3StaNetwork().getAuthAlg_1_3((SupplicantStatus status, + int authAlgMaskValue) -> { + statusOk.value = status.code == SupplicantStatusCode.SUCCESS; + if (statusOk.value) { + this.mAuthAlgMask = authAlgMaskValue; + } else { + checkStatusAndLogFailure(status, methodStr); + } + }); + return statusOk.value; + } catch (RemoteException e) { + handleRemoteException(e, methodStr); + return false; + } + } + /** See ISupplicantStaNetwork.hal for documentation */ private boolean getGroupCipher() { synchronized (mLock) { diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 794f66567..541448efe 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -1129,8 +1129,6 @@ public class WifiConfigManager { * @param configuration provided WifiConfiguration object. */ private void setDefaultsInWifiConfiguration(WifiConfiguration configuration) { - configuration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); - configuration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); configuration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java index bbd99ce02..57920ae95 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java @@ -107,7 +107,7 @@ public class WifiBackupRestoreTest extends WifiBaseTest { // Valid Value: 03 + "<byte-array name=\"AllowedProtocols\" num=\"1\">13</byte-array>" // Valid Value: 01 - + "<byte-array name=\"AllowedAuthAlgos\" num=\"1\">09</byte-array>" + + "<byte-array name=\"AllowedAuthAlgos\" num=\"1\">11</byte-array>" // Valid Value: 0f + "<byte-array name=\"AllowedGroupCiphers\" num=\"1\">8f</byte-array>" // Valid Value: 06 diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index a44d5d114..4e1f9275f 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -4925,9 +4925,6 @@ public class WifiConfigManagerTest extends WifiBaseTest { * WifiConfigManager. */ private void setDefaults(WifiConfiguration configuration) { - if (configuration.allowedAuthAlgorithms.isEmpty()) { - configuration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); - } if (configuration.allowedProtocols.isEmpty()) { configuration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); configuration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); |