Bluetooth: BR/EDR: Track 16 digits PIN code
As a pairing acceptor starts tracking 16 octets PIN entered by user when pairing devices working in Security Mode 3. Based on PIN tracker state, the generated link key is saved in keys database as combination of un/authenticated and legacy key type. Change-Id: I4cbb20942fb38697d952971df807aec8b16c74e4 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
29263a0760
commit
998d72a986
3 changed files with 15 additions and 0 deletions
|
@ -1126,6 +1126,10 @@ int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin)
|
|||
return -EPERM;
|
||||
}
|
||||
|
||||
if (len == 16) {
|
||||
atomic_set_bit(conn->flags, BT_CONN_BR_LEGACY_SECURE);
|
||||
}
|
||||
|
||||
return pin_code_reply(conn, pin, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef enum __packed {
|
|||
/* bt_conn flags: the flags defined here represent connection parameters */
|
||||
enum {
|
||||
BT_CONN_AUTO_CONNECT,
|
||||
BT_CONN_BR_LEGACY_SECURE, /* 16 digits legacy PIN tracker */
|
||||
};
|
||||
|
||||
struct bt_conn_le {
|
||||
|
|
|
@ -1609,6 +1609,16 @@ static void link_key_notify(struct net_buf *buf)
|
|||
|
||||
if (evt->key_type == BT_LK_COMBINATION) {
|
||||
atomic_set_bit(&conn->keys->flags, BT_KEYS_BR_LEGACY);
|
||||
|
||||
/*
|
||||
* Setting Combination Link Key as AUTHENTICATED means it was
|
||||
* successfully generated by 16 digits wide PIN code.
|
||||
*/
|
||||
if (atomic_test_and_clear_bit(conn->flags,
|
||||
BT_CONN_BR_LEGACY_SECURE)) {
|
||||
atomic_set_bit(&conn->keys->flags,
|
||||
BT_KEYS_AUTHENTICATED);
|
||||
}
|
||||
}
|
||||
|
||||
bt_conn_unref(conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue