Bluetooth: Add smp_ltk_sec_level() helper function

There are several places that need to determine the security level that
an LTK can provide. This patch adds a convenience function for this to
help make the code more readable.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Johan Hedberg 2014-09-10 17:37:45 -07:00 committed by Marcel Holtmann
parent 1afc2a1ab6
commit a6f7833ca3
3 changed files with 10 additions and 5 deletions

View file

@ -125,6 +125,14 @@ enum {
SMP_LTK_SLAVE,
};
static inline u8 smp_ltk_sec_level(struct smp_ltk *key)
{
if (key->authenticated)
return BT_SECURITY_HIGH;
return BT_SECURITY_MEDIUM;
}
/* SMP Commands */
bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level);
int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);