gap: only check for MITM potential if required and OOB not supported

Also skip if ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY defined
This commit is contained in:
Matthias Ringwald 2021-09-13 14:13:16 +02:00
parent 2dd8985bcc
commit 1fe968f58e

View File

@ -2481,13 +2481,15 @@ static void hci_ssp_assess_security_on_io_cap_request(hci_connection_t * conn){
} }
} else { } else {
// initiator: remote io cap not yet, only check if we have ability for MITM protection if requested and OOB is not supported // initiator: remote io cap not yet, only check if we have ability for MITM protection if requested and OOB is not supported
#ifdef ENABLE_CLASSIC_PAIRING_OOB #ifndef ENABLE_CLASSIC_PAIRING_OOB
#ifndef ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
if ((conn->requested_security_level >= LEVEL_3) && (hci_stack->ssp_io_capability >= SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT)){ if ((conn->requested_security_level >= LEVEL_3) && (hci_stack->ssp_io_capability >= SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT)){
log_info("Level 3+ required, but no input/output -> abort"); log_info("Level 3+ required, but no input/output -> abort");
hci_pairing_complete(conn, ERROR_CODE_INSUFFICIENT_SECURITY); hci_pairing_complete(conn, ERROR_CODE_INSUFFICIENT_SECURITY);
connectionSetAuthenticationFlags(conn, AUTH_FLAG_SEND_IO_CAPABILITIES_NEGATIVE_REPLY); connectionSetAuthenticationFlags(conn, AUTH_FLAG_SEND_IO_CAPABILITIES_NEGATIVE_REPLY);
return; return;
} }
#endif
#endif #endif
} }