Skip to contentSkip to conversation

Bluetooth: Fix missing encryption refresh on Security Request

PATCH In review Szymon Janc 2 participants 2 messages Feb 26, 2018 – Feb 27, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix missing encryption refresh on Security Request

If Security Request is received on connection that is already encrypted with sufficient security master should perform encryption key refresh procedure instead of just ignoring Slave Security Request (Core Spec 5.0 Vol 3 Part H 2.4.6).

Quoted 1 line

ACL Data RX: Handle 3585 flags 0x02 dlen 6

      SMP: Security Request (0x0b) len 1
        Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09)
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28
        Handle: 3585
        Random number: 0x0000000000000000
        Encrypted diversifier: 0x0000
        Long term key: 44264272a5c426a9e868f034cf0e69f3
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Start Encryption (0x08|0x0019) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: Encryption Key Refresh Complete (0x30) plen 3

        Status: Success (0x00)
        Handle: 3585
---
 net/bluetooth/smp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
net/bluetooth/smp.c +7 -1
index 01117ae84f1d..a2ddae2f37d7 100644
@@ -2296,8 +2296,14 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
 	else
 		sec_level = authreq_to_seclevel(auth);
 
-	if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK))
+	if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) {
+		/* If link is already encrypted with sufficient security we
+		 * still need refresh encryption as per Core Spec 5.0 Vol 3,
+		 * Part H 2.4.6
+		 */
+		smp_ltk_encrypt(conn, hcon->sec_level);
 		return 0;
+	}
 
 	if (sec_level > hcon->pending_sec_level)
 		hcon->pending_sec_level = sec_level;
Signature · 1 line
2.14.3
maintainer
#1 lore raw

Hi Szymon,

Quoted 16 lines

If Security Request is received on connection that is already encrypted with sufficient security master should perform encryption key refresh procedure instead of just ignoring Slave Security Request (Core Spec 5.0 Vol 3 Part H 2.4.6).

Quoted 1 line

ACL Data RX: Handle 3585 flags 0x02 dlen 6

     SMP: Security Request (0x0b) len 1
       Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09)
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28
       Handle: 3585
       Random number: 0x0000000000000000
       Encrypted diversifier: 0x0000
       Long term key: 44264272a5c426a9e868f034cf0e69f3
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

     LE Start Encryption (0x08|0x0019) ncmd 1
       Status: Success (0x00)
Quoted 8 lines
Quoted 1 line

HCI Event: Encryption Key Refresh Complete (0x30) plen 3

       Status: Success (0x00)
       Handle: 3585

---
net/bluetooth/smp.c | 8 +++++++-

1 file changed, 7 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel