Bluetooth: Refactor type of keys as flags

Converts bt_keys type to atomic_t flags to enable consistent and
compact key type management.

Change-Id: Ie384168da6d5d0d1b305a33988ce7689ba3a4c6a
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-01-04 14:27:14 +01:00 committed by Anas Nashif
commit 524ef5ee1d
4 changed files with 22 additions and 21 deletions

View file

@ -179,12 +179,14 @@ static int start_security(struct bt_conn *conn)
}
if (conn->required_sec_level > BT_SECURITY_MEDIUM &&
conn->keys->type != BT_KEYS_AUTHENTICATED) {
!atomic_test_bit(&conn->keys->flags,
BT_KEYS_AUTHENTICATED)) {
return bt_smp_send_pairing_req(conn);
}
if (conn->required_sec_level > BT_SECURITY_HIGH &&
conn->keys->type != BT_KEYS_AUTHENTICATED &&
!atomic_test_bit(&conn->keys->flags,
BT_KEYS_AUTHENTICATED) &&
!(conn->keys->keys & BT_KEYS_LTK_P256)) {
return bt_smp_send_pairing_req(conn);
}