mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
hci: move dedicated bonding into hci_handle_mutual_authentication_completed
This commit is contained in:
parent
4aa2f135a0
commit
67718330f1
15
src/hci.c
15
src/hci.c
@ -2567,14 +2567,8 @@ static void hci_handle_mutual_authentication_completed(hci_connection_t * conn){
|
||||
conn->requested_security_level = LEVEL_0;
|
||||
gap_security_level_t security_level = gap_security_level_for_connection(conn);
|
||||
hci_emit_security_level(conn->con_handle, security_level);
|
||||
}
|
||||
|
||||
static void hci_handle_read_encryption_key_size_complete(hci_connection_t * conn, uint8_t encryption_key_size) {
|
||||
conn->authentication_flags |= AUTH_FLAG_CONNECTION_ENCRYPTED;
|
||||
conn->encryption_key_size = encryption_key_size;
|
||||
gap_security_level_t security_level = gap_security_level_for_connection(conn);
|
||||
|
||||
// trigger disconnect for dedicated bonding, skip emit security level as disconnect is pending
|
||||
// dedicated bonding
|
||||
if ((conn->bonding_flags & BONDING_DEDICATED) != 0){
|
||||
conn->bonding_flags &= ~BONDING_DEDICATED;
|
||||
conn->bonding_status = security_level == 0 ? ERROR_CODE_INSUFFICIENT_SECURITY : ERROR_CODE_SUCCESS;
|
||||
@ -2584,10 +2578,15 @@ static void hci_handle_read_encryption_key_size_complete(hci_connection_t * conn
|
||||
#else
|
||||
// request disconnect, event is emitted after disconnect
|
||||
conn->bonding_flags |= BONDING_DISCONNECT_DEDICATED_DONE;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void hci_handle_read_encryption_key_size_complete(hci_connection_t * conn, uint8_t encryption_key_size) {
|
||||
conn->authentication_flags |= AUTH_FLAG_CONNECTION_ENCRYPTED;
|
||||
conn->encryption_key_size = encryption_key_size;
|
||||
|
||||
// mutual authentication complete if authenticated and we have retrieved the encryption key size
|
||||
if ((conn->authentication_flags & AUTH_FLAG_CONNECTION_AUTHENTICATED) != 0) {
|
||||
hci_handle_mutual_authentication_completed(conn);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user