Commit f7aa611a authored by Vinicius Costa Gomes's avatar Vinicius Costa Gomes Committed by Johan Hedberg

Bluetooth: Rename smp_key_size to enc_key_size

This makes clear that this is the size of the key used to
encrypt the link.
Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 27f27ed8
...@@ -127,7 +127,7 @@ struct smp_chan { ...@@ -127,7 +127,7 @@ struct smp_chan {
u8 rrnd[16]; /* SMP Pairing Random (remote) */ u8 rrnd[16]; /* SMP Pairing Random (remote) */
u8 pcnf[16]; /* SMP Pairing Confirm */ u8 pcnf[16]; /* SMP Pairing Confirm */
u8 tk[16]; /* SMP Temporary Key */ u8 tk[16]; /* SMP Temporary Key */
u8 smp_key_size; u8 enc_key_size;
unsigned long smp_flags; unsigned long smp_flags;
struct crypto_blkcipher *tfm; struct crypto_blkcipher *tfm;
struct work_struct confirm; struct work_struct confirm;
......
...@@ -250,7 +250,7 @@ static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size) ...@@ -250,7 +250,7 @@ static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
(max_key_size < SMP_MIN_ENC_KEY_SIZE)) (max_key_size < SMP_MIN_ENC_KEY_SIZE))
return SMP_ENC_KEY_SIZE; return SMP_ENC_KEY_SIZE;
smp->smp_key_size = max_key_size; smp->enc_key_size = max_key_size;
return 0; return 0;
} }
...@@ -446,8 +446,8 @@ static void random_work(struct work_struct *work) ...@@ -446,8 +446,8 @@ static void random_work(struct work_struct *work)
smp_s1(tfm, smp->tk, smp->rrnd, smp->prnd, key); smp_s1(tfm, smp->tk, smp->rrnd, smp->prnd, key);
swap128(key, stk); swap128(key, stk);
memset(stk + smp->smp_key_size, 0, memset(stk + smp->enc_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - smp->smp_key_size); SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) { if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) {
reason = SMP_UNSPECIFIED; reason = SMP_UNSPECIFIED;
...@@ -455,7 +455,7 @@ static void random_work(struct work_struct *work) ...@@ -455,7 +455,7 @@ static void random_work(struct work_struct *work)
} }
hci_le_start_enc(hcon, ediv, rand, stk); hci_le_start_enc(hcon, ediv, rand, stk);
hcon->enc_key_size = smp->smp_key_size; hcon->enc_key_size = smp->enc_key_size;
} else { } else {
u8 stk[16], r[16], rand[8]; u8 stk[16], r[16], rand[8];
__le16 ediv; __le16 ediv;
...@@ -469,10 +469,10 @@ static void random_work(struct work_struct *work) ...@@ -469,10 +469,10 @@ static void random_work(struct work_struct *work)
smp_s1(tfm, smp->tk, smp->prnd, smp->rrnd, key); smp_s1(tfm, smp->tk, smp->prnd, smp->rrnd, key);
swap128(key, stk); swap128(key, stk);
memset(stk + smp->smp_key_size, 0, memset(stk + smp->enc_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - smp->smp_key_size); SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
hci_add_ltk(hcon->hdev, 0, conn->dst, smp->smp_key_size, hci_add_ltk(hcon->hdev, 0, conn->dst, smp->enc_key_size,
ediv, rand, stk); ediv, rand, stk);
} }
...@@ -819,7 +819,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -819,7 +819,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
skb_pull(skb, sizeof(*rp)); skb_pull(skb, sizeof(*rp));
hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->smp_key_size, hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->enc_key_size,
rp->ediv, rp->rand, smp->tk); rp->ediv, rp->rand, smp->tk);
smp_distribute_keys(conn, 1); smp_distribute_keys(conn, 1);
...@@ -940,7 +940,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force) ...@@ -940,7 +940,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc); smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);
hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->smp_key_size, hci_add_ltk(conn->hcon->hdev, 1, conn->dst, smp->enc_key_size,
ediv, ident.rand, enc.ltk); ediv, ident.rand, enc.ltk);
ident.ediv = cpu_to_le16(ediv); ident.ediv = cpu_to_le16(ediv);
......
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