From 8eae094c26325ebd9c2f301e43f6a6a18a89227b Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sun, 20 Aug 2023 15:53:56 +0200 Subject: [PATCH] hci: handle encryption change with error -> trigger emit security level_0 (classic only) --- src/hci.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/hci.c b/src/hci.c index fa5659460..1e5e26145 100644 --- a/src/hci.c +++ b/src/hci.c @@ -3949,14 +3949,18 @@ static void event_handler(uint8_t *packet, uint16_t size){ conn->authentication_flags &= ~AUTH_FLAG_CONNECTION_ENCRYPTED; } } else { - uint8_t status = hci_event_encryption_change_get_status(packet); - if ((conn->bonding_flags & BONDING_DEDICATED) != 0){ - conn->bonding_flags &= ~BONDING_DEDICATED; - conn->bonding_flags |= BONDING_DISCONNECT_DEDICATED_DONE; - conn->bonding_status = status; +#ifdef ENABLE_CLASSIC + if (!hci_is_le_connection(conn)){ + uint8_t status = hci_event_encryption_change_get_status(packet); + if ((conn->bonding_flags & BONDING_DEDICATED) != 0){ + conn->bonding_flags &= ~BONDING_DEDICATED; + conn->bonding_flags |= BONDING_DISCONNECT_DEDICATED_DONE; + conn->bonding_status = status; + } + // trigger security update -> level 0 + hci_handle_mutual_authentication_completed(conn); } - // trigger security update -> level 0 - hci_handle_mutual_authentication_completed(conn); +#endif } break;