Skip to content

Commit a5b3a14

Browse files
committed
Bluetooth: Controller: Refactor BT_CTLR_LE_ENC implementation
Refactor reused function in BT_CTLR_LE_ENC feature. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 100c57c commit a5b3a14

File tree

1 file changed

+4
-4
lines changed
  • subsys/bluetooth/controller/hci

1 file changed

+4
-4
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6319,7 +6319,7 @@ static void le_ltk_request(struct pdu_data *pdu_data, uint16_t handle,
63196319
}
63206320

63216321
static void encrypt_change(uint8_t err, uint16_t handle,
6322-
struct net_buf *buf)
6322+
struct net_buf *buf, bool encryption_on)
63236323
{
63246324
struct bt_hci_evt_encrypt_change *ep;
63256325

@@ -6332,7 +6332,7 @@ static void encrypt_change(uint8_t err, uint16_t handle,
63326332

63336333
ep->status = err;
63346334
ep->handle = sys_cpu_to_le16(handle);
6335-
ep->encrypt = !err ? 1 : 0;
6335+
ep->encrypt = encryption_on ? 1 : 0;
63366336
}
63376337
#endif /* CONFIG_BT_CTLR_LE_ENC */
63386338

@@ -6457,7 +6457,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
64576457
break;
64586458

64596459
case PDU_DATA_LLCTRL_TYPE_START_ENC_RSP:
6460-
encrypt_change(0x00, handle, buf);
6460+
encrypt_change(0x00, handle, buf, true);
64616461
break;
64626462
#endif /* CONFIG_BT_CTLR_LE_ENC */
64636463

@@ -6474,7 +6474,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
64746474
#if defined(CONFIG_BT_CTLR_LE_ENC)
64756475
case PDU_DATA_LLCTRL_TYPE_REJECT_IND:
64766476
encrypt_change(pdu_data->llctrl.reject_ind.error_code, handle,
6477-
buf);
6477+
buf, false);
64786478
break;
64796479
#endif /* CONFIG_BT_CTLR_LE_ENC */
64806480

0 commit comments

Comments
 (0)