Bluetooth: keys: Extend keys flags with OOB flag

Adds flag indicating the pairing that was completed using OOB method.
The flag is needed for checking 128bit entropy pairing required by LE
Audio services.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
Mariusz Skamra 2022-07-11 10:02:28 +02:00 committed by Carles Cufí
parent ffea5b6b54
commit 12010fafe6
2 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,7 @@ enum {
BT_KEYS_DEBUG = BIT(1),
/* Bit 2 and 3 might accidentally exist in old stored keys */
BT_KEYS_SC = BIT(4),
BT_KEYS_OOB = BIT(5),
};
struct bt_ltk {

View File

@ -5803,16 +5803,19 @@ void bt_smp_update_keys(struct bt_conn *conn)
* security level upon encryption
*/
switch (smp->method) {
case LE_SC_OOB:
case LEGACY_OOB:
conn->le.keys->flags |= BT_KEYS_OOB;
/* fallthrough */
case PASSKEY_DISPLAY:
case PASSKEY_INPUT:
case PASSKEY_CONFIRM:
case LE_SC_OOB:
case LEGACY_OOB:
conn->le.keys->flags |= BT_KEYS_AUTHENTICATED;
break;
case JUST_WORKS:
default:
/* unauthenticated key, clear it */
conn->le.keys->flags &= ~BT_KEYS_OOB;
conn->le.keys->flags &= ~BT_KEYS_AUTHENTICATED;
break;
}