Skip to contentSkip to conversation

Bluetooth: Restrict long term keys to public and static addresses

PATCH In review Marcel Holtmann 2 participants 2 messages Feb 16, 2014 – Feb 17, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/2 Bluetooth: Restrict long term keys to public and static addresses

The long term keys should be associated with an identity address. Valid identity addresses are public addresses or static addresses. So only allow these two as valid address information for long term keys.

---
 net/bluetooth/mgmt.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/mgmt.c +13 -3
index ce7ef339b1c4..70bef3d5db57 100644
@@ -4162,9 +4162,19 @@ static bool ltk_is_valid(struct mgmt_ltk_info *key)
 {
 	if (key->master != 0x00 && key->master != 0x01)
 		return false;
-	if (!bdaddr_type_is_le(key->addr.type))
-		return false;
-	return true;
+
+	switch (key->addr.type) {
+	case BDADDR_LE_PUBLIC:
+		return true;
+
+	case BDADDR_LE_RANDOM:
+		/* Two most significant bits shall be set */
+		if ((key->addr.bdaddr.b[5] & 0xc0) != 0xc0)
+			return false;
+		return true;
+	}
+
+	return false;
 }
 
 static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
Signature · 1 line
1.8.5.3
#1 lore raw

Hi Marcel,

Quoted 8 lines · Marcel Holtmann

The long term keys should be associated with an identity address. Valid identity addresses are public addresses or static addresses. So only allow these two as valid address information for long term keys.

---
 net/bluetooth/mgmt.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Both patches have been applied to bluetooth-next. Thanks.

Johan