hci: track HCI_EVENT_IO_CAPABILITY_RESPONSE received

This commit is contained in:
Matthias Ringwald 2021-06-16 16:48:34 +02:00
parent c9f0088dec
commit 2ff4272d8d
2 changed files with 16 additions and 12 deletions

View File

@ -2709,6 +2709,7 @@ static void event_handler(uint8_t *packet, uint16_t size){
hci_event_io_capability_response_get_bd_addr(packet, addr);
conn = hci_connection_for_bd_addr_and_type(addr, BD_ADDR_TYPE_ACL);
if (!conn) break;
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], RECV_IO_CAPABILITIES_RESPONSE);
conn->io_cap_response_auth_req = hci_event_io_capability_response_get_authentication_requirements(packet);
conn->io_cap_response_io = hci_event_io_capability_response_get_io_capability(packet);
break;
@ -4447,7 +4448,9 @@ static bool hci_run_general_pending_commands(void){
connectionClearAuthenticationFlags(connection, SEND_IO_CAPABILITIES_REPLY);
// set authentication requirements:
// - MITM = ssp_authentication_requirement (USER) | requested_security_level (dynamic)
// - BONDING MODE: Dedicated if requested, otherwise bondable flag
// - BONDING MODE:
// - initiator: dedicated if requested, bondable otherwise
// - responder: local & remote bondable
uint8_t authreq = hci_stack->ssp_authentication_requirement & 1;
if (gap_mitm_protection_required_for_security_level(connection->requested_security_level)){
authreq |= 1;

View File

@ -206,25 +206,26 @@ typedef enum {
RECV_LINK_KEY_NOTIFICATION = 0x0010,
DENY_PIN_CODE_REQUEST = 0x0040,
RECV_IO_CAPABILITIES_REQUEST = 0x0080,
SEND_IO_CAPABILITIES_REPLY = 0x0100,
SEND_IO_CAPABILITIES_NEGATIVE_REPLY = 0x0200,
SEND_USER_CONFIRM_REPLY = 0x0400,
SEND_USER_PASSKEY_REPLY = 0x0800,
RECV_IO_CAPABILITIES_RESPONSE = 0x0100,
SEND_IO_CAPABILITIES_REPLY = 0x0200,
SEND_IO_CAPABILITIES_NEGATIVE_REPLY = 0x0400,
SEND_USER_CONFIRM_REPLY = 0x0800,
SEND_USER_PASSKEY_REPLY = 0x1000,
// Classic OOB
SEND_REMOTE_OOB_DATA_REPLY = 0x1800,
SEND_REMOTE_OOB_DATA_REPLY = 0x2000,
// pairing status
LEGACY_PAIRING_ACTIVE = 0x2000,
SSP_PAIRING_ACTIVE = 0x4000,
LEGACY_PAIRING_ACTIVE = 0x4000,
SSP_PAIRING_ACTIVE = 0x8000,
// connection status
CONNECTION_AUTHENTICATED = 0x8000,
CONNECTION_ENCRYPTED = 0x10000,
CONNECTION_AUTHENTICATED = 0x10000,
CONNECTION_ENCRYPTED = 0x20000,
// errands
READ_RSSI = 0x20000,
WRITE_SUPERVISION_TIMEOUT = 0x40000,
READ_RSSI = 0x40000,
WRITE_SUPERVISION_TIMEOUT = 0x80000,
} hci_authentication_flags_t;