Skip to content

Commit 6d19628

Browse files
Vudentzholtmann
authored andcommitted
Bluetooth: SMP: Fail if remote and local public keys are identical
This fails the pairing procedure when both remote and local non-debug public keys are identical. Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent d00745d commit 6d19628

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/bluetooth/smp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,15 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb)
27322732
if (skb->len < sizeof(*key))
27332733
return SMP_INVALID_PARAMS;
27342734

2735+
/* Check if remote and local public keys are the same and debug key is
2736+
* not in use.
2737+
*/
2738+
if (!test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags) &&
2739+
!crypto_memneq(key, smp->local_pk, 64)) {
2740+
bt_dev_err(hdev, "Remote and local public keys are identical");
2741+
return SMP_UNSPECIFIED;
2742+
}
2743+
27352744
memcpy(smp->remote_pk, key, 64);
27362745

27372746
if (test_bit(SMP_FLAG_REMOTE_OOB, &smp->flags)) {

0 commit comments

Comments
 (0)