Skip to content

Commit e31a6ef

Browse files
cvinayakhenrikbrixandersen
authored andcommitted
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]> (cherry picked from commit fe205a5) Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 9d03b8f commit e31a6ef

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
@@ -8516,7 +8516,7 @@ static void le_ltk_request(struct pdu_data *pdu_data, uint16_t handle,
85168516
}
85178517

85188518
static void encrypt_change(uint8_t err, uint16_t handle,
8519-
struct net_buf *buf)
8519+
struct net_buf *buf, bool encryption_on)
85208520
{
85218521
struct bt_hci_evt_encrypt_change *ep;
85228522

@@ -8529,7 +8529,7 @@ static void encrypt_change(uint8_t err, uint16_t handle,
85298529

85308530
ep->status = err;
85318531
ep->handle = sys_cpu_to_le16(handle);
8532-
ep->encrypt = !err ? 1 : 0;
8532+
ep->encrypt = encryption_on ? 1 : 0;
85338533
}
85348534
#endif /* CONFIG_BT_CTLR_LE_ENC */
85358535

@@ -8671,7 +8671,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
86718671
break;
86728672

86738673
case PDU_DATA_LLCTRL_TYPE_START_ENC_RSP:
8674-
encrypt_change(0x00, handle, buf);
8674+
encrypt_change(0x00, handle, buf, true);
86758675
break;
86768676
#endif /* CONFIG_BT_CTLR_LE_ENC */
86778677

@@ -8688,7 +8688,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
86888688
#if defined(CONFIG_BT_CTLR_LE_ENC)
86898689
case PDU_DATA_LLCTRL_TYPE_REJECT_IND:
86908690
encrypt_change(pdu_data->llctrl.reject_ind.error_code, handle,
8691-
buf);
8691+
buf, false);
86928692
break;
86938693
#endif /* CONFIG_BT_CTLR_LE_ENC */
86948694

0 commit comments

Comments
 (0)