Skip to content

Commit

Permalink
Bluetooth: Controller: Refactor BT_CTLR_LE_ENC implementation
Browse files Browse the repository at this point in the history
Refactor reused function in BT_CTLR_LE_ENC feature.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak committed Jun 12, 2024
1 parent 100c57c commit a5b3a14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions subsys/bluetooth/controller/hci/hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -6319,7 +6319,7 @@ static void le_ltk_request(struct pdu_data *pdu_data, uint16_t handle,
}

static void encrypt_change(uint8_t err, uint16_t handle,
struct net_buf *buf)
struct net_buf *buf, bool encryption_on)
{
struct bt_hci_evt_encrypt_change *ep;

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

ep->status = err;
ep->handle = sys_cpu_to_le16(handle);
ep->encrypt = !err ? 1 : 0;
ep->encrypt = encryption_on ? 1 : 0;
}
#endif /* CONFIG_BT_CTLR_LE_ENC */

Expand Down Expand Up @@ -6457,7 +6457,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
break;

case PDU_DATA_LLCTRL_TYPE_START_ENC_RSP:
encrypt_change(0x00, handle, buf);
encrypt_change(0x00, handle, buf, true);
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */

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

Expand Down

0 comments on commit a5b3a14

Please sign in to comment.