mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
Bluetooth: use inclusive language in SMP
This patch replaces some non-inclusive terms based on the appropriate language mapping table compiled by the Bluetooth SIG: https://specificationrefs.bluetooth.com/language-mapping/Appropriate_Language_Mapping_Table.pdf Specifically, these terms are replaced: master -> initiator slave -> responder Signed-off-by: Archie Pusaka <apusaka@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
ef365da180
commit
fad646e16d
@ -202,7 +202,7 @@ struct mgmt_cp_load_link_keys {
|
|||||||
struct mgmt_ltk_info {
|
struct mgmt_ltk_info {
|
||||||
struct mgmt_addr_info addr;
|
struct mgmt_addr_info addr;
|
||||||
__u8 type;
|
__u8 type;
|
||||||
__u8 master;
|
__u8 initiator;
|
||||||
__u8 enc_size;
|
__u8 enc_size;
|
||||||
__le16 ediv;
|
__le16 ediv;
|
||||||
__le64 rand;
|
__le64 rand;
|
||||||
|
@ -6169,7 +6169,7 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data,
|
|||||||
|
|
||||||
static bool ltk_is_valid(struct mgmt_ltk_info *key)
|
static bool ltk_is_valid(struct mgmt_ltk_info *key)
|
||||||
{
|
{
|
||||||
if (key->master != 0x00 && key->master != 0x01)
|
if (key->initiator != 0x00 && key->initiator != 0x01)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (key->addr.type) {
|
switch (key->addr.type) {
|
||||||
@ -6247,11 +6247,11 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
|
|||||||
switch (key->type) {
|
switch (key->type) {
|
||||||
case MGMT_LTK_UNAUTHENTICATED:
|
case MGMT_LTK_UNAUTHENTICATED:
|
||||||
authenticated = 0x00;
|
authenticated = 0x00;
|
||||||
type = key->master ? SMP_LTK : SMP_LTK_SLAVE;
|
type = key->initiator ? SMP_LTK : SMP_LTK_RESPONDER;
|
||||||
break;
|
break;
|
||||||
case MGMT_LTK_AUTHENTICATED:
|
case MGMT_LTK_AUTHENTICATED:
|
||||||
authenticated = 0x01;
|
authenticated = 0x01;
|
||||||
type = key->master ? SMP_LTK : SMP_LTK_SLAVE;
|
type = key->initiator ? SMP_LTK : SMP_LTK_RESPONDER;
|
||||||
break;
|
break;
|
||||||
case MGMT_LTK_P256_UNAUTH:
|
case MGMT_LTK_P256_UNAUTH:
|
||||||
authenticated = 0x00;
|
authenticated = 0x00;
|
||||||
@ -8649,7 +8649,7 @@ static u8 mgmt_ltk_type(struct smp_ltk *ltk)
|
|||||||
{
|
{
|
||||||
switch (ltk->type) {
|
switch (ltk->type) {
|
||||||
case SMP_LTK:
|
case SMP_LTK:
|
||||||
case SMP_LTK_SLAVE:
|
case SMP_LTK_RESPONDER:
|
||||||
if (ltk->authenticated)
|
if (ltk->authenticated)
|
||||||
return MGMT_LTK_AUTHENTICATED;
|
return MGMT_LTK_AUTHENTICATED;
|
||||||
return MGMT_LTK_UNAUTHENTICATED;
|
return MGMT_LTK_UNAUTHENTICATED;
|
||||||
@ -8695,7 +8695,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent)
|
|||||||
ev.key.rand = key->rand;
|
ev.key.rand = key->rand;
|
||||||
|
|
||||||
if (key->type == SMP_LTK)
|
if (key->type == SMP_LTK)
|
||||||
ev.key.master = 1;
|
ev.key.initiator = 1;
|
||||||
|
|
||||||
/* Make sure we copy only the significant bytes based on the
|
/* Make sure we copy only the significant bytes based on the
|
||||||
* encryption key size, and set the rest of the value to zeroes.
|
* encryption key size, and set the rest of the value to zeroes.
|
||||||
|
@ -111,9 +111,9 @@ struct smp_chan {
|
|||||||
u8 id_addr_type;
|
u8 id_addr_type;
|
||||||
u8 irk[16];
|
u8 irk[16];
|
||||||
struct smp_csrk *csrk;
|
struct smp_csrk *csrk;
|
||||||
struct smp_csrk *slave_csrk;
|
struct smp_csrk *responder_csrk;
|
||||||
struct smp_ltk *ltk;
|
struct smp_ltk *ltk;
|
||||||
struct smp_ltk *slave_ltk;
|
struct smp_ltk *responder_ltk;
|
||||||
struct smp_irk *remote_irk;
|
struct smp_irk *remote_irk;
|
||||||
u8 *link_key;
|
u8 *link_key;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@ -753,7 +753,7 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
|
|||||||
mgmt_smp_complete(hcon, complete);
|
mgmt_smp_complete(hcon, complete);
|
||||||
|
|
||||||
kfree_sensitive(smp->csrk);
|
kfree_sensitive(smp->csrk);
|
||||||
kfree_sensitive(smp->slave_csrk);
|
kfree_sensitive(smp->responder_csrk);
|
||||||
kfree_sensitive(smp->link_key);
|
kfree_sensitive(smp->link_key);
|
||||||
|
|
||||||
crypto_free_shash(smp->tfm_cmac);
|
crypto_free_shash(smp->tfm_cmac);
|
||||||
@ -776,9 +776,9 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
|
|||||||
kfree_rcu(smp->ltk, rcu);
|
kfree_rcu(smp->ltk, rcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smp->slave_ltk) {
|
if (smp->responder_ltk) {
|
||||||
list_del_rcu(&smp->slave_ltk->list);
|
list_del_rcu(&smp->responder_ltk->list);
|
||||||
kfree_rcu(smp->slave_ltk, rcu);
|
kfree_rcu(smp->responder_ltk, rcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smp->remote_irk) {
|
if (smp->remote_irk) {
|
||||||
@ -979,7 +979,7 @@ static u8 smp_random(struct smp_chan *smp)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
bt_dev_dbg(conn->hcon->hdev, "conn %p %s", conn,
|
bt_dev_dbg(conn->hcon->hdev, "conn %p %s", conn,
|
||||||
conn->hcon->out ? "master" : "slave");
|
conn->hcon->out ? "initiator" : "responder");
|
||||||
|
|
||||||
ret = smp_c1(smp->tk, smp->rrnd, smp->preq, smp->prsp,
|
ret = smp_c1(smp->tk, smp->rrnd, smp->preq, smp->prsp,
|
||||||
hcon->init_addr_type, &hcon->init_addr,
|
hcon->init_addr_type, &hcon->init_addr,
|
||||||
@ -1021,8 +1021,8 @@ static u8 smp_random(struct smp_chan *smp)
|
|||||||
else
|
else
|
||||||
auth = 0;
|
auth = 0;
|
||||||
|
|
||||||
/* Even though there's no _SLAVE suffix this is the
|
/* Even though there's no _RESPONDER suffix this is the
|
||||||
* slave STK we're adding for later lookup (the master
|
* responder STK we're adding for later lookup (the initiator
|
||||||
* STK never needs to be stored).
|
* STK never needs to be stored).
|
||||||
*/
|
*/
|
||||||
hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
|
hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
|
||||||
@ -1077,10 +1077,10 @@ static void smp_notify_keys(struct l2cap_conn *conn)
|
|||||||
mgmt_new_csrk(hdev, smp->csrk, persistent);
|
mgmt_new_csrk(hdev, smp->csrk, persistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smp->slave_csrk) {
|
if (smp->responder_csrk) {
|
||||||
smp->slave_csrk->bdaddr_type = hcon->dst_type;
|
smp->responder_csrk->bdaddr_type = hcon->dst_type;
|
||||||
bacpy(&smp->slave_csrk->bdaddr, &hcon->dst);
|
bacpy(&smp->responder_csrk->bdaddr, &hcon->dst);
|
||||||
mgmt_new_csrk(hdev, smp->slave_csrk, persistent);
|
mgmt_new_csrk(hdev, smp->responder_csrk, persistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smp->ltk) {
|
if (smp->ltk) {
|
||||||
@ -1089,10 +1089,10 @@ static void smp_notify_keys(struct l2cap_conn *conn)
|
|||||||
mgmt_new_ltk(hdev, smp->ltk, persistent);
|
mgmt_new_ltk(hdev, smp->ltk, persistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smp->slave_ltk) {
|
if (smp->responder_ltk) {
|
||||||
smp->slave_ltk->bdaddr_type = hcon->dst_type;
|
smp->responder_ltk->bdaddr_type = hcon->dst_type;
|
||||||
bacpy(&smp->slave_ltk->bdaddr, &hcon->dst);
|
bacpy(&smp->responder_ltk->bdaddr, &hcon->dst);
|
||||||
mgmt_new_ltk(hdev, smp->slave_ltk, persistent);
|
mgmt_new_ltk(hdev, smp->responder_ltk, persistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smp->link_key) {
|
if (smp->link_key) {
|
||||||
@ -1272,7 +1272,7 @@ static void smp_distribute_keys(struct smp_chan *smp)
|
|||||||
|
|
||||||
if (*keydist & SMP_DIST_ENC_KEY) {
|
if (*keydist & SMP_DIST_ENC_KEY) {
|
||||||
struct smp_cmd_encrypt_info enc;
|
struct smp_cmd_encrypt_info enc;
|
||||||
struct smp_cmd_master_ident ident;
|
struct smp_cmd_initiator_ident ident;
|
||||||
struct smp_ltk *ltk;
|
struct smp_ltk *ltk;
|
||||||
u8 authenticated;
|
u8 authenticated;
|
||||||
__le16 ediv;
|
__le16 ediv;
|
||||||
@ -1293,14 +1293,15 @@ static void smp_distribute_keys(struct smp_chan *smp)
|
|||||||
|
|
||||||
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
|
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
|
||||||
ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type,
|
ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type,
|
||||||
SMP_LTK_SLAVE, authenticated, enc.ltk,
|
SMP_LTK_RESPONDER, authenticated, enc.ltk,
|
||||||
smp->enc_key_size, ediv, rand);
|
smp->enc_key_size, ediv, rand);
|
||||||
smp->slave_ltk = ltk;
|
smp->responder_ltk = ltk;
|
||||||
|
|
||||||
ident.ediv = ediv;
|
ident.ediv = ediv;
|
||||||
ident.rand = rand;
|
ident.rand = rand;
|
||||||
|
|
||||||
smp_send_cmd(conn, SMP_CMD_MASTER_IDENT, sizeof(ident), &ident);
|
smp_send_cmd(conn, SMP_CMD_INITIATOR_IDENT, sizeof(ident),
|
||||||
|
&ident);
|
||||||
|
|
||||||
*keydist &= ~SMP_DIST_ENC_KEY;
|
*keydist &= ~SMP_DIST_ENC_KEY;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1344,7 @@ static void smp_distribute_keys(struct smp_chan *smp)
|
|||||||
csrk->type = MGMT_CSRK_LOCAL_UNAUTHENTICATED;
|
csrk->type = MGMT_CSRK_LOCAL_UNAUTHENTICATED;
|
||||||
memcpy(csrk->val, sign.csrk, sizeof(csrk->val));
|
memcpy(csrk->val, sign.csrk, sizeof(csrk->val));
|
||||||
}
|
}
|
||||||
smp->slave_csrk = csrk;
|
smp->responder_csrk = csrk;
|
||||||
|
|
||||||
smp_send_cmd(conn, SMP_CMD_SIGN_INFO, sizeof(sign), &sign);
|
smp_send_cmd(conn, SMP_CMD_SIGN_INFO, sizeof(sign), &sign);
|
||||||
|
|
||||||
@ -2048,7 +2049,7 @@ static int fixup_sc_false_positive(struct smp_chan *smp)
|
|||||||
struct smp_cmd_pairing *req, *rsp;
|
struct smp_cmd_pairing *req, *rsp;
|
||||||
u8 auth;
|
u8 auth;
|
||||||
|
|
||||||
/* The issue is only observed when we're in slave role */
|
/* The issue is only observed when we're in responder role */
|
||||||
if (hcon->out)
|
if (hcon->out)
|
||||||
return SMP_UNSPECIFIED;
|
return SMP_UNSPECIFIED;
|
||||||
|
|
||||||
@ -2084,7 +2085,8 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb)
|
|||||||
struct hci_conn *hcon = conn->hcon;
|
struct hci_conn *hcon = conn->hcon;
|
||||||
struct hci_dev *hdev = hcon->hdev;
|
struct hci_dev *hdev = hcon->hdev;
|
||||||
|
|
||||||
bt_dev_dbg(hdev, "conn %p %s", conn, hcon->out ? "master" : "slave");
|
bt_dev_dbg(hdev, "conn %p %s", conn,
|
||||||
|
hcon->out ? "initiator" : "responder");
|
||||||
|
|
||||||
if (skb->len < sizeof(smp->pcnf))
|
if (skb->len < sizeof(smp->pcnf))
|
||||||
return SMP_INVALID_PARAMS;
|
return SMP_INVALID_PARAMS;
|
||||||
@ -2251,7 +2253,7 @@ static bool smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
|
|||||||
hci_le_start_enc(hcon, key->ediv, key->rand, key->val, key->enc_size);
|
hci_le_start_enc(hcon, key->ediv, key->rand, key->val, key->enc_size);
|
||||||
hcon->enc_key_size = key->enc_size;
|
hcon->enc_key_size = key->enc_size;
|
||||||
|
|
||||||
/* We never store STKs for master role, so clear this flag */
|
/* We never store STKs for initiator role, so clear this flag */
|
||||||
clear_bit(HCI_CONN_STK_ENCRYPT, &hcon->flags);
|
clear_bit(HCI_CONN_STK_ENCRYPT, &hcon->flags);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2467,7 +2469,7 @@ int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
|||||||
/* Set keys to NULL to make sure smp_failure() does not try to
|
/* Set keys to NULL to make sure smp_failure() does not try to
|
||||||
* remove and free already invalidated rcu list entries. */
|
* remove and free already invalidated rcu list entries. */
|
||||||
smp->ltk = NULL;
|
smp->ltk = NULL;
|
||||||
smp->slave_ltk = NULL;
|
smp->responder_ltk = NULL;
|
||||||
smp->remote_irk = NULL;
|
smp->remote_irk = NULL;
|
||||||
|
|
||||||
if (test_bit(SMP_FLAG_COMPLETE, &smp->flags))
|
if (test_bit(SMP_FLAG_COMPLETE, &smp->flags))
|
||||||
@ -2503,7 +2505,7 @@ static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
|
|||||||
return SMP_INVALID_PARAMS;
|
return SMP_INVALID_PARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMP_ALLOW_CMD(smp, SMP_CMD_MASTER_IDENT);
|
SMP_ALLOW_CMD(smp, SMP_CMD_INITIATOR_IDENT);
|
||||||
|
|
||||||
skb_pull(skb, sizeof(*rp));
|
skb_pull(skb, sizeof(*rp));
|
||||||
|
|
||||||
@ -2512,9 +2514,9 @@ static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
|
static int smp_cmd_initiator_ident(struct l2cap_conn *conn, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct smp_cmd_master_ident *rp = (void *) skb->data;
|
struct smp_cmd_initiator_ident *rp = (void *)skb->data;
|
||||||
struct l2cap_chan *chan = conn->smp;
|
struct l2cap_chan *chan = conn->smp;
|
||||||
struct smp_chan *smp = chan->data;
|
struct smp_chan *smp = chan->data;
|
||||||
struct hci_dev *hdev = conn->hcon->hdev;
|
struct hci_dev *hdev = conn->hcon->hdev;
|
||||||
@ -2913,7 +2915,7 @@ static int smp_cmd_dhkey_check(struct l2cap_conn *conn, struct sk_buff *skb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Slave sends DHKey check as response to master */
|
/* Responder sends DHKey check as response to initiator */
|
||||||
sc_dhkey_check(smp);
|
sc_dhkey_check(smp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3000,8 +3002,8 @@ static int smp_sig_channel(struct l2cap_chan *chan, struct sk_buff *skb)
|
|||||||
reason = smp_cmd_encrypt_info(conn, skb);
|
reason = smp_cmd_encrypt_info(conn, skb);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMP_CMD_MASTER_IDENT:
|
case SMP_CMD_INITIATOR_IDENT:
|
||||||
reason = smp_cmd_master_ident(conn, skb);
|
reason = smp_cmd_initiator_ident(conn, skb);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMP_CMD_IDENT_INFO:
|
case SMP_CMD_IDENT_INFO:
|
||||||
|
@ -79,8 +79,8 @@ struct smp_cmd_encrypt_info {
|
|||||||
__u8 ltk[16];
|
__u8 ltk[16];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
#define SMP_CMD_MASTER_IDENT 0x07
|
#define SMP_CMD_INITIATOR_IDENT 0x07
|
||||||
struct smp_cmd_master_ident {
|
struct smp_cmd_initiator_ident {
|
||||||
__le16 ediv;
|
__le16 ediv;
|
||||||
__le64 rand;
|
__le64 rand;
|
||||||
} __packed;
|
} __packed;
|
||||||
@ -146,7 +146,7 @@ struct smp_cmd_keypress_notify {
|
|||||||
enum {
|
enum {
|
||||||
SMP_STK,
|
SMP_STK,
|
||||||
SMP_LTK,
|
SMP_LTK,
|
||||||
SMP_LTK_SLAVE,
|
SMP_LTK_RESPONDER,
|
||||||
SMP_LTK_P256,
|
SMP_LTK_P256,
|
||||||
SMP_LTK_P256_DEBUG,
|
SMP_LTK_P256_DEBUG,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user