wifi_supplicant: deprecate entropy.bin
am: bef8d2a2c6

Change-Id: I95fc824d2e5b8040b69dd4772ac29611a6d2436a
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp
index 658eecd..8c7de32 100644
--- a/libwifi_system/hostapd_manager.cpp
+++ b/libwifi_system/hostapd_manager.cpp
@@ -78,10 +78,6 @@
 }  // 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 28010ec..be0c33a 100644
--- a/libwifi_system/supplicant_manager.cpp
+++ b/libwifi_system/supplicant_manager.cpp
@@ -40,12 +40,6 @@
 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 @@
    */
   (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 @@
   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