Commit c8147d4d authored by Johan Hedberg's avatar Johan Hedberg Committed by Sasha Levin

Bluetooth: Fix setting correct authentication information for SMP STK

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Tested-by: default avatarMarcin Kraglak <marcin.kraglak@tieto.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org

(cherry picked from commit fff3490f)
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 74c7f793
......@@ -464,7 +464,7 @@ static void random_work(struct work_struct *work)
hci_le_start_enc(hcon, ediv, rand, stk);
hcon->enc_key_size = smp->enc_key_size;
} else {
u8 stk[16], r[16], rand[8];
u8 stk[16], r[16], rand[8], auth;
__le16 ediv;
memset(rand, 0, sizeof(rand));
......@@ -479,8 +479,13 @@ static void random_work(struct work_struct *work)
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, conn->dst, hcon->dst_type,
HCI_SMP_STK_SLAVE, 0, 0, stk, smp->enc_key_size,
HCI_SMP_STK_SLAVE, 0, auth, stk, smp->enc_key_size,
ediv, rand);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment