diff --git a/doc/releases/release-notes-2.7.rst b/doc/releases/release-notes-2.7.rst index 0c2a558670a..4d668d58c73 100644 --- a/doc/releases/release-notes-2.7.rst +++ b/doc/releases/release-notes-2.7.rst @@ -79,6 +79,9 @@ Modified in this release * ``m_*`` structure members are now ``c_*`` * ``s_*`` structure members are now ``p_*`` +* The ``CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY`` Kconfig option is now + :kconfig:`CONFIG_BT_PERIPHERAL_PREF_LATENCY` + Changes in this release ========================== diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 0a975c5c911..52b0c27b85f 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -355,10 +355,10 @@ config BT_SMP_USB_HCI_CTLR_WORKAROUND This option enables support for USB HCI controllers that sometimes send out-of-order HCI events and ACL Data due to using different USB endpoints. - Enabling this option will make the master role not require the + Enabling this option will make the central role not require the encryption-change event to be received before accepting key-distribution data. - It opens up for a potential vulnerability as the master cannot detect + It opens up for a potential vulnerability as the central cannot detect if the keys are distributed over an encrypted link. config BT_FIXED_PASSKEY diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index f982c27eadb..29e5d62b030 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -173,8 +173,8 @@ config BT_PERIPHERAL_PREF_MAX_INT help Range 3200 to 65534 is invalid. 65535 represents no specific value. -config BT_PERIPHERAL_PREF_SLAVE_LATENCY - int "Peripheral preferred slave latency in Connection Intervals" +config BT_PERIPHERAL_PREF_LATENCY + int "Peripheral preferred peripheral latency in Connection Intervals" default 0 range 0 499 diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index cafe187f1b9..da94cfae4f9 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1328,14 +1328,14 @@ void notify_le_param_updated(struct bt_conn *conn) struct bt_conn_cb *cb; /* If new connection parameters meet requirement of pending - * parameters don't send slave conn param request anymore on timeout + * parameters don't send peripheral conn param request anymore on timeout */ - if (atomic_test_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET) && + if (atomic_test_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET) && conn->le.interval >= conn->le.interval_min && conn->le.interval <= conn->le.interval_max && conn->le.latency == conn->le.pending_latency && conn->le.timeout == conn->le.pending_timeout) { - atomic_clear_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET); + atomic_clear_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET); } for (cb = callback_list; cb; cb = cb->_next) { @@ -1452,11 +1452,11 @@ static int send_conn_le_param_update(struct bt_conn *conn, } /* Use LE connection parameter request if both local and remote support - * it; or if local role is master then use LE connection update. + * it; or if local role is central then use LE connection update. */ if ((BT_FEAT_LE_CONN_PARAM_REQ_PROC(bt_dev.le.features) && BT_FEAT_LE_CONN_PARAM_REQ_PROC(conn->le.features) && - !atomic_test_bit(conn->flags, BT_CONN_SLAVE_PARAM_L2CAP)) || + !atomic_test_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_L2CAP)) || (conn->role == BT_HCI_ROLE_CENTRAL)) { int rc; @@ -1471,7 +1471,7 @@ static int send_conn_le_param_update(struct bt_conn *conn, return rc; } - /* If remote master does not support LL Connection Parameters Request + /* If remote central does not support LL Connection Parameters Request * Procedure */ return bt_l2cap_update_conn_param(conn, param); @@ -1572,7 +1572,7 @@ static void deferred_work(struct k_work *work) /* if application set own params use those, otherwise use defaults. */ if (atomic_test_and_clear_bit(conn->flags, - BT_CONN_SLAVE_PARAM_SET)) { + BT_CONN_PERIPHERAL_PARAM_SET)) { param = BT_LE_CONN_PARAM(conn->le.interval_min, conn->le.interval_max, conn->le.pending_latency, @@ -1583,13 +1583,13 @@ static void deferred_work(struct k_work *work) param = BT_LE_CONN_PARAM( CONFIG_BT_PERIPHERAL_PREF_MIN_INT, CONFIG_BT_PERIPHERAL_PREF_MAX_INT, - CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY, + CONFIG_BT_PERIPHERAL_PREF_LATENCY, CONFIG_BT_PERIPHERAL_PREF_TIMEOUT); send_conn_le_param_update(conn, param); #endif } - atomic_set_bit(conn->flags, BT_CONN_SLAVE_PARAM_UPDATE); + atomic_set_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_UPDATE); } static struct bt_conn *acl_conn_new(void) @@ -2335,7 +2335,7 @@ int bt_conn_le_param_update(struct bt_conn *conn, conn->le.interval <= param->interval_max && conn->le.latency == param->latency && conn->le.timeout == param->timeout) { - atomic_clear_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET); + atomic_clear_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET); return -EALREADY; } @@ -2345,8 +2345,8 @@ int bt_conn_le_param_update(struct bt_conn *conn, } if (IS_ENABLED(CONFIG_BT_PERIPHERAL)) { - /* if slave conn param update timer expired just send request */ - if (atomic_test_bit(conn->flags, BT_CONN_SLAVE_PARAM_UPDATE)) { + /* if peripheral conn param update timer expired just send request */ + if (atomic_test_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_UPDATE)) { return send_conn_le_param_update(conn, param); } @@ -2355,7 +2355,7 @@ int bt_conn_le_param_update(struct bt_conn *conn, conn->le.interval_max = param->interval_max; conn->le.pending_latency = param->latency; conn->le.pending_timeout = param->timeout; - atomic_set_bit(conn->flags, BT_CONN_SLAVE_PARAM_SET); + atomic_set_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET); } return 0; @@ -2509,7 +2509,7 @@ int bt_conn_le_create_auto(const struct bt_conn_le_create_param *create_param, err = bt_le_create_conn(conn); if (err) { - BT_ERR("Failed to start whitelist scan"); + BT_ERR("Failed to start filtered scan"); conn->err = 0; bt_conn_set_state(conn, BT_CONN_DISCONNECTED); bt_conn_unref(conn); diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 9ecc24e8acd..145cf348437 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -29,9 +29,9 @@ enum { BT_CONN_BR_PAIRING_INITIATOR, /* local host starts authentication */ BT_CONN_CLEANUP, /* Disconnected, pending cleanup */ BT_CONN_AUTO_PHY_UPDATE, /* Auto-update PHY */ - BT_CONN_SLAVE_PARAM_UPDATE, /* If slave param update timer fired */ - BT_CONN_SLAVE_PARAM_SET, /* If slave param were set from app */ - BT_CONN_SLAVE_PARAM_L2CAP, /* If should force L2CAP for CPUP */ + BT_CONN_PERIPHERAL_PARAM_UPDATE,/* If periph param update timer fired */ + BT_CONN_PERIPHERAL_PARAM_SET, /* If periph param were set from app */ + BT_CONN_PERIPHERAL_PARAM_L2CAP, /* If should force L2CAP for CPUP */ BT_CONN_FORCE_PAIR, /* Pairing even with existing keys. */ BT_CONN_AUTO_PHY_COMPLETE, /* Auto-initiated PHY procedure done */ diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index a1633c9d910..400c0f0531a 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -150,7 +150,7 @@ static ssize_t read_ppcp(struct bt_conn *conn, const struct bt_gatt_attr *attr, ppcp.min_int = sys_cpu_to_le16(CONFIG_BT_PERIPHERAL_PREF_MIN_INT); ppcp.max_int = sys_cpu_to_le16(CONFIG_BT_PERIPHERAL_PREF_MAX_INT); - ppcp.latency = sys_cpu_to_le16(CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY); + ppcp.latency = sys_cpu_to_le16(CONFIG_BT_PERIPHERAL_PREF_LATENCY); ppcp.timeout = sys_cpu_to_le16(CONFIG_BT_PERIPHERAL_PREF_TIMEOUT); return bt_gatt_attr_read(conn, attr, buf, len, offset, &ppcp, diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 28c0ec2aecf..4d43a32e2ab 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -995,11 +995,11 @@ static void le_conn_complete_cancel(void) /* Handle create connection cancel. * * There is no need to check ID address as only one - * connection in master role can be in pending state. + * connection in central role can be in pending state. */ conn = find_pending_connect(BT_HCI_ROLE_CENTRAL, NULL); if (!conn) { - BT_ERR("No pending master connection"); + BT_ERR("No pending central connection"); return; } @@ -1019,7 +1019,7 @@ static void le_conn_complete_cancel(void) } } else { if (atomic_test_bit(conn->flags, BT_CONN_AUTO_CONNECT)) { - /* Restart whitelist initiator after RPA timeout. */ + /* Restart FAL initiator after RPA timeout. */ bt_le_create_conn(conn); } else { /* Create connection canceled by timeout */ @@ -1052,11 +1052,11 @@ static void le_conn_complete_adv_timeout(void) } /* There is no need to check ID address as only one - * connection in slave role can be in pending state. + * connection in peripheral role can be in pending state. */ conn = find_pending_connect(BT_HCI_ROLE_PERIPHERAL, NULL); if (!conn) { - BT_ERR("No pending slave connection"); + BT_ERR("No pending peripheral connection"); return; } @@ -1200,7 +1200,7 @@ void bt_hci_le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt) #endif /* * Use connection address (instead of identity address) as initiator - * or responder address. Only slave needs to be updated. For master all + * or responder address. Only peripheral needs to be updated. For central all * was set during outgoing connection creation. */ if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && @@ -1234,9 +1234,9 @@ void bt_hci_le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt) } /* if the controller supports, lets advertise for another - * slave connection. + * peripheral connection. * check for connectable advertising state is sufficient as - * this is how this le connection complete for slave occurred. + * this is how this le connection complete for peripheral occurred. */ if (BT_LE_STATES_PER_CONN_ADV(bt_dev.le.states)) { bt_le_adv_resume(); @@ -1568,7 +1568,7 @@ static void le_conn_update_complete(struct net_buf *buf) } else if (evt->status == BT_HCI_ERR_UNSUPP_REMOTE_FEATURE && conn->role == BT_HCI_ROLE_PERIPHERAL && !atomic_test_and_set_bit(conn->flags, - BT_CONN_SLAVE_PARAM_L2CAP)) { + BT_CONN_PERIPHERAL_PARAM_L2CAP)) { /* CPR not supported, let's try L2CAP CPUP instead */ struct bt_le_conn_param param; @@ -1787,7 +1787,7 @@ static void hci_encrypt_change(struct net_buf *buf) if (IS_ENABLED(CONFIG_BT_SMP)) { /* * Start SMP over BR/EDR if we are pairing and are - * master on the link + * central on the link */ if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRING) && conn->role == BT_CONN_ROLE_CENTRAL) { @@ -3688,7 +3688,7 @@ int bt_le_filter_accept_list_add(const bt_addr_le_t *addr) err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_ADD_DEV_TO_FAL, buf, NULL); if (err) { - BT_ERR("Failed to add device to whitelist"); + BT_ERR("Failed to add device to filter accept list"); return err; } @@ -3716,7 +3716,7 @@ int bt_le_filter_accept_list_remove(const bt_addr_le_t *addr) err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_REM_DEV_FROM_FAL, buf, NULL); if (err) { - BT_ERR("Failed to remove device from whitelist"); + BT_ERR("Failed to remove device from filter accept list"); return err; } @@ -3733,7 +3733,7 @@ int bt_le_filter_accept_list_clear(void) err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_CLEAR_FAL, NULL, NULL); if (err) { - BT_ERR("Failed to clear whitelist"); + BT_ERR("Failed to clear filter accept list"); return err; } diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index 6bfca8bf880..1fc37f7f7c0 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -38,7 +38,7 @@ enum { BT_DEV_EXPLICIT_SCAN, BT_DEV_ACTIVE_SCAN, BT_DEV_SCAN_FILTER_DUP, - BT_DEV_SCAN_WL, + BT_DEV_SCAN_FILTERED, BT_DEV_SCAN_LIMITED, BT_DEV_INITIATING, diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 682dc4651ea..07ac22b0678 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -412,7 +412,7 @@ static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason) chan->iso = NULL; } else { /* ISO data paths are automatically removed when the - * peripheral/slave disconnects, so we only need to + * peripheral disconnects, so we only need to * move it for the central */ bt_iso_remove_data_path(chan->iso); diff --git a/subsys/bluetooth/host/keys.c b/subsys/bluetooth/host/keys.c index 2cbb4cb1ee2..7d8097b7e27 100644 --- a/subsys/bluetooth/host/keys.c +++ b/subsys/bluetooth/host/keys.c @@ -490,8 +490,8 @@ void bt_keys_show_sniffer_info(struct bt_keys *keys, void *data) BT_INFO("SC LTK: 0x%s", bt_hex(ltk, keys->enc_size)); } - if (keys->keys & BT_KEYS_SLAVE_LTK) { - sys_memcpy_swap(ltk, keys->slave_ltk.val, keys->enc_size); + if (keys->keys & BT_KEYS_PERIPH_LTK) { + sys_memcpy_swap(ltk, keys->periph_ltk.val, keys->enc_size); BT_INFO("Legacy LTK: 0x%s (peripheral)", bt_hex(ltk, keys->enc_size)); } diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index e51329d68c4..90dcbe8c941 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -7,15 +7,15 @@ */ enum { - BT_KEYS_SLAVE_LTK = BIT(0), + BT_KEYS_PERIPH_LTK = BIT(0), BT_KEYS_IRK = BIT(1), BT_KEYS_LTK = BIT(2), BT_KEYS_LOCAL_CSRK = BIT(3), BT_KEYS_REMOTE_CSRK = BIT(4), BT_KEYS_LTK_P256 = BIT(5), - BT_KEYS_ALL = (BT_KEYS_SLAVE_LTK | BT_KEYS_IRK | \ - BT_KEYS_LTK | BT_KEYS_LOCAL_CSRK | \ + BT_KEYS_ALL = (BT_KEYS_PERIPH_LTK | BT_KEYS_IRK | + BT_KEYS_LTK | BT_KEYS_LOCAL_CSRK | BT_KEYS_REMOTE_CSRK | BT_KEYS_LTK_P256), }; @@ -63,7 +63,7 @@ struct bt_keys { struct bt_csrk remote_csrk; #endif /* BT_SIGNING */ #if !defined(CONFIG_BT_SMP_SC_PAIR_ONLY) - struct bt_ltk slave_ltk; + struct bt_ltk periph_ltk; #endif /* CONFIG_BT_SMP_SC_PAIR_ONLY */ #if (defined(CONFIG_BT_KEYS_OVERWRITE_OLDEST)) uint32_t aging_counter; diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index 44d688e2273..11223a8f9ae 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -161,7 +161,7 @@ static int start_le_scan_ext(struct bt_hci_ext_scan_phy *phy_1m, set_param->phys = 0; if (IS_ENABLED(CONFIG_BT_FILTER_ACCEPT_LIST) && - atomic_test_bit(bt_dev.flags, BT_DEV_SCAN_WL)) { + atomic_test_bit(bt_dev.flags, BT_DEV_SCAN_FILTERED)) { set_param->filter_policy = BT_HCI_LE_SCAN_FP_BASIC_FILTER; } else { set_param->filter_policy = BT_HCI_LE_SCAN_FP_BASIC_NO_FILTER; @@ -210,7 +210,7 @@ static int start_le_scan_legacy(uint8_t scan_type, uint16_t interval, uint16_t w set_param.window = sys_cpu_to_le16(window); if (IS_ENABLED(CONFIG_BT_FILTER_ACCEPT_LIST) && - atomic_test_bit(bt_dev.flags, BT_DEV_SCAN_WL)) { + atomic_test_bit(bt_dev.flags, BT_DEV_SCAN_FILTERED)) { set_param.filter_policy = BT_HCI_LE_SCAN_FP_BASIC_FILTER; } else { set_param.filter_policy = BT_HCI_LE_SCAN_FP_BASIC_NO_FILTER; @@ -992,7 +992,7 @@ int bt_le_scan_start(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb) param->options & BT_LE_SCAN_OPT_FILTER_DUPLICATE); #if defined(CONFIG_BT_FILTER_ACCEPT_LIST) - atomic_set_bit_to(bt_dev.flags, BT_DEV_SCAN_WL, + atomic_set_bit_to(bt_dev.flags, BT_DEV_SCAN_FILTERED, param->options & BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST); #endif /* defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index ec9fa0b07d1..3cdbc537b70 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -127,7 +127,7 @@ enum { SMP_FLAG_BOND, /* if bonding */ SMP_FLAG_SC_DEBUG_KEY, /* if Secure Connection are using debug key */ SMP_FLAG_SEC_REQ, /* if Security Request was sent/received */ - SMP_FLAG_DHCHECK_WAIT, /* if waiting for remote DHCheck (as slave) */ + SMP_FLAG_DHCHECK_WAIT, /* if waiting for remote DHCheck (as periph) */ SMP_FLAG_DERIVE_LK, /* if Link Key should be derived */ SMP_FLAG_BR_CONNECTED, /* if BR/EDR channel is connected */ SMP_FLAG_BR_PAIR, /* if should start BR/EDR pairing */ @@ -1355,7 +1355,7 @@ static uint8_t smp_br_pairing_req(struct bt_smp_br *smp, struct net_buf *buf) smp->local_dist &= ~BT_SMP_DIST_ENC_KEY; smp->remote_dist &= ~BT_SMP_DIST_ENC_KEY; - /* BR/EDR acceptor is like LE Slave and distributes keys first */ + /* BR/EDR acceptor is like LE Peripheral and distributes keys first */ smp_br_distribute_keys(smp); if (smp->remote_dist & BT_SMP_DIST_ID_KEY) { @@ -1396,7 +1396,7 @@ static uint8_t smp_br_pairing_rsp(struct bt_smp_br *smp, struct net_buf *buf) smp->local_dist &= SEND_KEYS_SC; smp->remote_dist &= RECV_KEYS_SC; - /* slave distributes its keys first */ + /* Peripheral distributes its keys first */ if (smp->remote_dist & BT_SMP_DIST_ID_KEY) { atomic_set_bit(smp->allowed_cmds, BT_SMP_CMD_IDENT_INFO); @@ -1567,7 +1567,7 @@ static const struct { { }, /* pairing random not used over BR/EDR */ { smp_br_pairing_failed, sizeof(struct bt_smp_pairing_fail) }, { }, /* encrypt info not used over BR/EDR */ - { }, /* master ident not used over BR/EDR */ + { }, /* central ident not used over BR/EDR */ { smp_br_ident_info, sizeof(struct bt_smp_ident_info) }, { smp_br_ident_addr_info, sizeof(struct bt_smp_ident_addr_info) }, { smp_br_signing_info, sizeof(struct bt_smp_signing_info) }, @@ -2098,7 +2098,7 @@ static void legacy_distribute_keys(struct bt_smp *smp) if (smp->local_dist & BT_SMP_DIST_ENC_KEY) { struct bt_smp_encrypt_info *info; - struct bt_smp_master_ident *ident; + struct bt_smp_central_ident *ident; struct net_buf *buf; /* Use struct to get randomness in single call to bt_rand */ struct { @@ -2130,10 +2130,10 @@ static void legacy_distribute_keys(struct bt_smp *smp) smp_send(smp, buf, NULL, NULL); - buf = smp_create_pdu(smp, BT_SMP_CMD_MASTER_IDENT, + buf = smp_create_pdu(smp, BT_SMP_CMD_CENTRAL_IDENT, sizeof(*ident)); if (!buf) { - BT_ERR("Unable to allocate Master Ident buffer"); + BT_ERR("Unable to allocate Central Ident buffer"); return; } @@ -2144,14 +2144,14 @@ static void legacy_distribute_keys(struct bt_smp *smp) smp_send(smp, buf, smp_ident_sent, NULL); if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) { - bt_keys_add_type(keys, BT_KEYS_SLAVE_LTK); + bt_keys_add_type(keys, BT_KEYS_PERIPH_LTK); - memcpy(keys->slave_ltk.val, rand.key, - sizeof(keys->slave_ltk.val)); - memcpy(keys->slave_ltk.rand, rand.rand, - sizeof(keys->slave_ltk.rand)); - memcpy(keys->slave_ltk.ediv, rand.ediv, - sizeof(keys->slave_ltk.ediv)); + memcpy(keys->periph_ltk.val, rand.key, + sizeof(keys->periph_ltk.val)); + memcpy(keys->periph_ltk.rand, rand.rand, + sizeof(keys->periph_ltk.rand)); + memcpy(keys->periph_ltk.ediv, rand.ediv, + sizeof(keys->periph_ltk.ediv)); } } } @@ -2483,7 +2483,7 @@ static uint8_t legacy_pairing_random(struct bt_smp *smp) conn->role == BT_HCI_ROLE_CENTRAL) { uint8_t ediv[2], rand[8]; - /* No need to store master STK */ + /* No need to store central STK */ err = smp_s1(smp->tk, smp->rrnd, smp->prnd, tmp); if (err) { return BT_SMP_ERR_UNSPECIFIED; @@ -2607,12 +2607,12 @@ static uint8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) memcpy(keys->ltk.val, req->ltk, 16); } - atomic_set_bit(smp->allowed_cmds, BT_SMP_CMD_MASTER_IDENT); + atomic_set_bit(smp->allowed_cmds, BT_SMP_CMD_CENTRAL_IDENT); return 0; } -static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) +static uint8_t smp_central_ident(struct bt_smp *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; uint8_t err; @@ -2620,7 +2620,7 @@ static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) BT_DBG(""); if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) { - struct bt_smp_master_ident *req = (void *)buf->data; + struct bt_smp_central_ident *req = (void *)buf->data; struct bt_keys *keys; keys = bt_keys_get_type(BT_KEYS_LTK, conn->id, &conn->le.dst); @@ -2696,7 +2696,7 @@ static uint8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) return BT_SMP_ERR_CMD_NOTSUPP; } -static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) +static uint8_t smp_central_ident(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } @@ -2863,7 +2863,7 @@ bool bt_smp_request_ltk(struct bt_conn *conn, uint64_t rand, uint16_t ediv, uint conn->le.keys = bt_keys_find(BT_KEYS_LTK_P256, conn->id, &conn->le.dst); if (!conn->le.keys) { - conn->le.keys = bt_keys_find(BT_KEYS_SLAVE_LTK, + conn->le.keys = bt_keys_find(BT_KEYS_PERIPH_LTK, conn->id, &conn->le.dst); } } @@ -2883,12 +2883,12 @@ bool bt_smp_request_ltk(struct bt_conn *conn, uint64_t rand, uint16_t ediv, uint } #if !defined(CONFIG_BT_SMP_SC_PAIR_ONLY) - if (conn->le.keys && (conn->le.keys->keys & BT_KEYS_SLAVE_LTK) && - !memcmp(conn->le.keys->slave_ltk.rand, &rand, 8) && - !memcmp(conn->le.keys->slave_ltk.ediv, &ediv, 2)) { + if (conn->le.keys && (conn->le.keys->keys & BT_KEYS_PERIPH_LTK) && + !memcmp(conn->le.keys->periph_ltk.rand, &rand, 8) && + !memcmp(conn->le.keys->periph_ltk.ediv, &ediv, 2)) { enc_size = conn->le.keys->enc_size; - memcpy(ltk, conn->le.keys->slave_ltk.val, enc_size); + memcpy(ltk, conn->le.keys->periph_ltk.val, enc_size); if (enc_size < BT_SMP_MAX_ENC_KEY_SIZE) { (void)memset(ltk + enc_size, 0, BT_SMP_MAX_ENC_KEY_SIZE - enc_size); @@ -2901,7 +2901,7 @@ bool bt_smp_request_ltk(struct bt_conn *conn, uint64_t rand, uint16_t ediv, uint if (atomic_test_bit(smp->flags, SMP_FLAG_SEC_REQ)) { /* Notify higher level that security failed if security was - * initiated by slave. + * initiated by peripheral. */ bt_conn_security_changed(conn, BT_HCI_ERR_PIN_OR_KEY_MISSING, BT_SECURITY_ERR_PIN_OR_KEY_MISSING); @@ -3380,7 +3380,7 @@ static uint8_t sc_smp_send_dhkey_check(struct bt_smp *smp, const uint8_t *e) } #if defined(CONFIG_BT_CENTRAL) -static uint8_t compute_and_send_master_dhcheck(struct bt_smp *smp) +static uint8_t compute_and_send_central_dhcheck(struct bt_smp *smp) { uint8_t e[16], r[16]; @@ -3426,7 +3426,7 @@ static uint8_t compute_and_send_master_dhcheck(struct bt_smp *smp) #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_PERIPHERAL) -static uint8_t compute_and_check_and_send_slave_dhcheck(struct bt_smp *smp) +static uint8_t compute_and_check_and_send_periph_dhcheck(struct bt_smp *smp) { uint8_t re[16], e[16], r[16]; uint8_t err; @@ -3541,13 +3541,13 @@ static uint8_t smp_dhkey_ready(struct bt_smp *smp, const uint8_t *dhkey) if (atomic_test_bit(smp->flags, SMP_FLAG_DHKEY_SEND)) { #if defined(CONFIG_BT_CENTRAL) if (smp->chan.chan.conn->role == BT_HCI_ROLE_CENTRAL) { - return compute_and_send_master_dhcheck(smp); + return compute_and_send_central_dhcheck(smp); } #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_PERIPHERAL) - return compute_and_check_and_send_slave_dhcheck(smp); + return compute_and_check_and_send_periph_dhcheck(smp); #endif /* CONFIG_BT_PERIPHERAL */ } @@ -3744,7 +3744,7 @@ static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf) return 0; } - return compute_and_send_master_dhcheck(smp); + return compute_and_send_central_dhcheck(smp); } #endif /* CONFIG_BT_CENTRAL */ @@ -4158,7 +4158,7 @@ static uint8_t display_passkey(struct bt_smp *smp) } #if defined(CONFIG_BT_PERIPHERAL) -static uint8_t smp_public_key_slave(struct bt_smp *smp) +static uint8_t smp_public_key_periph(struct bt_smp *smp) { uint8_t err; @@ -4317,7 +4317,7 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) return 0; } - err = smp_public_key_slave(smp); + err = smp_public_key_periph(smp); if (err) { return err; } @@ -4411,7 +4411,7 @@ static uint8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf) return 0; } - return compute_and_check_and_send_slave_dhcheck(smp); + return compute_and_check_and_send_periph_dhcheck(smp); } #endif /* CONFIG_BT_PERIPHERAL */ @@ -4441,7 +4441,7 @@ static const struct { { smp_pairing_random, sizeof(struct bt_smp_pairing_random) }, { smp_pairing_failed, sizeof(struct bt_smp_pairing_fail) }, { smp_encrypt_info, sizeof(struct bt_smp_encrypt_info) }, - { smp_master_ident, sizeof(struct bt_smp_master_ident) }, + { smp_central_ident, sizeof(struct bt_smp_central_ident) }, { smp_ident_info, sizeof(struct bt_smp_ident_info) }, { smp_ident_addr_info, sizeof(struct bt_smp_ident_addr_info) }, { smp_signing_info, sizeof(struct bt_smp_signing_info) }, @@ -4551,7 +4551,7 @@ static void bt_smp_pkey_ready(const uint8_t *pkey) } #if defined(CONFIG_BT_PERIPHERAL) - err = smp_public_key_slave(smp); + err = smp_public_key_periph(smp); if (err) { smp_error(smp, err); } @@ -4639,7 +4639,7 @@ static void bt_smp_encrypt_change(struct bt_l2cap_chan *chan, } /* We were waiting for encryption but with no pairing in progress. - * This can happen if paired slave sent Security Request and we + * This can happen if paired peripheral sent Security Request and we * enabled encryption. */ if (!atomic_test_bit(smp->flags, SMP_FLAG_PAIRING)) { @@ -4685,7 +4685,7 @@ static void bt_smp_encrypt_change(struct bt_l2cap_chan *chan, atomic_set_bit(smp->flags, SMP_FLAG_KEYS_DISTR); - /* Slave distributes it's keys first */ + /* Peripheral distributes it's keys first */ if (IS_ENABLED(CONFIG_BT_CENTRAL) && conn->role == BT_HCI_ROLE_CENTRAL && smp->remote_dist) { return; @@ -5332,7 +5332,7 @@ int bt_smp_auth_passkey_confirm(struct bt_conn *conn) #if defined(CONFIG_BT_CENTRAL) if (smp->chan.chan.conn->role == BT_HCI_ROLE_CENTRAL) { - err = compute_and_send_master_dhcheck(smp); + err = compute_and_send_central_dhcheck(smp); if (err) { smp_error(smp, err); } @@ -5341,7 +5341,7 @@ int bt_smp_auth_passkey_confirm(struct bt_conn *conn) #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_PERIPHERAL) - err = compute_and_check_and_send_slave_dhcheck(smp); + err = compute_and_check_and_send_periph_dhcheck(smp); if (err) { smp_error(smp, err); } @@ -5657,7 +5657,7 @@ int bt_smp_start_security(struct bt_conn *conn) return smp_send_pairing_req(conn); } - /* LE SC LTK and legacy master LTK are stored in same place */ + /* LE SC LTK and legacy central LTK are stored in same place */ err = bt_conn_le_start_encryption(conn, conn->le.keys->ltk.rand, conn->le.keys->ltk.ediv, diff --git a/subsys/bluetooth/host/smp.h b/subsys/bluetooth/host/smp.h index d629b4732e8..f9275339405 100644 --- a/subsys/bluetooth/host/smp.h +++ b/subsys/bluetooth/host/smp.h @@ -86,8 +86,8 @@ struct bt_smp_encrypt_info { uint8_t ltk[16]; } __packed; -#define BT_SMP_CMD_MASTER_IDENT 0x07 -struct bt_smp_master_ident { +#define BT_SMP_CMD_CENTRAL_IDENT 0x0 +struct bt_smp_central_ident { uint8_t ediv[2]; uint8_t rand[8]; } __packed;