diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 2c103225cb6..9ec63fb987a 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3248,6 +3248,7 @@ static void le_ltk_request(struct net_buf *buf) #endif /* !CONFIG_BT_SMP_SC_PAIR_ONLY */ le_ltk_neg_reply(evt->handle); + bt_smp_keys_reject(conn); done: bt_conn_unref(conn); diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 28de92b7f9b..5f4ed0d17bd 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -5000,6 +5000,23 @@ bool bt_smp_keys_check(struct bt_conn *conn) return true; } +void bt_smp_keys_reject(struct bt_conn *conn) +{ + struct bt_smp *smp; + + smp = smp_chan_get(conn); + if (!smp) { + return; + } + + if (atomic_test_bit(smp->flags, SMP_FLAG_SEC_REQ)) { + bt_conn_security_changed(smp->chan.chan.conn, + BT_SECURITY_ERR_PIN_OR_KEY_MISSING); + } + + smp_reset(smp); +} + static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan) { int i; diff --git a/subsys/bluetooth/host/smp.h b/subsys/bluetooth/host/smp.h index a6354419eeb..c6a3b6a5138 100644 --- a/subsys/bluetooth/host/smp.h +++ b/subsys/bluetooth/host/smp.h @@ -128,6 +128,7 @@ int bt_smp_send_security_req(struct bt_conn *conn); void bt_smp_update_keys(struct bt_conn *conn); bool bt_smp_get_tk(struct bt_conn *conn, u8_t *tk); bool bt_smp_keys_check(struct bt_conn *conn); +void bt_smp_keys_reject(struct bt_conn *conn); int bt_smp_br_send_pairing_req(struct bt_conn *conn);