Skip to content

Commit

Permalink
Bluetooth: Fix setting correct authentication information for SMP STK
Browse files Browse the repository at this point in the history
When we store the STK in slave role we should set the correct
authentication information for it. If the pairing is producing a HIGH
security level the STK is considered authenticated, and otherwise it's
considered unauthenticated. This patch fixes the value passed to the
hci_add_ltk() function when adding the STK on the slave side.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Marcin Kraglak <marcin.kraglak@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
  • Loading branch information
Johan Hedberg authored and Marcel Holtmann committed Jun 13, 2014
1 parent 4ad51a7 commit fff3490
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static u8 smp_random(struct smp_chan *smp)
hci_le_start_enc(hcon, ediv, rand, stk);
hcon->enc_key_size = smp->enc_key_size;
} else {
u8 stk[16];
u8 stk[16], auth;
__le64 rand = 0;
__le16 ediv = 0;

Expand All @@ -556,8 +556,13 @@ static u8 smp_random(struct smp_chan *smp)
memset(stk + smp->enc_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);

if (hcon->pending_sec_level == BT_SECURITY_HIGH)
auth = 1;
else
auth = 0;

hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_STK_SLAVE, 0, stk, smp->enc_key_size,
HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size,
ediv, rand);
}

Expand Down

0 comments on commit fff3490

Please sign in to comment.