hci: encryption_key_type tracks link key of current encryption

This commit is contained in:
Matthias Ringwald 2025-01-22 19:41:07 +01:00
parent e7055fc405
commit d2c5cd2f1f

View File

@ -4168,9 +4168,6 @@ static void event_handler(uint8_t *packet, uint16_t size){
#ifdef ENABLE_CLASSIC
else {
// Encryption has been enabled with link key stored in connection, track link key type
conn->encryption_key_type = conn->link_key_type;
// Detect Secure Connection -> Legacy Connection Downgrade Attack (BIAS)
bool sc_used_during_pairing = gap_secure_connection_for_link_key_type(conn->encryption_key_type);
bool connected_uses_aes_ccm = encryption_enabled == 2;
@ -4197,6 +4194,9 @@ static void event_handler(uint8_t *packet, uint16_t size){
#endif
}
// Encryption has been enabled with link key stored in connection, track link key type
conn->encryption_key_type = conn->link_key_type;
#ifdef ENABLE_MUTUAL_AUTHENTICATION_FOR_LEGACY_SECURE_CONNECTIONS
// if AES-CCM is used, authentication used SC -> authentication was mutual and we can skip explicit authentication
if (connected_uses_aes_ccm){