Loading system/btif/include/btif_keystore.h +8 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,14 @@ class BtifKeystore { */ std::string Decrypt(const std::string& input_filename); /** * Check for existence of keystore key. * * This key can be cleared if a user manually wipes bluetooth storage data * b/133214365 */ bool DoesKeyExist(); private: std::unique_ptr<keystore::KeystoreClient> keystore_client_; std::mutex api_mutex_; Loading system/btif/src/btif_config.cc +3 −1 Original line number Diff line number Diff line Loading @@ -183,7 +183,9 @@ static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); 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; Loading system/btif/src/btif_keystore.cc +4 −0 Original line number Diff line number Diff line Loading @@ -98,4 +98,8 @@ KeyStoreNativeReturnCode BtifKeystore::GenerateKey(const std::string& name, &software_enforced_characteristics); } bool BtifKeystore::DoesKeyExist() { return keystore_client_->doesKeyExist(kKeyStore); } } // namespace bluetooth system/stack/btu/btu_hcif.cc +16 −0 Original line number Diff line number Diff line Loading @@ -1131,6 +1131,14 @@ constexpr uint8_t MIN_KEY_SIZE = 7; static void read_encryption_key_size_complete_after_encryption_change(uint8_t status, uint16_t handle, uint8_t key_size) { if (status == HCI_ERR_INSUFFCIENT_SECURITY) { /* If remote device stop the encryption before we call "Read Encryption Key * Size", we might receive Insufficient Security, which means that link is * no longer encrypted. */ LOG(INFO) << __func__ << ": encryption stopped on link: " << loghex(handle); return; } if (status != HCI_SUCCESS) { LOG(INFO) << __func__ << ": disconnecting, status: " << loghex(status); btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER); Loading Loading @@ -2051,6 +2059,14 @@ static void btu_hcif_enhanced_flush_complete_evt(void) { **********************************************/ static void read_encryption_key_size_complete_after_key_refresh(uint8_t status, uint16_t handle, uint8_t key_size) { if (status == HCI_ERR_INSUFFCIENT_SECURITY) { /* If remote device stop the encryption before we call "Read Encryption Key * Size", we might receive Insufficient Security, which means that link is * no longer encrypted. */ LOG(INFO) << __func__ << ": encryption stopped on link: " << loghex(handle); return; } if (status != HCI_SUCCESS) { LOG(INFO) << __func__ << ": disconnecting, status: " << loghex(status); btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER); Loading Loading
system/btif/include/btif_keystore.h +8 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,14 @@ class BtifKeystore { */ std::string Decrypt(const std::string& input_filename); /** * Check for existence of keystore key. * * This key can be cleared if a user manually wipes bluetooth storage data * b/133214365 */ bool DoesKeyExist(); private: std::unique_ptr<keystore::KeystoreClient> keystore_client_; std::mutex api_mutex_; Loading
system/btif/src/btif_config.cc +3 −1 Original line number Diff line number Diff line Loading @@ -183,7 +183,9 @@ static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); 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; Loading
system/btif/src/btif_keystore.cc +4 −0 Original line number Diff line number Diff line Loading @@ -98,4 +98,8 @@ KeyStoreNativeReturnCode BtifKeystore::GenerateKey(const std::string& name, &software_enforced_characteristics); } bool BtifKeystore::DoesKeyExist() { return keystore_client_->doesKeyExist(kKeyStore); } } // namespace bluetooth
system/stack/btu/btu_hcif.cc +16 −0 Original line number Diff line number Diff line Loading @@ -1131,6 +1131,14 @@ constexpr uint8_t MIN_KEY_SIZE = 7; static void read_encryption_key_size_complete_after_encryption_change(uint8_t status, uint16_t handle, uint8_t key_size) { if (status == HCI_ERR_INSUFFCIENT_SECURITY) { /* If remote device stop the encryption before we call "Read Encryption Key * Size", we might receive Insufficient Security, which means that link is * no longer encrypted. */ LOG(INFO) << __func__ << ": encryption stopped on link: " << loghex(handle); return; } if (status != HCI_SUCCESS) { LOG(INFO) << __func__ << ": disconnecting, status: " << loghex(status); btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER); Loading Loading @@ -2051,6 +2059,14 @@ static void btu_hcif_enhanced_flush_complete_evt(void) { **********************************************/ static void read_encryption_key_size_complete_after_key_refresh(uint8_t status, uint16_t handle, uint8_t key_size) { if (status == HCI_ERR_INSUFFCIENT_SECURITY) { /* If remote device stop the encryption before we call "Read Encryption Key * Size", we might receive Insufficient Security, which means that link is * no longer encrypted. */ LOG(INFO) << __func__ << ": encryption stopped on link: " << loghex(handle); return; } if (status != HCI_SUCCESS) { LOG(INFO) << __func__ << ": disconnecting, status: " << loghex(status); btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER); Loading