Bluetooth: Fix setting correct security level when initiating SMP
Subsystems (2)
PATCH 1/1 Bluetooth: Fix setting correct security level when initiating SMP
From: Johan Hedberg <[email protected]>
We can only determine the final security level when both pairing request and response have been exchanged. When initiating pairing the starting target security level is set to MEDIUM unless explicitly specified to be HIGH, so that we can still perform pairing even if the remote doesn't have MITM capabilities. However, once we've received the pairing response we should re-consult the remote and local IO capabilities and upgrade the target security level if necessary.
Without this patch the resulting Long Term Key will occasionally be reported to be unauthenticated when it in reality is an authenticated one.
--- net/bluetooth/smp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/bluetooth/smp.c +4 -1
@@ -494,8 +494,11 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, }/* Not Just Works/Confirm results in MITM Authentication */ -if (method !=JUST_CFM ) +if (method !=JUST_CFM ) {set_bit (SMP_FLAG_MITM_AUTH , &smp->flags); +if (hcon->pending_sec_level <BT_SECURITY_HIGH ) + hcon->pending_sec_level =BT_SECURITY_HIGH ; + }/* If both devices have Keyoard-Display I/O, the master * Confirms and the slave Enters the passkey.
Signature · 1 line
1.9.3
Marcel Holtmann
maintainerHi Johan,
Quoted 8 lines
We can only determine the final security level when both pairing request and response have been exchanged. When initiating pairing the starting target security level is set to MEDIUM unless explicitly specified to be HIGH, so that we can still perform pairing even if the remote doesn't have MITM capabilities. However, once we've received the pairing response we should re-consult the remote and local IO capabilities and upgrade the target security level if necessary.
Quoted 8 lines
Without this patch the resulting Long Term Key will occasionally be reported to be unauthenticated when it in reality is an authenticated one.
Signed-off-by Johan Hedberg <[email protected]>---
net/bluetooth/smp.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel