summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinit Deshpande <vinitd@google.com>2016-01-06 18:07:47 -0800
committerVinit Deshpande <vinitd@google.com>2016-01-12 13:02:47 -0800
commit5ebc35f19feab2755a13cf7d5acaeff4bbc78994 (patch)
tree7f287ba79ea7281115c5d138f35796b2bf4fca46
parenta9fa44d1d9c27b0456849421dbcab921c37c2a74 (diff)
downloadandroid_frameworks_opt_net_wifi-5ebc35f19feab2755a13cf7d5acaeff4bbc78994.tar.gz
android_frameworks_opt_net_wifi-5ebc35f19feab2755a13cf7d5acaeff4bbc78994.tar.bz2
android_frameworks_opt_net_wifi-5ebc35f19feab2755a13cf7d5acaeff4bbc78994.zip
Appropriately fail EAP-SIM/AKA when SIM doesn't generate good response
This change instructs supplicant to terminate the eapol when bad reponses are obtained from call to getIccSimChallengeResponse; it ensures that the failed connections terminate early and connection times are reduced. Bug: 23703236 Change-Id: I8eb8edde7a8bb310d73d1b3cc8bc060647e2375f
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java10
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java24
2 files changed, 26 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index c2dbdfdb2..6a79587bf 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -876,6 +876,16 @@ public class WifiNative {
}
}
+ public boolean simAuthFailedResponse(int id) {
+ // should be used with type GSM-AUTH
+ return doBooleanCommand("CTRL-RSP-SIM-" + id + ":GSM-FAIL");
+ }
+
+ public boolean umtsAuthFailedResponse(int id) {
+ // should be used with type UMTS-AUTH
+ return doBooleanCommand("CTRL-RSP-SIM-" + id + ":UMTS-FAIL");
+ }
+
public boolean simIdentityResponse(int id, String response) {
synchronized (mLock) {
return doBooleanCommand("CTRL-RSP-IDENTITY-" + id + ":" + response);
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 521d70588..ced5babb0 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -10155,16 +10155,19 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
String kc = makeHex(result, 1+kc_offset, kc_len);
sb.append(":" + kc + ":" + sres);
logv("kc:" + kc + " sres:" + sres);
+
+ String response = sb.toString();
+ logv("Supplicant Response -" + response);
+ mWifiNative.simAuthResponse(requestData.networkId, "GSM-AUTH", response);
} else {
loge("bad response - " + tmResponse);
+ mWifiNative.simAuthFailedResponse(requestData.networkId);
}
}
- String response = sb.toString();
- logv("Supplicant Response -" + response);
- mWifiNative.simAuthResponse(requestData.networkId, "GSM-AUTH", response);
} else {
loge("could not get telephony manager");
+ mWifiNative.simAuthFailedResponse(requestData.networkId);
}
}
@@ -10208,6 +10211,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
}
}
+ boolean good_response = false;
if (tmResponse != null && tmResponse.length() > 4) {
byte[] result = android.util.Base64.decode(tmResponse,
android.util.Base64.DEFAULT);
@@ -10223,6 +10227,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
String ik = makeHex(result, res_len + ck_len + 4, ik_len);
sb.append(":" + ik + ":" + ck + ":" + res);
logv("ik:" + ik + "ck:" + ck + " res:" + res);
+ good_response = true;
} else if (tag == (byte) 0xdc) {
loge("synchronisation failure");
int auts_len = result[1];
@@ -10230,18 +10235,21 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
res_type = "UMTS-AUTS";
sb.append(":" + auts);
logv("auts:" + auts);
+ good_response = true;
} else {
loge("bad response - unknown tag = " + tag);
- return;
}
} else {
loge("bad response - " + tmResponse);
- return;
}
- String response = sb.toString();
- logv("Supplicant Response -" + response);
- mWifiNative.simAuthResponse(requestData.networkId, res_type, response);
+ if (good_response) {
+ String response = sb.toString();
+ if (VDBG) logv("Supplicant Response -" + response);
+ mWifiNative.simAuthResponse(requestData.networkId, res_type, response);
+ } else {
+ mWifiNative.umtsAuthFailedResponse(requestData.networkId);
+ }
}
/**