diff options
author | Hai Shalom <haishalom@google.com> | 2019-05-13 15:26:32 -0700 |
---|---|---|
committer | Hai Shalom <haishalom@google.com> | 2019-05-13 20:55:53 -0700 |
commit | b788af3376c4b676795f04c0092d139780c664a9 (patch) | |
tree | fdbfafff9371600cd21488a4054f481b757b32d8 | |
parent | b70a500802ff55d13c71f7431e0c32d0220e9d04 (diff) |
[OWE] Support OWE in transition mode
Support OWE in transition mode for devices with OWE support
and devices without OWE support. Scan results will return a
new type of network for OWE in transition networks on devices
that support OWE, and Open for devices that don't support OWE.
Handle the case where Open network is manually added to a device
that supports OWE.
Bug: 132139642
Test: Device with OWE: Connect to Open, OWE-Transition, OWE networks
Test: Device without OWE: Connect to Open, OWE-Transition
Test: Manually create Open network, connect to OWE-Transition
Change-Id: Idd5ea56ec7970e58ff0555001411b53454ffeb27
4 files changed, 29 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/ScanResultMatchInfo.java b/service/java/com/android/server/wifi/ScanResultMatchInfo.java index 5eb9d4d64..b3d10cc38 100644 --- a/service/java/com/android/server/wifi/ScanResultMatchInfo.java +++ b/service/java/com/android/server/wifi/ScanResultMatchInfo.java @@ -38,6 +38,10 @@ public class ScanResultMatchInfo { * Special flag for PSK-SAE in transition mode */ public boolean pskSaeInTransitionMode; + /** + * Special flag for OWE in transition mode + */ + public boolean oweInTransitionMode; /** * Fetch network type from network configuration. @@ -105,12 +109,16 @@ public class ScanResultMatchInfo { // either have a hex string or quoted ASCII string SSID. info.networkSsid = ScanResultUtil.createQuotedSSID(scanResult.SSID); info.networkType = getNetworkType(scanResult); + info.oweInTransitionMode = false; + info.pskSaeInTransitionMode = false; if (info.networkType == WifiConfiguration.SECURITY_TYPE_SAE) { // Note that scan result util will always choose the highest security protocol. info.pskSaeInTransitionMode = ScanResultUtil.isScanResultForPskSaeTransitionNetwork(scanResult); - } else { - info.pskSaeInTransitionMode = false; + } else if (info.networkType == WifiConfiguration.SECURITY_TYPE_OWE) { + // Note that scan result util will always choose OWE. + info.oweInTransitionMode = + ScanResultUtil.isScanResultForOweTransitionNetwork(scanResult); } return info; } @@ -133,6 +141,12 @@ public class ScanResultMatchInfo { || (pskSaeInTransitionMode && other.networkType == WifiConfiguration.SECURITY_TYPE_PSK)) { networkTypeEquals = true; + } else if ((networkType == WifiConfiguration.SECURITY_TYPE_OPEN + && other.oweInTransitionMode) || (oweInTransitionMode + && other.networkType == WifiConfiguration.SECURITY_TYPE_OPEN)) { + // Special case we treat Enhanced Open and Open as equals. This is done to support the + // case where a saved network is Open but we found an OWE in transition network. + networkTypeEquals = true; } else { networkTypeEquals = networkType == other.networkType; } diff --git a/service/java/com/android/server/wifi/util/InformationElementUtil.java b/service/java/com/android/server/wifi/util/InformationElementUtil.java index 994cd2d65..03a3c18f0 100644 --- a/service/java/com/android/server/wifi/util/InformationElementUtil.java +++ b/service/java/com/android/server/wifi/util/InformationElementUtil.java @@ -713,7 +713,7 @@ public class InformationElementUtil { owePairwiseCipher.add(ScanResult.CIPHER_CCMP); pairwiseCipher.add(owePairwiseCipher); ArrayList<Integer> oweKeyManagement = new ArrayList<>(); - oweKeyManagement.add(ScanResult.KEY_MGMT_OWE); + oweKeyManagement.add(ScanResult.KEY_MGMT_OWE_TRANSITION); keyManagement.add(oweKeyManagement); } } @@ -731,7 +731,6 @@ public class InformationElementUtil { } } - private String protocolToString(int protocol) { switch (protocol) { case ScanResult.PROTOCOL_NONE: @@ -763,6 +762,8 @@ public class InformationElementUtil { return "PSK-SHA256"; case ScanResult.KEY_MGMT_OWE: return "OWE"; + case ScanResult.KEY_MGMT_OWE_TRANSITION: + return "OWE_TRANSITION"; case ScanResult.KEY_MGMT_SAE: return "SAE"; case ScanResult.KEY_MGMT_FT_SAE: diff --git a/service/java/com/android/server/wifi/util/ScanResultUtil.java b/service/java/com/android/server/wifi/util/ScanResultUtil.java index a9da3e454..39e9d2c40 100644 --- a/service/java/com/android/server/wifi/util/ScanResultUtil.java +++ b/service/java/com/android/server/wifi/util/ScanResultUtil.java @@ -87,6 +87,14 @@ public class ScanResultUtil { } /** + * Helper method to check if the provided |scanResult| corresponds to OWE transition network. + * This checks if the provided capabilities string contains OWE_TRANSITION or not. + */ + public static boolean isScanResultForOweTransitionNetwork(ScanResult scanResult) { + return scanResult.capabilities.contains("OWE_TRANSITION"); + } + + /** * Helper method to check if the provided |scanResult| corresponds to SAE network. * This checks if the provided capabilities string contains SAE or not. */ @@ -96,7 +104,7 @@ public class ScanResultUtil { /** * Helper method to check if the provided |scanResult| corresponds to PSK-SAE transition - * network. This checks if the provided capabilities string contains SAE or not. + * network. This checks if the provided capabilities string contains PSK+SAE or not. */ public static boolean isScanResultForPskSaeTransitionNetwork(ScanResult scanResult) { return scanResult.capabilities.contains("PSK+SAE"); diff --git a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java index 46830f3f5..854458316 100644 --- a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java @@ -526,7 +526,7 @@ public class InformationElementUtilTest { capabilities.from(ies, beaconCap, true); String result = capabilities.generateCapabilitiesString(); - assertEquals("[RSN-OWE-CCMP][ESS]", result); + assertEquals("[RSN-OWE_TRANSITION-CCMP][ESS]", result); } /** |