Bluetooth: SMP: Give security changed when rejecting LTK

Give the security changed callback when the peripheral initiated
security request and peer attempted to encrypt the connection but no LTK
match was found.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-08-22 14:20:56 +02:00 committed by Carles Cufí
commit 05354129e7
3 changed files with 19 additions and 0 deletions

View file

@ -3248,6 +3248,7 @@ static void le_ltk_request(struct net_buf *buf)
#endif /* !CONFIG_BT_SMP_SC_PAIR_ONLY */ #endif /* !CONFIG_BT_SMP_SC_PAIR_ONLY */
le_ltk_neg_reply(evt->handle); le_ltk_neg_reply(evt->handle);
bt_smp_keys_reject(conn);
done: done:
bt_conn_unref(conn); bt_conn_unref(conn);

View file

@ -5000,6 +5000,23 @@ bool bt_smp_keys_check(struct bt_conn *conn)
return true; 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) static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
{ {
int i; int i;

View file

@ -128,6 +128,7 @@ int bt_smp_send_security_req(struct bt_conn *conn);
void bt_smp_update_keys(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_get_tk(struct bt_conn *conn, u8_t *tk);
bool bt_smp_keys_check(struct bt_conn *conn); 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); int bt_smp_br_send_pairing_req(struct bt_conn *conn);