1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-03-25 16:43:28 +00:00

gap: reject pin code request if secure connections only mode is active

This commit is contained in:
Matthias Ringwald 2021-06-19 18:04:49 +02:00
parent b54464ca65
commit 50dcc63caa

@ -2734,13 +2734,20 @@ static void event_handler(uint8_t *packet, uint16_t size){
if (!conn) break;
hci_pairing_started(conn, false);
// non-bondable mode: pin code negative reply will be sent (event is not forwarded to app)
if (!hci_stack->bondable){
// abort pairing if: non-bondable mode (event is not forwarded to app)
if (!hci_stack->bondable ){
conn->authentication_flags |= AUTH_FLAG_DENY_PIN_CODE_REQUEST;
hci_pairing_complete(conn, ERROR_CODE_PAIRING_NOT_ALLOWED);
hci_run();
return;
}
// abort pairing if: Secure Connections Only mode (event is not forwarded to app)
if (hci_stack->gap_secure_connections_only_mode){
conn->authentication_flags |= AUTH_FLAG_DENY_PIN_CODE_REQUEST;
hci_pairing_complete(conn, ERROR_CODE_INSUFFICIENT_SECURITY);
hci_run();
return;
}
break;
case HCI_EVENT_IO_CAPABILITY_RESPONSE: