Bluetooth: Fix SSP acceptor just-works confirmation without MITM
Subsystems (2)
PATCH 1/1 Bluetooth: Fix SSP acceptor just-works confirmation without MITM
From: Johan Hedberg <[email protected]>
Quoted 1 line
From the Bluetooth Core Specification 4.1 page 1958:
"if both devices have set the Authentication_Requirements parameter to one of the MITM Protection Not Required options, authentication stage 1 shall function as if both devices set their IO capabilities to DisplayOnly (e.g., Numeric comparison with automatic confirmation on both devices)"
So far our implementation has done user confirmation for all just-works cases regardless of the MITM requirements, however following the specification to the word means that we should not be doing confirmation when neither side has the MITM flag set.
--- net/bluetooth/hci_event.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/bluetooth/hci_event.c +5 -2
@@ -3622,8 +3622,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev,/* If we're not the initiators request authorization to * proceed from user space (mgmt_user_confirm with -* confirm_hint set to 1). */ -if (!test_bit (HCI_CONN_AUTH_PEND , &conn->flags)) { +* confirm_hint set to 1). The exception is if neither +* side had MITM in which case we do auto-accept. +*/ +if (!test_bit (HCI_CONN_AUTH_PEND , &conn->flags) && + (loc_mitm || rem_mitm)) {BT_DBG ("Confirming auto-accept as acceptor" ); confirm_hint =1 ; goto confirm;
Signature · 1 line
1.9.3
Hi Johan,
Quoted 29 lines · On Monday 09 of June 2014 13:58:14 [email protected] wrote:
From: Johan Hedberg <[email protected]>
From the Bluetooth Core Specification 4.1 page 1958:
"if both devices have set the
Authentication_Requirementsparameter to one of the MITM Protection Not Required options, authentication stage 1 shall function as if both devices set their IO capabilities to DisplayOnly (e.g., Numeric comparison with automatic confirmation on both devices)"So far our implementation has done user confirmation for all just-works cases regardless of the MITM requirements, however following the specification to the word means that we should not be doing confirmation when neither side has the MITM flag set.
Signed-off-by Johan Hedberg <[email protected]>--- net/bluetooth/hci_event.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)net/bluetooth/hci_event.c +0
-0@@ -3622,8 +3622,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev,/* If we're not the initiators request authorization to * proceed from user space (mgmt_user_confirm with
net/bluetooth/hci_event.c static void hci_user_confirm_request_evt(struct hci_dev *hdev, · line 3632
Quoted 10 lines
net/bluetooth/hci_event.c +5
-2-* confirm_hint set to 1). */ -if (!test_bit (HCI_CONN_AUTH_PEND , &conn->flags)) { +* confirm_hint set to 1). The exception is if neither +* side had MITM in which case we do auto-accept. +*/ +if (!test_bit (HCI_CONN_AUTH_PEND , &conn->flags) && + (loc_mitm || rem_mitm)) {BT_DBG ("Confirming auto-accept as acceptor" ); confirm_hint =1 ; goto confirm;
I've tested this on top of Nexus4 kernel + backports-20140516 with Android CTS "Insecure Server" test and this works OK (no user confirmation on incoming pairing).
Signature · 2 lines
Best regards, Szymon Janc
Marcel Holtmann
maintainerHi Johan,
Quoted 13 lines
From the Bluetooth Core Specification 4.1 page 1958:
"if both devices have set the
Authentication_Requirementsparameter to one of the MITM Protection Not Required options, authentication stage 1 shall function as if both devices set their IO capabilities to DisplayOnly (e.g., Numeric comparison with automatic confirmation on both devices)"So far our implementation has done user confirmation for all just-works cases regardless of the MITM requirements, however following the specification to the word means that we should not be doing confirmation when neither side has the MITM flag set.
Quoted 4 lines
Signed-off-by Johan Hedberg <[email protected]>---
net/bluetooth/hci_event.c| 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel