From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 2/2] Bluetooth: Allow re-encryption with LTK when STK is in use
Date: Tue, 1 Jul 2014 19:14:13 +0300 [thread overview]
Message-ID: <1404231253-21119-2-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1404231253-21119-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
If we're encrypted with the STK we should allow re-encryption with an
LTK even though the acheived security level is the same. This patch adds
the necessary logic to the smp_sufficient_security function which is
used to determine whether to proceed with encryption or not.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 68e6f245581c..55c41de2f5a0 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -868,6 +868,14 @@ bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level)
if (sec_level == BT_SECURITY_LOW)
return true;
+ /* If we're encrypted with an STK always claim insufficient
+ * security. This way we allow the connection to be re-encrypted
+ * with an LTK, even if the LTK provides the same level of
+ * security.
+ */
+ if (test_bit(HCI_CONN_STK_ENCRYPT, &hcon->flags))
+ return false;
+
if (hcon->sec_level >= sec_level)
return true;
--
1.9.3
next prev parent reply other threads:[~2014-07-01 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 16:14 [PATCH v2 1/2] Bluetooth: Add flag to track STK encryption johan.hedberg
2014-07-01 16:14 ` johan.hedberg [this message]
2014-07-01 16:28 ` [PATCH v2 2/2] Bluetooth: Allow re-encryption with LTK when STK is in use Marcel Holtmann
2014-07-01 16:28 ` [PATCH v2 1/2] Bluetooth: Add flag to track STK encryption Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404231253-21119-2-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox