From 12010fafe6d97eebb911bb7c040495dd6d7fa2ce Mon Sep 17 00:00:00 2001 From: Mariusz Skamra Date: Mon, 11 Jul 2022 10:02:28 +0200 Subject: [PATCH] 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 --- subsys/bluetooth/host/keys.h | 1 + subsys/bluetooth/host/smp.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index 90dcbe8c941..3eb78a68b1e 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -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 { diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index ff5d7659ad8..1a0d7393a64 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -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; }