diff --git a/src/hci.c b/src/hci.c index d5da6ffd2..eff8d787b 100644 --- a/src/hci.c +++ b/src/hci.c @@ -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){