aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-03-16 05:45:43 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-03-16 12:16:45 -0400
commit882fafad71a4bac8e8a2445dfb08c38a71b4eef1 (patch)
treec077fd85428f65fc858f124eb5d576670dc99b92 /net/bluetooth
parent8e4e2ee5d80875177e03d57b807e0784f3d91e0e (diff)
Bluetooth: Fix local OOB data handling for SMP
We need to store the local ra/rb value in order to verify the Check value received from the remote. This patch adds a new 'lr' for the local ra/rb value and makes sure it gets used when verifying the DHKey Check PDU received from the remote. 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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index f0c5c2827372..1cc15de6ff1e 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -95,7 +95,8 @@ struct smp_chan {
95 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 95 u8 rrnd[16]; /* SMP Pairing Random (remote) */
96 u8 pcnf[16]; /* SMP Pairing Confirm */ 96 u8 pcnf[16]; /* SMP Pairing Confirm */
97 u8 tk[16]; /* SMP Temporary Key */ 97 u8 tk[16]; /* SMP Temporary Key */
98 u8 rr[16]; 98 u8 rr[16]; /* Remote OOB ra/rb value */
99 u8 lr[16]; /* Local OOB ra/rb value */
99 u8 enc_key_size; 100 u8 enc_key_size;
100 u8 remote_key_dist; 101 u8 remote_key_dist;
101 bdaddr_t id_addr; 102 bdaddr_t id_addr;
@@ -1830,7 +1831,7 @@ static u8 sc_send_public_key(struct smp_chan *smp)
1830 1831
1831 memcpy(smp->local_pk, smp_dev->local_pk, 64); 1832 memcpy(smp->local_pk, smp_dev->local_pk, 64);
1832 memcpy(smp->local_sk, smp_dev->local_sk, 32); 1833 memcpy(smp->local_sk, smp_dev->local_sk, 32);
1833 memcpy(smp->rr, smp_dev->local_rr, 16); 1834 memcpy(smp->lr, smp_dev->local_rr, 16);
1834 1835
1835 if (smp_dev->debug_key) 1836 if (smp_dev->debug_key)
1836 set_bit(SMP_FLAG_DEBUG_KEY, &smp->flags); 1837 set_bit(SMP_FLAG_DEBUG_KEY, &smp->flags);
@@ -2634,6 +2635,8 @@ static int smp_cmd_dhkey_check(struct l2cap_conn *conn, struct sk_buff *skb)
2634 2635
2635 if (smp->method == REQ_PASSKEY || smp->method == DSP_PASSKEY) 2636 if (smp->method == REQ_PASSKEY || smp->method == DSP_PASSKEY)
2636 put_unaligned_le32(hcon->passkey_notify, r); 2637 put_unaligned_le32(hcon->passkey_notify, r);
2638 else if (smp->method == REQ_OOB)
2639 memcpy(r, smp->lr, 16);
2637 2640
2638 err = smp_f6(smp->tfm_cmac, smp->mackey, smp->rrnd, smp->prnd, r, 2641 err = smp_f6(smp->tfm_cmac, smp->mackey, smp->rrnd, smp->prnd, r,
2639 io_cap, remote_addr, local_addr, e); 2642 io_cap, remote_addr, local_addr, e);