Skip to content

Commit 7d5843b

Browse files
jhedbergholtmann
authored andcommitted
Bluetooth: Remove unnecessary SMP STK define
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> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent c29d244 commit 7d5843b

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎include/net/bluetooth/hci.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ enum {
349349
#define HCI_LK_AUTH_COMBINATION_P256 0x08
350350
/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
351351
#define HCI_SMP_STK 0x80
352-
#define HCI_SMP_STK_SLAVE 0x81
353352
#define HCI_SMP_LTK 0x82
354353
#define HCI_SMP_LTK_SLAVE 0x83
355354

‎net/bluetooth/hci_event.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4241,7 +4241,7 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
42414241
* distribute the keys. Later, security can be re-established
42424242
* using a distributed LTK.
42434243
*/
4244-
if (ltk->type == HCI_SMP_STK_SLAVE) {
4244+
if (ltk->type == HCI_SMP_STK) {
42454245
list_del(&ltk->list);
42464246
kfree(ltk);
42474247
}

‎net/bluetooth/smp.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,12 @@ static u8 smp_random(struct smp_chan *smp)
568568
else
569569
auth = 0;
570570

571+
/* Even though there's no _SLAVE suffix this is the
572+
* slave STK we're adding for later lookup (the master
573+
* STK never needs to be stored).
574+
*/
571575
hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
572-
HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size,
576+
HCI_SMP_STK, auth, stk, smp->enc_key_size,
573577
ediv, rand);
574578
}
575579

0 commit comments

Comments
 (0)