aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--net/bluetooth/smp.c18
2 files changed, 10 insertions, 10 deletions
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index aeaf5fa2b9f1..7b3acdd29134 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -127,7 +127,7 @@ struct smp_chan {
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
130 u8 smp_key_size; 130 u8 enc_key_size;
131 unsigned long smp_flags; 131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm; 132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm; 133 struct work_struct confirm;
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index e08fe6c9c9c9..581833436afa 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -250,7 +250,7 @@ static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
250 (max_key_size < SMP_MIN_ENC_KEY_SIZE)) 250 (max_key_size < SMP_MIN_ENC_KEY_SIZE))
251 return SMP_ENC_KEY_SIZE; 251 return SMP_ENC_KEY_SIZE;
252 252
253 smp->smp_key_size = max_key_size; 253 smp->enc_key_size = max_key_size;
254 254
255 return 0; 255 return 0;
256} 256}
@@ -446,8 +446,8 @@ static void random_work(struct work_struct *work)
446 smp_s1(tfm, smp->tk, smp->rrnd, smp->prnd, key); 446 smp_s1(tfm, smp->tk, smp->rrnd, smp->prnd, key);
447 swap128(key, stk); 447 swap128(key, stk);
448 448
449 memset(stk + smp->smp_key_size, 0, 449 memset(stk + smp->enc_key_size, 0,
450 SMP_MAX_ENC_KEY_SIZE - smp->smp_key_size); 450 SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
451 451
452 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) { 452 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) {
453 reason = SMP_UNSPECIFIED; 453 reason = SMP_UNSPECIFIED;
@@ -455,7 +455,7 @@ static void random_work(struct work_struct *work)
455 } 455 }
456 456
457 hci_le_start_enc(hcon, ediv, rand, stk); 457 hci_le_start_enc(hcon, ediv, rand, stk);
458 hcon->enc_key_size = smp->smp_key_size; 458 hcon->enc_key_size = smp->enc_key_size;
459 } else { 459 } else {
460 u8 stk[16], r[16], rand[8]; 460 u8 stk[16], r[16], rand[8];
461 __le16 ediv; 461 __le16 ediv;
@@ -469,10 +469,10 @@ static void random_work(struct work_struct *work)
469 smp_s1(tfm, smp->tk, smp->prnd, smp->rrnd, key); 469 smp_s1(tfm, smp->tk, smp->prnd, smp->rrnd, key);
470 swap128(key, stk); 470 swap128(key, stk);
471 471
472 memset(stk + smp->smp_key_size, 0, 472 memset(stk + smp->enc_key_size, 0,
473 SMP_MAX_ENC_KEY_SIZE - smp->smp_key_size); 473 SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
474 474
475 hci_add_ltk(hcon->hdev, 0, conn->dst, smp->smp_key_size, 475 hci_add_ltk(hcon->hdev, 0, conn->dst, smp->enc_key_size,
476 ediv, rand, stk); 476 ediv, rand, stk);
477 } 477 }
478 478
@@ -819,7 +819,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
819 819
820 skb_pull(skb, sizeof(*rp)); 820 skb_pull(skb, sizeof(*rp));
821 821
822 hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->smp_key_size, 822 hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->enc_key_size,
823 rp->ediv, rp->rand, smp->tk); 823 rp->ediv, rp->rand, smp->tk);
824 824
825 smp_distribute_keys(conn, 1); 825 smp_distribute_keys(conn, 1);
@@ -940,7 +940,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
940 940
941 smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc); 941 smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);
942 942
943 hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->smp_key_size, 943 hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->enc_key_size,
944 ediv, ident.rand, enc.ltk); 944 ediv, ident.rand, enc.ltk);
945 945
946 ident.ediv = cpu_to_le16(ediv); 946 ident.ediv = cpu_to_le16(ediv);