mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 06:39:53 +00:00
hci: only send HCI Read Local Encryption Key Size if supported by Controller
This commit is contained in:
parent
7a4d61a383
commit
6e058d3f51
@ -18,11 +18,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- GAP: fixed gap_set_scan_parameters() if issued right before gap_start_scan()
|
- GAP: fixed gap_set_scan_parameters() if issued right before gap_start_scan()
|
||||||
|
- HCI: only send HCI Read Local Encryption Key Size if supported by Controller
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
GATT Client: allow to register for any notification/indication and/or any connection
|
- GATT Client: allow to register for any notification/indication and/or any connection
|
||||||
hci_cmd: added hci_read_inquiry_scan_activity and hci_write_inquiry_scan_activity
|
hci_cmd: added hci_read_inquiry_scan_activity and hci_write_inquiry_scan_activity
|
||||||
chipset: assert hci packet buffers are suitable for firmware upload or patches (atwilc3000,bcm,cc256x,intel)
|
- chipset: assert hci packet buffers are suitable for firmware upload or patches (atwilc3000,bcm,cc256x,intel)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- AVRCP Target: volume in avrcp_target_volume_changed is reported as current value in interim response to register for volume change notifications
|
- AVRCP Target: volume in avrcp_target_volume_changed is reported as current value in interim response to register for volume change notifications
|
||||||
|
17
src/hci.c
17
src/hci.c
@ -2022,8 +2022,9 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
(packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+18] & 0x08) | // bit 3 = Octet 18, bit 3 / Write Default Erroneous Data Reporting
|
(packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+18] & 0x08) | // bit 3 = Octet 18, bit 3 / Write Default Erroneous Data Reporting
|
||||||
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+34] & 0x01) << 4) | // bit 4 = Octet 34, bit 0 / LE Write Suggested Default Data Length
|
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+34] & 0x01) << 4) | // bit 4 = Octet 34, bit 0 / LE Write Suggested Default Data Length
|
||||||
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+35] & 0x08) << 2) | // bit 5 = Octet 35, bit 3 / LE Read Maximum Data Length
|
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+35] & 0x08) << 2) | // bit 5 = Octet 35, bit 3 / LE Read Maximum Data Length
|
||||||
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+35] & 0x20) << 1); // bit 6 = Octet 35, bit 5 / LE Set Default PHY
|
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+35] & 0x20) << 1) | // bit 6 = Octet 35, bit 5 / LE Set Default PHY
|
||||||
log_info("Local supported commands summary 0x%02x", hci_stack->local_supported_commands[0]);
|
((packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1+20] & 0x10) << 3); // bit 7 = Octet 20, bit 4 / Read Encryption Key Size
|
||||||
|
log_info("Local supported commands summary 0x%02x", hci_stack->local_supported_commands[0]);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_CLASSIC
|
#ifdef ENABLE_CLASSIC
|
||||||
if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_synchronous_flow_control_enable)){
|
if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_synchronous_flow_control_enable)){
|
||||||
@ -2316,11 +2317,19 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
if (hci_is_le_connection(conn)){
|
if (hci_is_le_connection(conn)){
|
||||||
// For LE, we accept connection as encrypted
|
// For LE, we accept connection as encrypted
|
||||||
conn->authentication_flags |= CONNECTION_ENCRYPTED;
|
conn->authentication_flags |= CONNECTION_ENCRYPTED;
|
||||||
|
hci_emit_security_level(handle, gap_security_level_for_connection(conn));
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_CLASSIC
|
#ifdef ENABLE_CLASSIC
|
||||||
else {
|
else {
|
||||||
// For Classic, we need to validate encryption key size first
|
if ((hci_stack->local_supported_commands[0] & 0x80) != 0){
|
||||||
conn->bonding_flags |= BONDING_SEND_READ_ENCRYPTION_KEY_SIZE;
|
// For Classic, we need to validate encryption key size first, if possible (== supported by Controller)
|
||||||
|
conn->bonding_flags |= BONDING_SEND_READ_ENCRYPTION_KEY_SIZE;
|
||||||
|
} else {
|
||||||
|
// if not, pretend everything is perfect
|
||||||
|
conn->encryption_key_size = 16;
|
||||||
|
conn->authentication_flags |= CONNECTION_ENCRYPTED;
|
||||||
|
hci_emit_security_level(handle, gap_security_level_for_connection(conn));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
@ -800,7 +800,8 @@ typedef struct {
|
|||||||
/* 3 - Write Default Erroneous Data Reporting (Octet 18/bit 3) */
|
/* 3 - Write Default Erroneous Data Reporting (Octet 18/bit 3) */
|
||||||
/* 4 - LE Write Suggested Default Data Length (Octet 34/bit 0) */
|
/* 4 - LE Write Suggested Default Data Length (Octet 34/bit 0) */
|
||||||
/* 5 - LE Read Maximum Data Length (Octet 35/bit 3) */
|
/* 5 - LE Read Maximum Data Length (Octet 35/bit 3) */
|
||||||
/* 6 - LE Set Default PHY (Octet 35/bit 5) */
|
/* 6 - LE Set Default PHY (Octet 35/bit 5) */
|
||||||
|
/* 7 - Read Encryption Key Size (Octet 20/bit 4) */
|
||||||
uint8_t local_supported_commands[1];
|
uint8_t local_supported_commands[1];
|
||||||
|
|
||||||
/* bluetooth device information from hci read local version information */
|
/* bluetooth device information from hci read local version information */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user