aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-11-02 03:59:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-11-02 03:59:05 +0000
commit8b91b04a5485ee927338e34cf1338608fd4e2d6d (patch)
tree5926bc32e9cc1eb6cd5792f8ca9a48c0f67fed7d
parent8f8613ead509896e0291b7462162e63f66154fec (diff)
parent915b24bc5ce75c419d41dfec59cb40bc1b568db2 (diff)
downloadbt-8b91b04a5485ee927338e34cf1338608fd4e2d6d.tar.gz
Merge "Implement Common Criteria Mode for GD"
-rw-r--r--btif/src/bluetooth.cc21
-rw-r--r--btif/src/btif_keystore.cc40
-rw-r--r--gd/os/android/parameter_provider.cc36
-rw-r--r--gd/os/bt_keystore.h25
-rw-r--r--gd/os/host/parameter_provider.cc18
-rw-r--r--gd/os/linux/parameter_provider.cc18
-rw-r--r--gd/os/parameter_provider.h14
-rw-r--r--gd/storage/config_cache.cc57
-rw-r--r--gd/storage/config_cache.h1
-rw-r--r--gd/storage/storage_module.cc27
-rw-r--r--gd/storage/storage_module.h1
-rw-r--r--include/hardware/bt_keystore.h9
-rw-r--r--main/shim/config.cc4
-rw-r--r--main/shim/config.h1
-rw-r--r--test/mock/mock_main_shim_BtifConfigInterface.cc2
15 files changed, 262 insertions, 12 deletions
diff --git a/btif/src/bluetooth.cc b/btif/src/bluetooth.cc
index 1fec5b54a..756374623 100644
--- a/btif/src/bluetooth.cc
+++ b/btif/src/bluetooth.cc
@@ -73,6 +73,7 @@
#include "common/os_utils.h"
#include "device/include/interop.h"
#include "gd/common/init_flags.h"
+#include "gd/os/parameter_provider.h"
#include "main/shim/dumpsys.h"
#include "main/shim/shim.h"
#include "osi/include/alarm.h"
@@ -178,8 +179,24 @@ static int init(bt_callbacks_t* callbacks, bool start_restricted,
set_hal_cbacks(callbacks);
restricted_mode = start_restricted;
- common_criteria_mode = is_common_criteria_mode;
- common_criteria_config_compare_result = config_compare_result;
+
+ if (bluetooth::shim::is_any_gd_enabled()) {
+ bluetooth::os::ParameterProvider::SetBtKeystoreInterface(
+ bluetooth::bluetooth_keystore::getBluetoothKeystoreInterface());
+ bluetooth::os::ParameterProvider::SetCommonCriteriaMode(
+ is_common_criteria_mode);
+ if (is_bluetooth_uid() && is_common_criteria_mode) {
+ bluetooth::os::ParameterProvider::SetCommonCriteriaConfigCompareResult(
+ config_compare_result);
+ } else {
+ bluetooth::os::ParameterProvider::SetCommonCriteriaConfigCompareResult(
+ CONFIG_COMPARE_ALL_PASS);
+ }
+ } else {
+ common_criteria_mode = is_common_criteria_mode;
+ common_criteria_config_compare_result = config_compare_result;
+ }
+
is_local_device_atv = is_atv;
stack_manager_get_interface()->init_stack();
diff --git a/btif/src/btif_keystore.cc b/btif/src/btif_keystore.cc
index dcc816b62..f9628c82f 100644
--- a/btif/src/btif_keystore.cc
+++ b/btif/src/btif_keystore.cc
@@ -16,16 +16,21 @@
/* BluetoothKeystore Interface */
-#include <btif_common.h>
-#include <btif_keystore.h>
-#include "btif_storage.h"
+#include "btif_keystore.h"
#include <base/bind.h>
#include <base/location.h>
#include <base/logging.h>
#include <hardware/bluetooth.h>
+
#include <map>
+#include "btif_common.h"
+#include "btif_storage.h"
+#include "gd/os/parameter_provider.h"
+#include "main/shim/config.h"
+#include "main/shim/shim.h"
+
using base::Bind;
using base::Unretained;
using bluetooth::bluetooth_keystore::BluetoothKeystoreCallbacks;
@@ -35,27 +40,45 @@ namespace bluetooth {
namespace bluetooth_keystore {
class BluetoothKeystoreInterfaceImpl;
std::unique_ptr<BluetoothKeystoreInterface> bluetoothKeystoreInstance;
+const int CONFIG_COMPARE_ALL_PASS = 0b11;
class BluetoothKeystoreInterfaceImpl
- : public bluetooth::bluetooth_keystore::BluetoothKeystoreInterface,
- public bluetooth::bluetooth_keystore::BluetoothKeystoreCallbacks {
+ : public bluetooth::bluetooth_keystore::BluetoothKeystoreInterface {
~BluetoothKeystoreInterfaceImpl() override = default;
void init(BluetoothKeystoreCallbacks* callbacks) override {
VLOG(2) << __func__;
this->callbacks = callbacks;
- // Get bonded devices number to get all bonded devices key.
+
+ bluetooth::os::ParameterProvider::SetCommonCriteriaConfigCompareResult(
+ CONFIG_COMPARE_ALL_PASS);
+ ConvertEncryptOrDecryptKeyIfNeeded();
+ }
+
+ void ConvertEncryptOrDecryptKeyIfNeeded() {
+ VLOG(2) << __func__;
+ if (!callbacks) {
+ LOG(INFO) << __func__ << " callback isn't ready.";
+ return;
+ }
+ if (bluetooth::shim::is_any_gd_enabled()) {
+ do_in_jni_thread(
+ FROM_HERE, base::Bind([]() {
+ shim::BtifConfigInterface::ConvertEncryptOrDecryptKeyIfNeeded();
+ }));
+ return;
+ }
do_in_jni_thread(
FROM_HERE, base::Bind([]() { btif_storage_get_num_bonded_devices(); }));
}
- void set_encrypt_key_or_remove_key(std::string prefix,
+ bool set_encrypt_key_or_remove_key(std::string prefix,
std::string decryptedString) override {
VLOG(2) << __func__ << " prefix: " << prefix;
if (!callbacks) {
LOG(WARNING) << __func__ << " callback isn't ready. prefix: " << prefix;
- return;
+ return false;
}
// Save the value into a map.
@@ -65,6 +88,7 @@ class BluetoothKeystoreInterfaceImpl
base::Bind(&bluetooth::bluetooth_keystore::BluetoothKeystoreCallbacks::
set_encrypt_key_or_remove_key,
base::Unretained(callbacks), prefix, decryptedString));
+ return true;
}
std::string get_key(std::string prefix) override {
diff --git a/gd/os/android/parameter_provider.cc b/gd/os/android/parameter_provider.cc
index dcf7c407e..0d78067c0 100644
--- a/gd/os/android/parameter_provider.cc
+++ b/gd/os/android/parameter_provider.cc
@@ -16,6 +16,9 @@
#include "os/parameter_provider.h"
+#include <private/android_filesystem_config.h>
+#include <unistd.h>
+
#include <mutex>
#include <string>
@@ -27,6 +30,9 @@ std::mutex parameter_mutex;
std::string config_file_path;
std::string snoop_log_file_path;
std::string snooz_log_file_path;
+bluetooth_keystore::BluetoothKeystoreInterface* bt_keystore_interface = nullptr;
+bool is_common_criteria_mode = false;
+int common_criteria_config_compare_result = 0b11;
} // namespace
// On Android we always write a single default location
@@ -76,5 +82,35 @@ void ParameterProvider::OverrideSnoozLogFilePath(const std::string& path) {
snooz_log_file_path = path;
}
+bluetooth_keystore::BluetoothKeystoreInterface* ParameterProvider::GetBtKeystoreInterface() {
+ std::lock_guard<std::mutex> lock(parameter_mutex);
+ return bt_keystore_interface;
+}
+
+void ParameterProvider::SetBtKeystoreInterface(bluetooth_keystore::BluetoothKeystoreInterface* bt_keystore) {
+ std::lock_guard<std::mutex> lock(parameter_mutex);
+ bt_keystore_interface = bt_keystore;
+}
+
+bool ParameterProvider::IsCommonCriteriaMode() {
+ std::lock_guard<std::mutex> lock(parameter_mutex);
+ return (getuid() == AID_BLUETOOTH) && is_common_criteria_mode;
+}
+
+void ParameterProvider::SetCommonCriteriaMode(bool enable) {
+ std::lock_guard<std::mutex> lock(parameter_mutex);
+ is_common_criteria_mode = enable;
+}
+
+int ParameterProvider::GetCommonCriteriaConfigCompareResult() {
+ std::lock_guard<std::mutex> lock(parameter_mutex);
+ return common_criteria_config_compare_result;
+}
+
+void ParameterProvider::SetCommonCriteriaConfigCompareResult(int result) {
+ std::lock_guard<std::mutex> lock(parameter_mutex);
+ common_criteria_config_compare_result = result;
+}
+
} // namespace os
} // namespace bluetooth \ No newline at end of file
diff --git a/gd/os/bt_keystore.h b/gd/os/bt_keystore.h
new file mode 100644
index 000000000..be0975009
--- /dev/null
+++ b/gd/os/bt_keystore.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <../include/hardware/bt_keystore.h>
+
+namespace bluetooth {
+namespace bluetooth_keystore {
+
+BluetoothKeystoreInterface* getBluetoothKeystoreInterface();
+
+} // namespace bluetooth_keystore
+} // namespace bluetooth \ No newline at end of file
diff --git a/gd/os/host/parameter_provider.cc b/gd/os/host/parameter_provider.cc
index 2220f940e..ef5ca4bc7 100644
--- a/gd/os/host/parameter_provider.cc
+++ b/gd/os/host/parameter_provider.cc
@@ -96,5 +96,23 @@ void ParameterProvider::OverrideSnoozLogFilePath(const std::string& path) {
snooz_log_file_path = path;
}
+bluetooth_keystore::BluetoothKeystoreInterface* ParameterProvider::GetBtKeystoreInterface() {
+ return nullptr;
+}
+
+void ParameterProvider::SetBtKeystoreInterface(bluetooth_keystore::BluetoothKeystoreInterface* bt_keystore) {}
+
+bool ParameterProvider::IsCommonCriteriaMode() {
+ return false;
+}
+
+void ParameterProvider::SetCommonCriteriaMode(bool enable) {}
+
+int ParameterProvider::GetCommonCriteriaConfigCompareResult() {
+ return 0b11;
+}
+
+void ParameterProvider::SetCommonCriteriaConfigCompareResult(int result) {}
+
} // namespace os
} // namespace bluetooth \ No newline at end of file
diff --git a/gd/os/linux/parameter_provider.cc b/gd/os/linux/parameter_provider.cc
index 4d1017598..10144ae67 100644
--- a/gd/os/linux/parameter_provider.cc
+++ b/gd/os/linux/parameter_provider.cc
@@ -76,5 +76,23 @@ std::string ParameterProvider::SnoozLogFilePath() {
return "/var/log/bluetooth/btsnooz_hci.log";
}
+bluetooth_keystore::BluetoothKeystoreInterface* ParameterProvider::GetBtKeystoreInterface() {
+ return nullptr;
+}
+
+void ParameterProvider::SetBtKeystoreInterface(bluetooth_keystore::BluetoothKeystoreInterface* bt_keystore) {}
+
+bool ParameterProvider::IsCommonCriteriaMode() {
+ return false;
+}
+
+void ParameterProvider::SetCommonCriteriaMode(bool enable) {}
+
+int ParameterProvider::GetCommonCriteriaConfigCompareResult() {
+ return 0b11;
+}
+
+void ParameterProvider::SetCommonCriteriaConfigCompareResult(int result) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/gd/os/parameter_provider.h b/gd/os/parameter_provider.h
index 72557bbd5..111391853 100644
--- a/gd/os/parameter_provider.h
+++ b/gd/os/parameter_provider.h
@@ -18,6 +18,8 @@
#include <string>
+#include "os/bt_keystore.h"
+
namespace bluetooth {
namespace os {
@@ -37,6 +39,18 @@ class ParameterProvider {
static std::string SnoozLogFilePath();
static void OverrideSnoozLogFilePath(const std::string& path);
+
+ static bluetooth_keystore::BluetoothKeystoreInterface* GetBtKeystoreInterface();
+
+ static void SetBtKeystoreInterface(bluetooth_keystore::BluetoothKeystoreInterface* bt_keystore);
+
+ static bool IsCommonCriteriaMode();
+
+ static void SetCommonCriteriaMode(bool enable);
+
+ static int GetCommonCriteriaConfigCompareResult();
+
+ static void SetCommonCriteriaConfigCompareResult(int result);
};
} // namespace os
diff --git a/gd/storage/config_cache.cc b/gd/storage/config_cache.cc
index fb897d5e8..b1dc1bd0b 100644
--- a/gd/storage/config_cache.cc
+++ b/gd/storage/config_cache.cc
@@ -21,10 +21,14 @@
#include <utility>
#include "hci/enum_helper.h"
+#include "os/parameter_provider.h"
#include "storage/mutation.h"
namespace {
+const std::unordered_set<std::string_view> kEncryptKeyNameList = {
+ "LinkKey", "LE_KEY_PENC", "LE_KEY_PID", "LE_KEY_LID", "LE_KEY_PCSRK", "LE_KEY_LENC", "LE_KEY_LCSRK"};
+
bool TrimAfterNewLine(std::string& value) {
std::string value_no_newline;
size_t newline_position = value.find_first_of('\n');
@@ -35,6 +39,10 @@ bool TrimAfterNewLine(std::string& value) {
return false;
}
+bool InEncryptKeyNameList(std::string key) {
+ return kEncryptKeyNameList.find(key) != kEncryptKeyNameList.end();
+}
+
} // namespace
namespace bluetooth {
@@ -48,6 +56,8 @@ const std::unordered_set<std::string_view> kClassicPropertyNames = {
const std::string ConfigCache::kDefaultSectionName = "Global";
+std::string kEncryptedStr = "encrypted";
+
ConfigCache::ConfigCache(size_t temp_device_capacity, std::unordered_set<std::string_view> persistent_property_names)
: persistent_property_names_(std::move(persistent_property_names)),
information_sections_(),
@@ -147,7 +157,11 @@ std::optional<std::string> ConfigCache::GetProperty(const std::string& section,
if (section_iter != persistent_devices_.end()) {
auto property_iter = section_iter->second.find(property);
if (property_iter != section_iter->second.end()) {
- return property_iter->second;
+ std::string value = property_iter->second;
+ if (os::ParameterProvider::GetBtKeystoreInterface() != nullptr && value == kEncryptedStr) {
+ return os::ParameterProvider::GetBtKeystoreInterface()->get_key(section + "-" + property);
+ }
+ return value;
}
}
section_iter = temporary_devices_.find(section);
@@ -187,6 +201,14 @@ void ConfigCache::SetProperty(std::string section, std::string property, std::st
}
}
if (section_iter != persistent_devices_.end()) {
+ bool is_encrypted = value == kEncryptedStr;
+ if ((!value.empty()) && os::ParameterProvider::GetBtKeystoreInterface() != nullptr &&
+ os::ParameterProvider::IsCommonCriteriaMode() && InEncryptKeyNameList(property) && !is_encrypted) {
+ if (os::ParameterProvider::GetBtKeystoreInterface()->set_encrypt_key_or_remove_key(
+ section + "-" + property, value)) {
+ value = kEncryptedStr;
+ }
+ }
section_iter->second.insert_or_assign(property, std::move(value));
PersistentConfigChangedCallback();
return;
@@ -239,6 +261,10 @@ bool ConfigCache::RemoveProperty(const std::string& section, const std::string&
}
if (value.has_value()) {
PersistentConfigChangedCallback();
+ if (os::ParameterProvider::GetBtKeystoreInterface() != nullptr && os::ParameterProvider::IsCommonCriteriaMode() &&
+ InEncryptKeyNameList(property)) {
+ os::ParameterProvider::GetBtKeystoreInterface()->set_encrypt_key_or_remove_key(section + "-" + property, "");
+ }
return true;
} else {
return false;
@@ -255,6 +281,35 @@ bool ConfigCache::RemoveProperty(const std::string& section, const std::string&
return false;
}
+void ConfigCache::ConvertEncryptOrDecryptKeyIfNeeded() {
+ std::lock_guard<std::recursive_mutex> lock(mutex_);
+ LOG_INFO("%s", __func__);
+ auto persistent_sections = GetPersistentSections();
+ for (const auto& section : persistent_sections) {
+ auto section_iter = persistent_devices_.find(section);
+ for (const auto& property : kEncryptKeyNameList) {
+ auto property_iter = section_iter->second.find(std::string(property));
+ if (property_iter != section_iter->second.end()) {
+ bool is_encrypted = property_iter->second == kEncryptedStr;
+ if ((!property_iter->second.empty()) && os::ParameterProvider::GetBtKeystoreInterface() != nullptr &&
+ os::ParameterProvider::IsCommonCriteriaMode() && !is_encrypted) {
+ if (os::ParameterProvider::GetBtKeystoreInterface()->set_encrypt_key_or_remove_key(
+ section + "-" + std::string(property), property_iter->second)) {
+ SetProperty(section, std::string(property), kEncryptedStr);
+ }
+ }
+ if (os::ParameterProvider::GetBtKeystoreInterface() != nullptr && is_encrypted) {
+ std::string value_str =
+ os::ParameterProvider::GetBtKeystoreInterface()->get_key(section + "-" + std::string(property));
+ if (!os::ParameterProvider::IsCommonCriteriaMode()) {
+ SetProperty(section, std::string(property), value_str);
+ }
+ }
+ }
+ }
+ }
+}
+
bool ConfigCache::IsDeviceSection(const std::string& section) {
return hci::Address::IsValidAddress(section);
}
diff --git a/gd/storage/config_cache.h b/gd/storage/config_cache.h
index 0d83b4125..f0e1fe456 100644
--- a/gd/storage/config_cache.h
+++ b/gd/storage/config_cache.h
@@ -100,6 +100,7 @@ class ConfigCache {
virtual void SetProperty(std::string section, std::string property, std::string value);
virtual bool RemoveSection(const std::string& section);
virtual bool RemoveProperty(const std::string& section, const std::string& property);
+ virtual void ConvertEncryptOrDecryptKeyIfNeeded();
// TODO: have a systematic way of doing this instead of specialized methods
// Remove sections with |property| set
virtual void RemoveSectionWithProperty(const std::string& property);
diff --git a/gd/storage/storage_module.cc b/gd/storage/storage_module.cc
index c7ef38346..7d737cacb 100644
--- a/gd/storage/storage_module.cc
+++ b/gd/storage/storage_module.cc
@@ -49,6 +49,11 @@ static const std::chrono::milliseconds kDefaultConfigSaveDelay = std::chrono::mi
// The config saving delay must be bigger than this value to avoid overwhelming the disk
static const std::chrono::milliseconds kMinConfigSaveDelay = std::chrono::milliseconds(20);
+const int kConfigFileComparePass = 1;
+const int kConfigBackupComparePass = 2;
+const std::string kConfigFilePrefix = "bt_config-origin";
+const std::string kConfigFileHash = "hash";
+
const std::string StorageModule::kInfoSection = "Info";
const std::string StorageModule::kFileSourceProperty = "FileSource";
const std::string StorageModule::kTimeCreatedProperty = "TimeCreated";
@@ -134,6 +139,12 @@ void StorageModule::SaveImmediately() {
ASSERT(LegacyConfigFile::FromPath(config_file_path_).Write(pimpl_->cache_));
// 3. now write back up to disk as well
ASSERT(LegacyConfigFile::FromPath(config_backup_path_).Write(pimpl_->cache_));
+ // 4. save checksum if it is running in common criteria mode
+ if (bluetooth::os::ParameterProvider::GetBtKeystoreInterface() != nullptr &&
+ bluetooth::os::ParameterProvider::IsCommonCriteriaMode()) {
+ bluetooth::os::ParameterProvider::GetBtKeystoreInterface()->set_encrypt_key_or_remove_key(
+ kConfigFilePrefix, kConfigFileHash);
+ }
}
void StorageModule::ListDependencies(ModuleList* list) const {
@@ -147,6 +158,12 @@ void StorageModule::Start() {
LegacyConfigFile::FromPath(config_file_path_).Delete();
LegacyConfigFile::FromPath(config_backup_path_).Delete();
}
+ if (!is_config_checksum_pass(kConfigFileComparePass)) {
+ LegacyConfigFile::FromPath(config_file_path_).Delete();
+ }
+ if (!is_config_checksum_pass(kConfigBackupComparePass)) {
+ LegacyConfigFile::FromPath(config_backup_path_).Delete();
+ }
auto config = LegacyConfigFile::FromPath(config_file_path_).Read(temp_devices_capacity_);
if (!config || !config->HasSection(kAdapterSection)) {
LOG_WARN("cannot load config at %s, using backup at %s.", config_file_path_.c_str(), config_backup_path_.c_str());
@@ -179,11 +196,17 @@ void StorageModule::Start() {
// TODO (b/158035889) Migrate metrics module to GD
pimpl_ = std::make_unique<impl>(GetHandler(), std::move(config.value()), temp_devices_capacity_);
SaveDelayed();
+ if (bluetooth::os::ParameterProvider::GetBtKeystoreInterface() != nullptr) {
+ bluetooth::os::ParameterProvider::GetBtKeystoreInterface()->ConvertEncryptOrDecryptKeyIfNeeded();
+ }
}
void StorageModule::Stop() {
std::lock_guard<std::recursive_mutex> lock(mutex_);
SaveImmediately();
+ if (bluetooth::os::ParameterProvider::GetBtKeystoreInterface() != nullptr) {
+ bluetooth::os::ParameterProvider::GetBtKeystoreInterface()->clear_map();
+ }
pimpl_.reset();
}
@@ -234,5 +257,9 @@ std::vector<Device> StorageModule::GetBondedDevices() {
return result;
}
+bool StorageModule::is_config_checksum_pass(int check_bit) {
+ return ((os::ParameterProvider::GetCommonCriteriaConfigCompareResult() & check_bit) == check_bit);
+}
+
} // namespace storage
} // namespace bluetooth
diff --git a/gd/storage/storage_module.h b/gd/storage/storage_module.h
index 349179633..8853a4e76 100644
--- a/gd/storage/storage_module.h
+++ b/gd/storage/storage_module.h
@@ -145,6 +145,7 @@ class StorageModule : public bluetooth::Module {
size_t temp_devices_capacity_;
bool is_restricted_mode_;
bool is_single_user_mode_;
+ static bool is_config_checksum_pass(int check_bit);
DISALLOW_COPY_AND_ASSIGN(StorageModule);
};
diff --git a/include/hardware/bt_keystore.h b/include/hardware/bt_keystore.h
index 5442c980f..186334dd4 100644
--- a/include/hardware/bt_keystore.h
+++ b/include/hardware/bt_keystore.h
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+#pragma once
+
+#include "string"
+
namespace bluetooth {
namespace bluetooth_keystore {
@@ -36,8 +40,11 @@ class BluetoothKeystoreInterface {
/** Register the bluetooth keystore callbacks */
virtual void init(BluetoothKeystoreCallbacks* callbacks) = 0;
+ /** Get bonded devices number to get all bonded devices key */
+ virtual void ConvertEncryptOrDecryptKeyIfNeeded() = 0;
+
/** Interface for key encrypt or remove key */
- virtual void set_encrypt_key_or_remove_key(std::string prefix,
+ virtual bool set_encrypt_key_or_remove_key(std::string prefix,
std::string encryptedString) = 0;
/** Interface for get key. */
diff --git a/main/shim/config.cc b/main/shim/config.cc
index a2ee4adf0..732d022a6 100644
--- a/main/shim/config.cc
+++ b/main/shim/config.cc
@@ -156,6 +156,10 @@ std::vector<std::string> BtifConfigInterface::GetPersistentDevices() {
return GetStorage()->GetConfigCache()->GetPersistentSections();
}
+void BtifConfigInterface::ConvertEncryptOrDecryptKeyIfNeeded() {
+ GetStorage()->GetConfigCache()->ConvertEncryptOrDecryptKeyIfNeeded();
+}
+
void BtifConfigInterface::Save() { GetStorage()->SaveDelayed(); }
void BtifConfigInterface::Flush() { GetStorage()->SaveImmediately(); }
diff --git a/main/shim/config.h b/main/shim/config.h
index 6402bbf74..b6b223cbe 100644
--- a/main/shim/config.h
+++ b/main/shim/config.h
@@ -53,6 +53,7 @@ class BtifConfigInterface {
static bool RemoveProperty(const std::string& section,
const std::string& key);
static std::vector<std::string> GetPersistentDevices();
+ static void ConvertEncryptOrDecryptKeyIfNeeded();
static void Save();
static void Flush();
static void Clear();
diff --git a/test/mock/mock_main_shim_BtifConfigInterface.cc b/test/mock/mock_main_shim_BtifConfigInterface.cc
index 1981aef8b..7198d178c 100644
--- a/test/mock/mock_main_shim_BtifConfigInterface.cc
+++ b/test/mock/mock_main_shim_BtifConfigInterface.cc
@@ -85,6 +85,8 @@ std::vector<std::string>
bluetooth::shim::BtifConfigInterface::GetPersistentDevices() {
return std::vector<std::string>();
}
+void bluetooth::shim::BtifConfigInterface::
+ ConvertEncryptOrDecryptKeyIfNeeded(){};
void bluetooth::shim::BtifConfigInterface::Save(){};
void bluetooth::shim::BtifConfigInterface::Flush(){};
void bluetooth::shim::BtifConfigInterface::Clear(){};