Bluetooth: Fix requesting high security level
If high security is required but keys are unauthenticated start pairing instead of encrypting with too weak keys. Change-Id: I35e5f0c1ab86660479288908152d61823ffb102e Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
74a1f0fe2e
commit
b73d408b72
1 changed files with 6 additions and 0 deletions
|
@ -497,11 +497,17 @@ int bt_conn_security(struct bt_conn *conn, bt_security_t sec)
|
|||
|
||||
keys = bt_keys_find(BT_KEYS_LTK, &conn->dst);
|
||||
if (keys) {
|
||||
if (sec > BT_SECURITY_MEDIUM &&
|
||||
keys->ltk.type != BT_KEYS_AUTHENTICATED) {
|
||||
goto pair;
|
||||
}
|
||||
|
||||
return bt_conn_le_start_encryption(conn, keys->ltk.rand,
|
||||
keys->ltk.ediv,
|
||||
keys->ltk.val);
|
||||
}
|
||||
|
||||
pair:
|
||||
return bt_smp_send_pairing_req(conn);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue