summaryrefslogtreecommitdiffstats
path: root/libwifi_system
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2017-11-29 14:09:12 -0800
committerJeff Vander Stoep <jeffv@google.com>2017-11-30 12:29:51 -0800
commitbef8d2a2c61ce80062556502cac4af5f13f479e4 (patch)
treebdb1f8014b5025dacf3e475b8cf4a71801c038c6 /libwifi_system
parent1d8c2b131311fb4d8abe1c4507cfc54967f4560e (diff)
downloadandroid_frameworks_opt_net_wifi-bef8d2a2c61ce80062556502cac4af5f13f479e4.tar.gz
android_frameworks_opt_net_wifi-bef8d2a2c61ce80062556502cac4af5f13f479e4.tar.bz2
android_frameworks_opt_net_wifi-bef8d2a2c61ce80062556502cac4af5f13f479e4.zip
wifi_supplicant: deprecate entropy.bin
Wpa_supplicant's random pool is not necessary on Android. Randomness is already provided by the entropymixer service which ensures sufficient entropy is maintained across reboots. Commit b410eb1913 'Initialize /dev/urandom earlier in boot' seeds /dev/urandom with that entropy before either wpa_supplicant or hostapd are run. Bug: 34980020 Test: Use wifi and wifi tethering on Taimen. Change-Id: I5c9bde6cd1de14ff56d68f5e03c5b102a6b052ff
Diffstat (limited to 'libwifi_system')
-rw-r--r--libwifi_system/hostapd_manager.cpp4
-rw-r--r--libwifi_system/supplicant_manager.cpp48
2 files changed, 0 insertions, 52 deletions
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp
index 658eecdd8..8c7de320b 100644
--- a/libwifi_system/hostapd_manager.cpp
+++ b/libwifi_system/hostapd_manager.cpp
@@ -78,10 +78,6 @@ string GeneratePsk(const vector<uint8_t>& ssid,
} // namespace
bool HostapdManager::StartHostapd() {
- if (!SupplicantManager::EnsureEntropyFileExists()) {
- LOG(WARNING) << "Wi-Fi entropy file was not created";
- }
-
if (property_set("ctl.start", kHostapdServiceName) != 0) {
LOG(ERROR) << "Failed to start SoftAP";
return false;
diff --git a/libwifi_system/supplicant_manager.cpp b/libwifi_system/supplicant_manager.cpp
index 28010ec8d..be0c33a8a 100644
--- a/libwifi_system/supplicant_manager.cpp
+++ b/libwifi_system/supplicant_manager.cpp
@@ -40,12 +40,6 @@ const char kP2pConfigFile[] = "/data/misc/wifi/p2p_supplicant.conf";
const char kSupplicantServiceName[] = "wpa_supplicant";
constexpr mode_t kConfigFileMode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
-const char kWiFiEntropyFile[] = "/data/misc/wifi/entropy.bin";
-
-const unsigned char kDummyKey[21] = {0x02, 0x11, 0xbe, 0x33, 0x43, 0x35, 0x68,
- 0x47, 0x84, 0x99, 0xa9, 0x2b, 0x1c, 0xd3,
- 0xee, 0xff, 0xf1, 0xe2, 0xf3, 0xf4, 0xf5};
-
int ensure_config_file_exists(const char* config_file) {
char buf[2048];
int srcfd, destfd;
@@ -152,10 +146,6 @@ bool SupplicantManager::StartSupplicant() {
*/
(void)ensure_config_file_exists(kP2pConfigFile);
- if (!EnsureEntropyFileExists()) {
- LOG(ERROR) << "Wi-Fi entropy file was not created";
- }
-
/*
* Get a reference to the status property, so we can distinguish
* the case where it goes stopped => running => stopped (i.e.,
@@ -225,43 +215,5 @@ bool SupplicantManager::IsSupplicantRunning() {
return false; // Failed to read service status from init.
}
-bool SupplicantManager::EnsureEntropyFileExists() {
- int ret;
- int destfd;
-
- ret = access(kWiFiEntropyFile, R_OK | W_OK);
- if ((ret == 0) || (errno == EACCES)) {
- if ((ret != 0) &&
- (chmod(kWiFiEntropyFile, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) != 0)) {
- PLOG(ERROR) << "Cannot set RW to " << kWiFiEntropyFile;
- return false;
- }
- return true;
- }
- destfd = TEMP_FAILURE_RETRY(open(kWiFiEntropyFile, O_CREAT | O_RDWR, 0660));
- if (destfd < 0) {
- PLOG(ERROR) << "Cannot create " << kWiFiEntropyFile;
- return false;
- }
-
- if (TEMP_FAILURE_RETRY(write(destfd, kDummyKey, sizeof(kDummyKey))) !=
- sizeof(kDummyKey)) {
- PLOG(ERROR) << "Error writing " << kWiFiEntropyFile;
- close(destfd);
- return false;
- }
- close(destfd);
-
- /* chmod is needed because open() didn't set permisions properly */
- if (chmod(kWiFiEntropyFile, 0660) < 0) {
- PLOG(ERROR) << "Error changing permissions of " << kWiFiEntropyFile
- << " to 0600 ";
- unlink(kWiFiEntropyFile);
- return false;
- }
-
- return true;
-}
-
} // namespace wifi_system
} // namespace android