Bluetooth: host: Fix SMP local keys check when starting encryption
Fix SMP check of existing local keys when attempting to start security with required security mode 1 level 4. The logic for checking the conditions was wrong, leading to a situation where encryption would be attempted to be started by the central instead of initiating a new pairing procedure. This would fail when the connection was encrypted and the connection would be disconnected. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
42e372fc3e
commit
83d5402fe8
|
@ -357,15 +357,15 @@ static bool smp_keys_check(struct bt_conn *conn)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (conn->required_sec_level > BT_SECURITY_L2 &&
|
||||
if (conn->required_sec_level >= BT_SECURITY_L3 &&
|
||||
!(conn->le.keys->flags & BT_KEYS_AUTHENTICATED)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (conn->required_sec_level > BT_SECURITY_L3 &&
|
||||
!(conn->le.keys->flags & BT_KEYS_AUTHENTICATED) &&
|
||||
!(conn->le.keys->keys & BT_KEYS_LTK_P256) &&
|
||||
!(conn->le.keys->enc_size == BT_SMP_MAX_ENC_KEY_SIZE)) {
|
||||
if (conn->required_sec_level >= BT_SECURITY_L4 &&
|
||||
!((conn->le.keys->flags & BT_KEYS_AUTHENTICATED) &&
|
||||
(conn->le.keys->keys & BT_KEYS_LTK_P256) &&
|
||||
(conn->le.keys->enc_size == BT_SMP_MAX_ENC_KEY_SIZE))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue