Skip to content

Commit

Permalink
Bluetooth: SMP: Fail if remote and local public keys are identical
Browse files Browse the repository at this point in the history
commit 6d19628 upstream.

This fails the pairing procedure when both remote and local non-debug
public keys are identical.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Luiz Augusto von Dentz authored and Greg Kroah-Hartman committed May 26, 2021
1 parent e8c3478 commit d8d261c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2733,6 +2733,15 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb)
if (skb->len < sizeof(*key))
return SMP_INVALID_PARAMS;

/* Check if remote and local public keys are the same and debug key is
* not in use.
*/
if (!test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags) &&
!crypto_memneq(key, smp->local_pk, 64)) {
bt_dev_err(hdev, "Remote and local public keys are identical");
return SMP_UNSPECIFIED;
}

memcpy(smp->remote_pk, key, 64);

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

0 comments on commit d8d261c

Please sign in to comment.