diff options
author | Jimmy Chen <jimmycmchen@google.com> | 2020-04-21 16:08:56 +0800 |
---|---|---|
committer | Jimmy Chen <jimmycmchen@google.com> | 2020-04-21 18:36:29 +0800 |
commit | 4d80bc745f6fdbd2bfd52bc8a18ba5330c4b5e4f (patch) | |
tree | d2fcb6178a87001ced5bcc66ae01d62e1952a887 /service | |
parent | e67124ed6522986876872ad83e1ade954dad06f9 (diff) |
Wifi: omit PMK cache for WPA PSK networks
PMK caching has a security vulnerability for WPA/WPA2-PSK networks and
hence we should disable PMK caching for WPA/WPA2-PSK networks.
Bug: 152931766
Test: atest FrameworksWifiTests
Change-Id: Ic84a3413b573baf6176bcea8ea7ae22068a54d8b
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java | 12 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/SupplicantStaIfaceHal.java | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java b/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java index 463881bbd..5af65d0a5 100644 --- a/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java +++ b/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java @@ -19,6 +19,7 @@ import android.annotation.NonNull; import android.hardware.wifi.supplicant.V1_0.ISupplicantStaIfaceCallback; import android.hardware.wifi.supplicant.V1_3.ISupplicantStaIfaceCallback.BssTmData; import android.net.wifi.SupplicantState; +import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.net.wifi.WifiSsid; import android.util.Log; @@ -192,10 +193,15 @@ abstract class SupplicantStaIfaceCallbackV1_3Impl extends @Override public void onPmkCacheAdded(long expirationTimeInSec, ArrayList<Byte> serializedEntry) { - int curNetworkId = mStaIfaceHal.getCurrentNetworkId(mIfaceName); - mStaIfaceHal.addPmkCacheEntry(curNetworkId, expirationTimeInSec, serializedEntry); + WifiConfiguration curConfig = mStaIfaceHal.getCurrentNetworkLocalConfig(mIfaceName); + + if (curConfig == null) return; + + if (WifiConfigurationUtil.isConfigForPskNetwork(curConfig)) return; + + mStaIfaceHal.addPmkCacheEntry(curConfig.networkId, expirationTimeInSec, serializedEntry); mStaIfaceHal.logCallback( - "onPmkCacheAdded: update pmk cache for config id " + curNetworkId); + "onPmkCacheAdded: update pmk cache for config id " + curConfig.networkId); } @Override diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java index 9d8f4eecd..4380f6ab4 100644 --- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java @@ -987,6 +987,7 @@ public class SupplicantStaIfaceHal { PmkCacheStoreData pmkData = mPmkCacheEntries.get(config.networkId); if (pmkData != null + && !WifiConfigurationUtil.isConfigForPskNetwork(config) && pmkData.expirationTimeInSec > mClock.getElapsedSinceBootMillis() / 1000) { logi("Set PMK cache for config id " + config.networkId); if (networkHandle.setPmkCache(pmkData.data)) { |