Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Archie Pusaka and committed by
Marcel Holtmann
fad646e1 ef365da1

+43 -41
+1 -1
include/net/bluetooth/mgmt.h
··· 202 202 struct mgmt_ltk_info { 203 203 struct mgmt_addr_info addr; 204 204 __u8 type; 205 - __u8 master; 205 + __u8 initiator; 206 206 __u8 enc_size; 207 207 __le16 ediv; 208 208 __le64 rand;
+5 -5
net/bluetooth/mgmt.c
··· 6169 6169 6170 6170 static bool ltk_is_valid(struct mgmt_ltk_info *key) 6171 6171 { 6172 - if (key->master != 0x00 && key->master != 0x01) 6172 + if (key->initiator != 0x00 && key->initiator != 0x01) 6173 6173 return false; 6174 6174 6175 6175 switch (key->addr.type) { ··· 6247 6247 switch (key->type) { 6248 6248 case MGMT_LTK_UNAUTHENTICATED: 6249 6249 authenticated = 0x00; 6250 - type = key->master ? SMP_LTK : SMP_LTK_SLAVE; 6250 + type = key->initiator ? SMP_LTK : SMP_LTK_RESPONDER; 6251 6251 break; 6252 6252 case MGMT_LTK_AUTHENTICATED: 6253 6253 authenticated = 0x01; 6254 - type = key->master ? SMP_LTK : SMP_LTK_SLAVE; 6254 + type = key->initiator ? SMP_LTK : SMP_LTK_RESPONDER; 6255 6255 break; 6256 6256 case MGMT_LTK_P256_UNAUTH: 6257 6257 authenticated = 0x00; ··· 8649 8649 { 8650 8650 switch (ltk->type) { 8651 8651 case SMP_LTK: 8652 - case SMP_LTK_SLAVE: 8652 + case SMP_LTK_RESPONDER: 8653 8653 if (ltk->authenticated) 8654 8654 return MGMT_LTK_AUTHENTICATED; 8655 8655 return MGMT_LTK_UNAUTHENTICATED; ··· 8695 8695 ev.key.rand = key->rand; 8696 8696 8697 8697 if (key->type == SMP_LTK) 8698 - ev.key.master = 1; 8698 + ev.key.initiator = 1; 8699 8699 8700 8700 /* Make sure we copy only the significant bytes based on the 8701 8701 * encryption key size, and set the rest of the value to zeroes.
+34 -32
net/bluetooth/smp.c
··· 111 111 u8 id_addr_type; 112 112 u8 irk[16]; 113 113 struct smp_csrk *csrk; 114 - struct smp_csrk *slave_csrk; 114 + struct smp_csrk *responder_csrk; 115 115 struct smp_ltk *ltk; 116 - struct smp_ltk *slave_ltk; 116 + struct smp_ltk *responder_ltk; 117 117 struct smp_irk *remote_irk; 118 118 u8 *link_key; 119 119 unsigned long flags; ··· 753 753 mgmt_smp_complete(hcon, complete); 754 754 755 755 kfree_sensitive(smp->csrk); 756 - kfree_sensitive(smp->slave_csrk); 756 + kfree_sensitive(smp->responder_csrk); 757 757 kfree_sensitive(smp->link_key); 758 758 759 759 crypto_free_shash(smp->tfm_cmac); ··· 776 776 kfree_rcu(smp->ltk, rcu); 777 777 } 778 778 779 - if (smp->slave_ltk) { 780 - list_del_rcu(&smp->slave_ltk->list); 781 - kfree_rcu(smp->slave_ltk, rcu); 779 + if (smp->responder_ltk) { 780 + list_del_rcu(&smp->responder_ltk->list); 781 + kfree_rcu(smp->responder_ltk, rcu); 782 782 } 783 783 784 784 if (smp->remote_irk) { ··· 979 979 int ret; 980 980 981 981 bt_dev_dbg(conn->hcon->hdev, "conn %p %s", conn, 982 - conn->hcon->out ? "master" : "slave"); 982 + conn->hcon->out ? "initiator" : "responder"); 983 983 984 984 ret = smp_c1(smp->tk, smp->rrnd, smp->preq, smp->prsp, 985 985 hcon->init_addr_type, &hcon->init_addr, ··· 1021 1021 else 1022 1022 auth = 0; 1023 1023 1024 - /* Even though there's no _SLAVE suffix this is the 1025 - * slave STK we're adding for later lookup (the master 1024 + /* Even though there's no _RESPONDER suffix this is the 1025 + * responder STK we're adding for later lookup (the initiator 1026 1026 * STK never needs to be stored). 1027 1027 */ 1028 1028 hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, ··· 1077 1077 mgmt_new_csrk(hdev, smp->csrk, persistent); 1078 1078 } 1079 1079 1080 - if (smp->slave_csrk) { 1081 - smp->slave_csrk->bdaddr_type = hcon->dst_type; 1082 - bacpy(&smp->slave_csrk->bdaddr, &hcon->dst); 1083 - mgmt_new_csrk(hdev, smp->slave_csrk, persistent); 1080 + if (smp->responder_csrk) { 1081 + smp->responder_csrk->bdaddr_type = hcon->dst_type; 1082 + bacpy(&smp->responder_csrk->bdaddr, &hcon->dst); 1083 + mgmt_new_csrk(hdev, smp->responder_csrk, persistent); 1084 1084 } 1085 1085 1086 1086 if (smp->ltk) { ··· 1089 1089 mgmt_new_ltk(hdev, smp->ltk, persistent); 1090 1090 } 1091 1091 1092 - if (smp->slave_ltk) { 1093 - smp->slave_ltk->bdaddr_type = hcon->dst_type; 1094 - bacpy(&smp->slave_ltk->bdaddr, &hcon->dst); 1095 - mgmt_new_ltk(hdev, smp->slave_ltk, persistent); 1092 + if (smp->responder_ltk) { 1093 + smp->responder_ltk->bdaddr_type = hcon->dst_type; 1094 + bacpy(&smp->responder_ltk->bdaddr, &hcon->dst); 1095 + mgmt_new_ltk(hdev, smp->responder_ltk, persistent); 1096 1096 } 1097 1097 1098 1098 if (smp->link_key) { ··· 1272 1272 1273 1273 if (*keydist & SMP_DIST_ENC_KEY) { 1274 1274 struct smp_cmd_encrypt_info enc; 1275 - struct smp_cmd_master_ident ident; 1275 + struct smp_cmd_initiator_ident ident; 1276 1276 struct smp_ltk *ltk; 1277 1277 u8 authenticated; 1278 1278 __le16 ediv; ··· 1293 1293 1294 1294 authenticated = hcon->sec_level == BT_SECURITY_HIGH; 1295 1295 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, 1296 - SMP_LTK_SLAVE, authenticated, enc.ltk, 1296 + SMP_LTK_RESPONDER, authenticated, enc.ltk, 1297 1297 smp->enc_key_size, ediv, rand); 1298 - smp->slave_ltk = ltk; 1298 + smp->responder_ltk = ltk; 1299 1299 1300 1300 ident.ediv = ediv; 1301 1301 ident.rand = rand; 1302 1302 1303 - smp_send_cmd(conn, SMP_CMD_MASTER_IDENT, sizeof(ident), &ident); 1303 + smp_send_cmd(conn, SMP_CMD_INITIATOR_IDENT, sizeof(ident), 1304 + &ident); 1304 1305 1305 1306 *keydist &= ~SMP_DIST_ENC_KEY; 1306 1307 } ··· 1344 1343 csrk->type = MGMT_CSRK_LOCAL_UNAUTHENTICATED; 1345 1344 memcpy(csrk->val, sign.csrk, sizeof(csrk->val)); 1346 1345 } 1347 - smp->slave_csrk = csrk; 1346 + smp->responder_csrk = csrk; 1348 1347 1349 1348 smp_send_cmd(conn, SMP_CMD_SIGN_INFO, sizeof(sign), &sign); 1350 1349 ··· 2049 2048 struct smp_cmd_pairing *req, *rsp; 2050 2049 u8 auth; 2051 2050 2052 - /* The issue is only observed when we're in slave role */ 2051 + /* The issue is only observed when we're in responder role */ 2053 2052 if (hcon->out) 2054 2053 return SMP_UNSPECIFIED; 2055 2054 ··· 2085 2084 struct hci_conn *hcon = conn->hcon; 2086 2085 struct hci_dev *hdev = hcon->hdev; 2087 2086 2088 - bt_dev_dbg(hdev, "conn %p %s", conn, hcon->out ? "master" : "slave"); 2087 + bt_dev_dbg(hdev, "conn %p %s", conn, 2088 + hcon->out ? "initiator" : "responder"); 2089 2089 2090 2090 if (skb->len < sizeof(smp->pcnf)) 2091 2091 return SMP_INVALID_PARAMS; ··· 2253 2251 hci_le_start_enc(hcon, key->ediv, key->rand, key->val, key->enc_size); 2254 2252 hcon->enc_key_size = key->enc_size; 2255 2253 2256 - /* We never store STKs for master role, so clear this flag */ 2254 + /* We never store STKs for initiator role, so clear this flag */ 2257 2255 clear_bit(HCI_CONN_STK_ENCRYPT, &hcon->flags); 2258 2256 2259 2257 return true; ··· 2469 2467 /* Set keys to NULL to make sure smp_failure() does not try to 2470 2468 * remove and free already invalidated rcu list entries. */ 2471 2469 smp->ltk = NULL; 2472 - smp->slave_ltk = NULL; 2470 + smp->responder_ltk = NULL; 2473 2471 smp->remote_irk = NULL; 2474 2472 2475 2473 if (test_bit(SMP_FLAG_COMPLETE, &smp->flags)) ··· 2505 2503 return SMP_INVALID_PARAMS; 2506 2504 } 2507 2505 2508 - SMP_ALLOW_CMD(smp, SMP_CMD_MASTER_IDENT); 2506 + SMP_ALLOW_CMD(smp, SMP_CMD_INITIATOR_IDENT); 2509 2507 2510 2508 skb_pull(skb, sizeof(*rp)); 2511 2509 ··· 2514 2512 return 0; 2515 2513 } 2516 2514 2517 - static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) 2515 + static int smp_cmd_initiator_ident(struct l2cap_conn *conn, struct sk_buff *skb) 2518 2516 { 2519 - struct smp_cmd_master_ident *rp = (void *) skb->data; 2517 + struct smp_cmd_initiator_ident *rp = (void *)skb->data; 2520 2518 struct l2cap_chan *chan = conn->smp; 2521 2519 struct smp_chan *smp = chan->data; 2522 2520 struct hci_dev *hdev = conn->hcon->hdev; ··· 2915 2913 return 0; 2916 2914 } 2917 2915 2918 - /* Slave sends DHKey check as response to master */ 2916 + /* Responder sends DHKey check as response to initiator */ 2919 2917 sc_dhkey_check(smp); 2920 2918 } 2921 2919 ··· 3002 3000 reason = smp_cmd_encrypt_info(conn, skb); 3003 3001 break; 3004 3002 3005 - case SMP_CMD_MASTER_IDENT: 3006 - reason = smp_cmd_master_ident(conn, skb); 3003 + case SMP_CMD_INITIATOR_IDENT: 3004 + reason = smp_cmd_initiator_ident(conn, skb); 3007 3005 break; 3008 3006 3009 3007 case SMP_CMD_IDENT_INFO:
+3 -3
net/bluetooth/smp.h
··· 79 79 __u8 ltk[16]; 80 80 } __packed; 81 81 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 { 84 84 __le16 ediv; 85 85 __le64 rand; 86 86 } __packed; ··· 146 146 enum { 147 147 SMP_STK, 148 148 SMP_LTK, 149 - SMP_LTK_SLAVE, 149 + SMP_LTK_RESPONDER, 150 150 SMP_LTK_P256, 151 151 SMP_LTK_P256_DEBUG, 152 152 };