diff options
Diffstat (limited to 'system/stack/btu/btu_hcif.cc')
-rw-r--r-- | system/stack/btu/btu_hcif.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/system/stack/btu/btu_hcif.cc b/system/stack/btu/btu_hcif.cc index 605e95e15d..c71534499d 100644 --- a/system/stack/btu/btu_hcif.cc +++ b/system/stack/btu/btu_hcif.cc @@ -918,6 +918,20 @@ static void read_encryption_key_size_complete_after_encryption_change(uint8_t st return; } + if (btm_sec_is_session_key_size_downgrade(handle, key_size)) { + LOG_ERROR( + "encryption key size lower than cached value, disconnecting. " + "handle: 0x%x attempted key size: %d", + handle, key_size); + acl_disconnect_from_handle( + handle, HCI_ERR_HOST_REJECT_SECURITY, + "stack::btu::btu_hcif::read_encryption_key_size_complete_after_" + "encryption_change Key Size Downgrade"); + return; + } + + btm_sec_update_session_key_size(handle, key_size); + // good key size - succeed btm_acl_encrypt_change(handle, static_cast<tHCI_STATUS>(status), 1 /* enable */); |