Skip to content

Commit 4bc9121

Browse files
apusakagregkh
authored andcommitted
Bluetooth: use inclusive language in SMP
[ Upstream commit fad646e ] 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 <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]> Stable-dep-of: 59b047b ("Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE") Signed-off-by: Sasha Levin <[email protected]>
1 parent e219c31 commit 4bc9121

File tree

4 files changed

+43
-41
lines changed

4 files changed

+43
-41
lines changed

include/net/bluetooth/mgmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ struct mgmt_cp_load_link_keys {
202202
struct mgmt_ltk_info {
203203
struct mgmt_addr_info addr;
204204
__u8 type;
205-
__u8 master;
205+
__u8 initiator;
206206
__u8 enc_size;
207207
__le16 ediv;
208208
__le64 rand;

net/bluetooth/mgmt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5939,7 +5939,7 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data,
59395939

59405940
static bool ltk_is_valid(struct mgmt_ltk_info *key)
59415941
{
5942-
if (key->master != 0x00 && key->master != 0x01)
5942+
if (key->initiator != 0x00 && key->initiator != 0x01)
59435943
return false;
59445944

59455945
switch (key->addr.type) {
@@ -6017,11 +6017,11 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
60176017
switch (key->type) {
60186018
case MGMT_LTK_UNAUTHENTICATED:
60196019
authenticated = 0x00;
6020-
type = key->master ? SMP_LTK : SMP_LTK_SLAVE;
6020+
type = key->initiator ? SMP_LTK : SMP_LTK_RESPONDER;
60216021
break;
60226022
case MGMT_LTK_AUTHENTICATED:
60236023
authenticated = 0x01;
6024-
type = key->master ? SMP_LTK : SMP_LTK_SLAVE;
6024+
type = key->initiator ? SMP_LTK : SMP_LTK_RESPONDER;
60256025
break;
60266026
case MGMT_LTK_P256_UNAUTH:
60276027
authenticated = 0x00;
@@ -8055,7 +8055,7 @@ static u8 mgmt_ltk_type(struct smp_ltk *ltk)
80558055
{
80568056
switch (ltk->type) {
80578057
case SMP_LTK:
8058-
case SMP_LTK_SLAVE:
8058+
case SMP_LTK_RESPONDER:
80598059
if (ltk->authenticated)
80608060
return MGMT_LTK_AUTHENTICATED;
80618061
return MGMT_LTK_UNAUTHENTICATED;
@@ -8101,7 +8101,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent)
81018101
ev.key.rand = key->rand;
81028102

81038103
if (key->type == SMP_LTK)
8104-
ev.key.master = 1;
8104+
ev.key.initiator = 1;
81058105

81068106
/* Make sure we copy only the significant bytes based on the
81078107
* encryption key size, and set the rest of the value to zeroes.

net/bluetooth/smp.c

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ struct smp_chan {
112112
u8 id_addr_type;
113113
u8 irk[16];
114114
struct smp_csrk *csrk;
115-
struct smp_csrk *slave_csrk;
115+
struct smp_csrk *responder_csrk;
116116
struct smp_ltk *ltk;
117-
struct smp_ltk *slave_ltk;
117+
struct smp_ltk *responder_ltk;
118118
struct smp_irk *remote_irk;
119119
u8 *link_key;
120120
unsigned long flags;
@@ -754,7 +754,7 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
754754
mgmt_smp_complete(hcon, complete);
755755

756756
kfree_sensitive(smp->csrk);
757-
kfree_sensitive(smp->slave_csrk);
757+
kfree_sensitive(smp->responder_csrk);
758758
kfree_sensitive(smp->link_key);
759759

760760
crypto_free_shash(smp->tfm_cmac);
@@ -777,9 +777,9 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
777777
kfree_rcu(smp->ltk, rcu);
778778
}
779779

780-
if (smp->slave_ltk) {
781-
list_del_rcu(&smp->slave_ltk->list);
782-
kfree_rcu(smp->slave_ltk, rcu);
780+
if (smp->responder_ltk) {
781+
list_del_rcu(&smp->responder_ltk->list);
782+
kfree_rcu(smp->responder_ltk, rcu);
783783
}
784784

785785
if (smp->remote_irk) {
@@ -980,7 +980,7 @@ static u8 smp_random(struct smp_chan *smp)
980980
int ret;
981981

982982
bt_dev_dbg(conn->hcon->hdev, "conn %p %s", conn,
983-
conn->hcon->out ? "master" : "slave");
983+
conn->hcon->out ? "initiator" : "responder");
984984

985985
ret = smp_c1(smp->tk, smp->rrnd, smp->preq, smp->prsp,
986986
hcon->init_addr_type, &hcon->init_addr,
@@ -1022,8 +1022,8 @@ static u8 smp_random(struct smp_chan *smp)
10221022
else
10231023
auth = 0;
10241024

1025-
/* Even though there's no _SLAVE suffix this is the
1026-
* slave STK we're adding for later lookup (the master
1025+
/* Even though there's no _RESPONDER suffix this is the
1026+
* responder STK we're adding for later lookup (the initiator
10271027
* STK never needs to be stored).
10281028
*/
10291029
hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
@@ -1078,10 +1078,10 @@ static void smp_notify_keys(struct l2cap_conn *conn)
10781078
mgmt_new_csrk(hdev, smp->csrk, persistent);
10791079
}
10801080

1081-
if (smp->slave_csrk) {
1082-
smp->slave_csrk->bdaddr_type = hcon->dst_type;
1083-
bacpy(&smp->slave_csrk->bdaddr, &hcon->dst);
1084-
mgmt_new_csrk(hdev, smp->slave_csrk, persistent);
1081+
if (smp->responder_csrk) {
1082+
smp->responder_csrk->bdaddr_type = hcon->dst_type;
1083+
bacpy(&smp->responder_csrk->bdaddr, &hcon->dst);
1084+
mgmt_new_csrk(hdev, smp->responder_csrk, persistent);
10851085
}
10861086

10871087
if (smp->ltk) {
@@ -1090,10 +1090,10 @@ static void smp_notify_keys(struct l2cap_conn *conn)
10901090
mgmt_new_ltk(hdev, smp->ltk, persistent);
10911091
}
10921092

1093-
if (smp->slave_ltk) {
1094-
smp->slave_ltk->bdaddr_type = hcon->dst_type;
1095-
bacpy(&smp->slave_ltk->bdaddr, &hcon->dst);
1096-
mgmt_new_ltk(hdev, smp->slave_ltk, persistent);
1093+
if (smp->responder_ltk) {
1094+
smp->responder_ltk->bdaddr_type = hcon->dst_type;
1095+
bacpy(&smp->responder_ltk->bdaddr, &hcon->dst);
1096+
mgmt_new_ltk(hdev, smp->responder_ltk, persistent);
10971097
}
10981098

10991099
if (smp->link_key) {
@@ -1273,7 +1273,7 @@ static void smp_distribute_keys(struct smp_chan *smp)
12731273

12741274
if (*keydist & SMP_DIST_ENC_KEY) {
12751275
struct smp_cmd_encrypt_info enc;
1276-
struct smp_cmd_master_ident ident;
1276+
struct smp_cmd_initiator_ident ident;
12771277
struct smp_ltk *ltk;
12781278
u8 authenticated;
12791279
__le16 ediv;
@@ -1294,14 +1294,15 @@ static void smp_distribute_keys(struct smp_chan *smp)
12941294

12951295
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
12961296
ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type,
1297-
SMP_LTK_SLAVE, authenticated, enc.ltk,
1297+
SMP_LTK_RESPONDER, authenticated, enc.ltk,
12981298
smp->enc_key_size, ediv, rand);
1299-
smp->slave_ltk = ltk;
1299+
smp->responder_ltk = ltk;
13001300

13011301
ident.ediv = ediv;
13021302
ident.rand = rand;
13031303

1304-
smp_send_cmd(conn, SMP_CMD_MASTER_IDENT, sizeof(ident), &ident);
1304+
smp_send_cmd(conn, SMP_CMD_INITIATOR_IDENT, sizeof(ident),
1305+
&ident);
13051306

13061307
*keydist &= ~SMP_DIST_ENC_KEY;
13071308
}
@@ -1344,7 +1345,7 @@ static void smp_distribute_keys(struct smp_chan *smp)
13441345
csrk->type = MGMT_CSRK_LOCAL_UNAUTHENTICATED;
13451346
memcpy(csrk->val, sign.csrk, sizeof(csrk->val));
13461347
}
1347-
smp->slave_csrk = csrk;
1348+
smp->responder_csrk = csrk;
13481349

13491350
smp_send_cmd(conn, SMP_CMD_SIGN_INFO, sizeof(sign), &sign);
13501351

@@ -2049,7 +2050,7 @@ static int fixup_sc_false_positive(struct smp_chan *smp)
20492050
struct smp_cmd_pairing *req, *rsp;
20502051
u8 auth;
20512052

2052-
/* The issue is only observed when we're in slave role */
2053+
/* The issue is only observed when we're in responder role */
20532054
if (hcon->out)
20542055
return SMP_UNSPECIFIED;
20552056

@@ -2085,7 +2086,8 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb)
20852086
struct hci_conn *hcon = conn->hcon;
20862087
struct hci_dev *hdev = hcon->hdev;
20872088

2088-
bt_dev_dbg(hdev, "conn %p %s", conn, hcon->out ? "master" : "slave");
2089+
bt_dev_dbg(hdev, "conn %p %s", conn,
2090+
hcon->out ? "initiator" : "responder");
20892091

20902092
if (skb->len < sizeof(smp->pcnf))
20912093
return SMP_INVALID_PARAMS;
@@ -2252,7 +2254,7 @@ static bool smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
22522254
hci_le_start_enc(hcon, key->ediv, key->rand, key->val, key->enc_size);
22532255
hcon->enc_key_size = key->enc_size;
22542256

2255-
/* We never store STKs for master role, so clear this flag */
2257+
/* We never store STKs for initiator role, so clear this flag */
22562258
clear_bit(HCI_CONN_STK_ENCRYPT, &hcon->flags);
22572259

22582260
return true;
@@ -2468,7 +2470,7 @@ int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
24682470
/* Set keys to NULL to make sure smp_failure() does not try to
24692471
* remove and free already invalidated rcu list entries. */
24702472
smp->ltk = NULL;
2471-
smp->slave_ltk = NULL;
2473+
smp->responder_ltk = NULL;
24722474
smp->remote_irk = NULL;
24732475

24742476
if (test_bit(SMP_FLAG_COMPLETE, &smp->flags))
@@ -2504,7 +2506,7 @@ static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
25042506
return SMP_INVALID_PARAMS;
25052507
}
25062508

2507-
SMP_ALLOW_CMD(smp, SMP_CMD_MASTER_IDENT);
2509+
SMP_ALLOW_CMD(smp, SMP_CMD_INITIATOR_IDENT);
25082510

25092511
skb_pull(skb, sizeof(*rp));
25102512

@@ -2513,9 +2515,9 @@ static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
25132515
return 0;
25142516
}
25152517

2516-
static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
2518+
static int smp_cmd_initiator_ident(struct l2cap_conn *conn, struct sk_buff *skb)
25172519
{
2518-
struct smp_cmd_master_ident *rp = (void *) skb->data;
2520+
struct smp_cmd_initiator_ident *rp = (void *)skb->data;
25192521
struct l2cap_chan *chan = conn->smp;
25202522
struct smp_chan *smp = chan->data;
25212523
struct hci_dev *hdev = conn->hcon->hdev;
@@ -2914,7 +2916,7 @@ static int smp_cmd_dhkey_check(struct l2cap_conn *conn, struct sk_buff *skb)
29142916
return 0;
29152917
}
29162918

2917-
/* Slave sends DHKey check as response to master */
2919+
/* Responder sends DHKey check as response to initiator */
29182920
sc_dhkey_check(smp);
29192921
}
29202922

@@ -3001,8 +3003,8 @@ static int smp_sig_channel(struct l2cap_chan *chan, struct sk_buff *skb)
30013003
reason = smp_cmd_encrypt_info(conn, skb);
30023004
break;
30033005

3004-
case SMP_CMD_MASTER_IDENT:
3005-
reason = smp_cmd_master_ident(conn, skb);
3006+
case SMP_CMD_INITIATOR_IDENT:
3007+
reason = smp_cmd_initiator_ident(conn, skb);
30063008
break;
30073009

30083010
case SMP_CMD_IDENT_INFO:

net/bluetooth/smp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ struct smp_cmd_encrypt_info {
7979
__u8 ltk[16];
8080
} __packed;
8181

82-
#define SMP_CMD_MASTER_IDENT 0x07
83-
struct smp_cmd_master_ident {
82+
#define SMP_CMD_INITIATOR_IDENT 0x07
83+
struct smp_cmd_initiator_ident {
8484
__le16 ediv;
8585
__le64 rand;
8686
} __packed;
@@ -146,7 +146,7 @@ struct smp_cmd_keypress_notify {
146146
enum {
147147
SMP_STK,
148148
SMP_LTK,
149-
SMP_LTK_SLAVE,
149+
SMP_LTK_RESPONDER,
150150
SMP_LTK_P256,
151151
SMP_LTK_P256_DEBUG,
152152
};

0 commit comments

Comments
 (0)