summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2019-04-16 15:52:58 -0700
committerHai Shalom <haishalom@google.com>2019-04-16 15:52:58 -0700
commit36ded65ee26a3c8a98d4b8ab83abb24d602d7877 (patch)
treeb76b2aecd4063419a11031492f5b01335031da79 /service
parent61921914067247b79e439fdf4ea0f73f7ad618b0 (diff)
[WifiKeyStore] Check needKeyStore before requesting keyStore service
Fix crash in WifiKeyStore#updateNetworkKeys casued when calling keyStore API when there are no stored keys. Such do not exist for non-TLS connections. Bug: 130386682 Test: Add WPA3-Enterprise with PWD, confirm no crash Test: Add WPA3-Enterprise with RSA 3072 cert, confirm connection Change-Id: I6bd5b199121d248bbadb281956a800115d6af409
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiKeyStore.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/service/java/com/android/server/wifi/WifiKeyStore.java b/service/java/com/android/server/wifi/WifiKeyStore.java
index a22be9b51..c1706a20d 100644
--- a/service/java/com/android/server/wifi/WifiKeyStore.java
+++ b/service/java/com/android/server/wifi/WifiKeyStore.java
@@ -278,22 +278,24 @@ public class WifiKeyStore {
*/
public boolean updateNetworkKeys(WifiConfiguration config, WifiConfiguration existingConfig) {
WifiEnterpriseConfig enterpriseConfig = config.enterpriseConfig;
- if (needsKeyStore(enterpriseConfig)) {
- try {
- /* config passed may include only fields being updated.
- * In order to generate the key id, fetch uninitialized
- * fields from the currently tracked configuration
- */
- String keyId = config.getKeyIdForCredentials(existingConfig);
- if (!installKeys(existingConfig != null
- ? existingConfig.enterpriseConfig : null, enterpriseConfig, keyId)) {
- Log.e(TAG, config.SSID + ": failed to install keys");
- return false;
- }
- } catch (IllegalStateException e) {
- Log.e(TAG, config.SSID + " invalid config for key installation: " + e.getMessage());
+ if (!needsKeyStore(enterpriseConfig)) {
+ return true;
+ }
+
+ try {
+ /* config passed may include only fields being updated.
+ * In order to generate the key id, fetch uninitialized
+ * fields from the currently tracked configuration
+ */
+ String keyId = config.getKeyIdForCredentials(existingConfig);
+ if (!installKeys(existingConfig != null
+ ? existingConfig.enterpriseConfig : null, enterpriseConfig, keyId)) {
+ Log.e(TAG, config.SSID + ": failed to install keys");
return false;
}
+ } catch (IllegalStateException e) {
+ Log.e(TAG, config.SSID + " invalid config for key installation: " + e.getMessage());
+ return false;
}
// For WPA3-Enterprise 192-bit networks, set the SuiteBCipher field based on the