From b788af3376c4b676795f04c0092d139780c664a9 Mon Sep 17 00:00:00 2001 From: Hai Shalom Date: Mon, 13 May 2019 15:26:32 -0700 Subject: [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 --- .../com/android/server/wifi/ScanResultMatchInfo.java | 18 ++++++++++++++++-- .../server/wifi/util/InformationElementUtil.java | 5 +++-- .../com/android/server/wifi/util/ScanResultUtil.java | 10 +++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) (limited to 'service') 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 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 @@ -86,6 +86,14 @@ public class ScanResultUtil { return scanResult.capabilities.contains("OWE"); } + /** + * 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"); -- cgit v1.2.3