summaryrefslogtreecommitdiff
path: root/net/bluetooth/smp.h
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-09-11 04:37:45 +0400
committerMarcel Holtmann <marcel@holtmann.org>2014-09-11 04:45:24 +0400
commita6f7833ca353d50de46e3532afebe4abfc5dc4d9 (patch)
tree81813ae82ad5069a9880b2918de7548ccbd9a61b /net/bluetooth/smp.h
parent1afc2a1ab6612dcc3f26db7ca1afba9cff359f1c (diff)
downloadlinux-a6f7833ca353d50de46e3532afebe4abfc5dc4d9.tar.xz
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>
Diffstat (limited to 'net/bluetooth/smp.h')
-rw-r--r--net/bluetooth/smp.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
index 5240537efde3..86a683a8b491 100644
--- a/net/bluetooth/smp.h
+++ b/net/bluetooth/smp.h
@@ -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);