gap: calculate IO Cap AuthReq Bondable Mode based on gap_ssp_set_authentication_requirement and gap_set_bondable_mode

This commit is contained in:
Matthias Ringwald 2021-03-25 09:31:42 +01:00
parent 6058cb0da7
commit a8d20135f0
2 changed files with 10 additions and 5 deletions

View File

@ -58,6 +58,7 @@ u-blox SPP Service Server: use `GATTSERVICE_SUBEVENT_SPP_SERVICE_CONNECTED` and
events instead of callback, and `RFCOMM_DATA_PACKET` for received data
HSP AG: emit HSP_SUBEVENT_BUTTON_PRESSED instead of audio connection setup/release
Examples: use `btstack_event.h` getters instead of direct array access, use enum to compare status codes
GAP: calculate IO Cap AuthReq Bondable Mode based on `gap_ssp_set_authentication_requirement` and `gap_set_bondable_mode`
## Release v1.3.2

View File

@ -4322,14 +4322,18 @@ static bool hci_run_general_pending_commands(void){
if (connection->authentication_flags & SEND_IO_CAPABILITIES_REPLY){
connectionClearAuthenticationFlags(connection, SEND_IO_CAPABILITIES_REPLY);
// tweak authentication requirements
uint8_t authreq = hci_stack->ssp_authentication_requirement;
if (connection->bonding_flags & BONDING_DEDICATED){
authreq = SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING;
}
// set authentication requirements:
// - MITM = ssp_authentication_requirement (USER) | requested_security_level (dynamic)
// - BONDING MODE: Dedicated if requested, otherwise bondable flag
uint8_t authreq = hci_stack->ssp_authentication_requirement & 1;
if (gap_mitm_protection_required_for_security_level(connection->requested_security_level)){
authreq |= 1;
}
if (connection->bonding_flags & BONDING_DEDICATED){
authreq |= SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING;
} else if (hci_stack->bondable){
authreq |= SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING;
}
uint8_t have_oob_data = 0;
#ifdef ENABLE_CLASSIC_PAIRING_OOB
if (connection->classic_oob_c_192 != NULL){