All of lore.kernel.org
 help / color / mirror / Atom feed
From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 2/6] Bluetooth: Remove unnecessary SMP STK define
Date: Mon, 16 Jun 2014 15:48:18 +0300	[thread overview]
Message-ID: <1402922898-16520-1-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1402905633-470-3-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

We never store the "master" type of STKs since we request encryption
directly with them so we only need one STK type (the one that's
looked-up on the slave side). Simply remove the unnecessary define and
rename the _SLAVE one to the shorter form.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
v2: Add clarifying comment when adding slave STK

 include/net/bluetooth/hci.h | 1 -
 net/bluetooth/hci_event.c   | 2 +-
 net/bluetooth/smp.c         | 6 +++++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 16587dcd6a91..98f7520d2f57 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -349,7 +349,6 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256	0x08
 /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
 #define HCI_SMP_STK			0x80
-#define HCI_SMP_STK_SLAVE		0x81
 #define HCI_SMP_LTK			0x82
 #define HCI_SMP_LTK_SLAVE		0x83
 
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 640c54ec1bd2..752b0b262c88 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4241,7 +4241,7 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
 	 * distribute the keys. Later, security can be re-established
 	 * using a distributed LTK.
 	 */
-	if (ltk->type == HCI_SMP_STK_SLAVE) {
+	if (ltk->type == HCI_SMP_STK) {
 		list_del(&ltk->list);
 		kfree(ltk);
 	}
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index e779e5298ebf..4fb9f9aa0cea 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -561,8 +561,12 @@ static u8 smp_random(struct smp_chan *smp)
 		else
 			auth = 0;
 
+		/* Even though there's no _SLAVE suffix this is the
+		 * slave STK we're adding for later lookup (the master
+		 * STK never needs to be stored).
+		 */
 		hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
-			    HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size,
+			    HCI_SMP_STK, auth, stk, smp->enc_key_size,
 			    ediv, rand);
 	}
 
-- 
1.9.3


  reply	other threads:[~2014-06-16 12:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16  8:00 [PATCH 0/6] Bluetooth: Various SMP cleanups & fixes johan.hedberg
2014-06-16  8:00 ` [PATCH 1/6] Bluetooth: Fix missing NULL check for smp_chan_create() return value johan.hedberg
2014-06-16  8:00 ` [PATCH 2/6] Bluetooth: Remove unnecessary SMP STK define johan.hedberg
2014-06-16 12:48   ` johan.hedberg [this message]
2014-06-16  8:00 ` [PATCH 3/6] Bluetooth: Remove HCI prefix from SMP LTK defines johan.hedberg
2014-06-16  8:00 ` [PATCH 4/6] Bluetooth: Remove unused LTK authentication defines johan.hedberg
2014-06-16  8:00 ` [PATCH 5/6] Bluetooth: Convert SMP flags into an enum johan.hedberg
2014-06-16  8:00 ` [PATCH 6/6] Bluetooth: Add flexible buffer byte order swapping function johan.hedberg
2014-06-16 16:33 ` [PATCH 0/6] Bluetooth: Various SMP cleanups & fixes Marcel Holtmann
2014-06-16 16:25 [PATCH v2 1/6] Bluetooth: Fix missing NULL check for smp_chan_create() return value johan.hedberg
2014-06-16 16:25 ` [PATCH v2 2/6] Bluetooth: Remove unnecessary SMP STK define johan.hedberg

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=1402922898-16520-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.