Skip to content
Snippets Groups Projects
Commit f97257cd authored by Luiz Augusto von Dentz's avatar Luiz Augusto von Dentz Committed by Greg Kroah-Hartman
Browse files

Bluetooth: SMP: Fail if remote and local public keys are identical


commit 6d19628f upstream.

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

Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46b4a9c6
No related branches found
No related tags found
No related merge requests found
...@@ -2685,6 +2685,15 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2685,6 +2685,15 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb)
if (skb->len < sizeof(*key)) if (skb->len < sizeof(*key))
return SMP_INVALID_PARAMS; 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); memcpy(smp->remote_pk, key, 64);
if (test_bit(SMP_FLAG_REMOTE_OOB, &smp->flags)) { if (test_bit(SMP_FLAG_REMOTE_OOB, &smp->flags)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment