aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-05-31 11:53:36 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-12-03 10:51:18 -0500
commitd378a2d77618464f511d35687bbbc6614b1bacda (patch)
treeaa2e1ad40d820049e766aff7beab88dbcea6f69e /net/bluetooth
parent6c0dcc5014caeb9c39db816a7e0169255923ccba (diff)
Bluetooth: Set correct LTK type and authentication for SC
After generating the LTK we should set the correct type (normal SC or debug) and authentication information for it. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/smp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 63d5ba7774e0..30439368a55a 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -2060,6 +2060,7 @@ static int smp_cmd_dhkey_check(struct l2cap_conn *conn, struct sk_buff *skb)
2060 struct smp_chan *smp = chan->data; 2060 struct smp_chan *smp = chan->data;
2061 u8 a[7], b[7], *local_addr, *remote_addr; 2061 u8 a[7], b[7], *local_addr, *remote_addr;
2062 u8 io_cap[3], r[16], e[16]; 2062 u8 io_cap[3], r[16], e[16];
2063 u8 key_type, auth;
2063 int err; 2064 int err;
2064 2065
2065 BT_DBG("conn %p", conn); 2066 BT_DBG("conn %p", conn);
@@ -2092,8 +2093,18 @@ static int smp_cmd_dhkey_check(struct l2cap_conn *conn, struct sk_buff *skb)
2092 if (memcmp(check->e, e, 16)) 2093 if (memcmp(check->e, e, 16))
2093 return SMP_DHKEY_CHECK_FAILED; 2094 return SMP_DHKEY_CHECK_FAILED;
2094 2095
2096 if (test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags))
2097 key_type = SMP_LTK_P256_DEBUG;
2098 else
2099 key_type = SMP_LTK_P256;
2100
2101 if (hcon->pending_sec_level == BT_SECURITY_FIPS)
2102 auth = 1;
2103 else
2104 auth = 0;
2105
2095 smp->ltk = hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, 2106 smp->ltk = hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
2096 SMP_LTK_P256, 0, smp->tk, smp->enc_key_size, 2107 key_type, auth, smp->tk, smp->enc_key_size,
2097 0, 0); 2108 0, 0);
2098 2109
2099 if (hcon->out) { 2110 if (hcon->out) {