Bluetooth: host: Fail pairing with identical public key
Fail the pairing procedure when both devices have the same non-debug public key. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
a274eb17bf
commit
3102f3b081
1 changed files with 12 additions and 0 deletions
|
@ -4059,6 +4059,12 @@ static uint8_t smp_public_key_slave(struct bt_smp *smp)
|
||||||
{
|
{
|
||||||
uint8_t err;
|
uint8_t err;
|
||||||
|
|
||||||
|
if (!atomic_test_bit(smp->flags, SMP_FLAG_SC_DEBUG_KEY) &&
|
||||||
|
memcmp(smp->pkey, sc_public_key, 64) == 0) {
|
||||||
|
BT_WARN("Remote is using identical public key");
|
||||||
|
return BT_SMP_ERR_UNSPECIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
err = sc_send_public_key(smp);
|
err = sc_send_public_key(smp);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -4124,6 +4130,12 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf)
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CENTRAL) &&
|
if (IS_ENABLED(CONFIG_BT_CENTRAL) &&
|
||||||
smp->chan.chan.conn->role == BT_HCI_ROLE_MASTER) {
|
smp->chan.chan.conn->role == BT_HCI_ROLE_MASTER) {
|
||||||
|
if (!atomic_test_bit(smp->flags, SMP_FLAG_SC_DEBUG_KEY) &&
|
||||||
|
memcmp(smp->pkey, sc_public_key, 64) == 0) {
|
||||||
|
BT_WARN("Remote is using identical public key");
|
||||||
|
return BT_SMP_ERR_UNSPECIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
switch (smp->method) {
|
switch (smp->method) {
|
||||||
case PASSKEY_CONFIRM:
|
case PASSKEY_CONFIRM:
|
||||||
case JUST_WORKS:
|
case JUST_WORKS:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue