aboutsummaryrefslogtreecommitdiff
path: root/btif
diff options
context:
space:
mode:
authorZach Johnson <zachoverflow@google.com>2019-11-26 14:20:26 -0800
committerZach Johnson <zachoverflow@google.com>2019-11-26 14:21:21 -0800
commitb5c1f2b624a4271e42a0efb084c1900808998343 (patch)
tree73019a41ab6f11e4657e2a8c43b8961c9f2ceb23 /btif
parent78a5f133d1cd0c5c110d25af3d2ee1214c943920 (diff)
parent69f0704ab04b65627d67676d3dc415e800ebab81 (diff)
downloadbt-b5c1f2b624a4271e42a0efb084c1900808998343.tar.gz
Merge commit '69f0704ab04b65627d67676d3dc415e800ebab81' into manual_merge_69f0704ab04b65627d67676d3dc415e800ebab81
Test: I solemnly swear I tested this conflict resolution Change-Id: Ib5181f0a1bab6bb308f6ccff6640efce83fe3e1a
Diffstat (limited to 'btif')
-rw-r--r--btif/Android.bp34
-rw-r--r--btif/src/btif_config.cc42
2 files changed, 40 insertions, 36 deletions
diff --git a/btif/Android.bp b/btif/Android.bp
index 6be1d81c7..8e55de6a3 100644
--- a/btif/Android.bp
+++ b/btif/Android.bp
@@ -24,8 +24,8 @@ btifCommonIncludes = [
"system/bt/utils/include",
"system/bt/include",
"system/libhwbinder/include",
- "system/security/keystore/include",
- "hardware/interfaces/keymaster/4.0/support/include",
+ //"system/security/keystore/include",
+ //"hardware/interfaces/keymaster/4.0/support/include",
]
// libbtif static library for target
@@ -73,7 +73,7 @@ cc_library_static {
"src/btif_hf_client.cc",
"src/btif_hh.cc",
"src/btif_hd.cc",
- "src/btif_keystore.cc",
+ //"src/btif_keystore.cc",
"src/btif_mce.cc",
"src/btif_pan.cc",
"src/btif_profile_queue.cc",
@@ -107,12 +107,12 @@ cc_library_static {
"libhidlbase",
"libutils",
"libcrypto",
- "android.hardware.keymaster@4.0",
- "android.hardware.keymaster@3.0",
- "libkeymaster4support",
- "libkeystore_aidl",
- "libkeystore_binder",
- "libkeystore_parcelables",
+ //"android.hardware.keymaster@4.0",
+ //"android.hardware.keymaster@3.0",
+ //"libkeymaster4support",
+ //"libkeystore_aidl",
+ //"libkeystore_binder",
+ //"libkeystore_parcelables",
],
whole_static_libs: [
"avrcp-target-service",
@@ -135,7 +135,7 @@ cc_test {
include_dirs: btifCommonIncludes,
srcs: [
"test/btif_storage_test.cc",
- "test/btif_keystore_test.cc"
+ //"test/btif_keystore_test.cc"
],
header_libs: ["libbluetooth_headers"],
shared_libs: [
@@ -150,13 +150,13 @@ cc_test {
"libprocessgroup",
"libutils",
"libcrypto",
- "android.hardware.keymaster@4.0",
- "android.hardware.keymaster@3.0",
- "libkeymaster4support",
- "libkeystore_aidl",
- "libkeystore_binder",
- "libkeystore_parcelables",
- "libbinder",
+ //"android.hardware.keymaster@4.0",
+ //"android.hardware.keymaster@3.0",
+ //"libkeymaster4support",
+ //"libkeystore_aidl",
+ //"libkeystore_binder",
+ //"libkeystore_parcelables",
+ //"libbinder",
],
static_libs: [
"libbt-bta",
diff --git a/btif/src/btif_config.cc b/btif/src/btif_config.cc
index be006abd4..b1af0ba8c 100644
--- a/btif/src/btif_config.cc
+++ b/btif/src/btif_config.cc
@@ -38,7 +38,7 @@
#include "btif_api.h"
#include "btif_common.h"
#include "btif_config_transcode.h"
-#include "btif_keystore.h"
+//#include "btif_keystore.h"
#include "btif_util.h"
#include "common/address_obfuscator.h"
#include "osi/include/alarm.h"
@@ -58,15 +58,15 @@
#define DISABLED "disabled"
static const char* TIME_STRING_FORMAT = "%Y-%m-%d %H:%M:%S";
-constexpr int kBufferSize = 400 * 10; // initial file is ~400B
+// constexpr int kBufferSize = 400 * 10; // initial file is ~400B
-static bool use_key_attestation() {
+/*static bool use_key_attestation() {
return getuid() == AID_BLUETOOTH && is_single_user_mode();
-}
+}*/
#define BT_CONFIG_METRICS_SECTION "Metrics"
#define BT_CONFIG_METRICS_SALT_256BIT "Salt256Bit"
-using bluetooth::BtifKeystore;
+// using bluetooth::BtifKeystore;
using bluetooth::common::AddressObfuscator;
// TODO(armansito): Find a better way than searching by a hardcoded path.
@@ -93,9 +93,10 @@ static void btif_config_remove_restricted(config_t* config);
static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename);
// Key attestation
-static std::string hash_file(const char* filename);
-static std::string read_checksum_file(const char* filename);
-static void write_checksum_file(const char* filename, const std::string& hash);
+// static std::string hash_file(const char* filename);
+// static std::string read_checksum_file(const char* filename);
+// static void write_checksum_file(const char* filename, const std::string&
+// hash);
static enum ConfigSource {
NOT_LOADED,
@@ -176,7 +177,7 @@ static std::recursive_mutex config_lock; // protects operations on |config|.
static std::unique_ptr<config_t> config;
static alarm_t* config_timer;
-static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl);
+// static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl);
// Module lifecycle functions
@@ -184,6 +185,9 @@ static future_t* init(void) {
std::unique_lock<std::recursive_mutex> lock(config_lock);
if (is_factory_reset()) delete_config_files();
+ /*if (is_factory_reset() ||
+ (use_key_attestation() && !btif_keystore.DoesKeyExist()))
+ delete_config_files();*/
std::string file_source;
@@ -262,7 +266,7 @@ error:
}
static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename) {
- // START KEY ATTESTATION
+ /*// START KEY ATTESTATION
// Get hash of current file
std::string current_hash = hash_file(filename);
// Get stored hash
@@ -278,7 +282,7 @@ static std::unique_ptr<config_t> btif_config_open(const char* filename, const ch
if (current_hash != stored_hash) {
return nullptr;
}
- // END KEY ATTESTATION
+ // END KEY ATTESTATION*/
std::unique_ptr<config_t> config = config_new(filename);
if (!config) return nullptr;
@@ -512,11 +516,11 @@ bool btif_config_clear(void) {
bool ret = config_save(*config, CONFIG_FILE_PATH);
btif_config_source = RESET;
- // Save encrypted hash
+ /*// Save encrypted hash
std::string current_hash = hash_file(CONFIG_FILE_PATH);
if (!current_hash.empty()) {
write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash);
- }
+ }*/
return ret;
}
@@ -539,11 +543,11 @@ static void btif_config_write(UNUSED_ATTR uint16_t event,
std::unique_ptr<config_t> config_paired = config_new_clone(*config);
btif_config_remove_unpaired(config_paired.get());
config_save(*config_paired, CONFIG_FILE_PATH);
- // Save hash
+ /*// Save hash
std::string current_hash = hash_file(CONFIG_FILE_PATH);
if (!current_hash.empty()) {
write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash);
- }
+ }*/
}
static void btif_config_remove_unpaired(config_t* conf) {
@@ -635,12 +639,12 @@ static bool is_factory_reset(void) {
static void delete_config_files(void) {
remove(CONFIG_FILE_PATH);
remove(CONFIG_BACKUP_PATH);
- remove(CONFIG_FILE_CHECKSUM_PATH);
- remove(CONFIG_BACKUP_CHECKSUM_PATH);
+ // remove(CONFIG_FILE_CHECKSUM_PATH);
+ // remove(CONFIG_BACKUP_CHECKSUM_PATH);
osi_property_set("persist.bluetooth.factoryreset", "false");
}
-static std::string hash_file(const char* filename) {
+/*static std::string hash_file(const char* filename) {
if (!use_key_attestation()) {
LOG(INFO) << __func__ << ": Disabled for multi-user";
return DISABLED;
@@ -696,4 +700,4 @@ static void write_checksum_file(const char* checksum_filename,
<< __func__ << ": Failed encrypting checksum";
CHECK(checksum_save(encrypted_checksum, checksum_filename))
<< __func__ << ": Failed to save checksum!";
-}
+}*/