Skip to content

Commit 34675d9

Browse files
cvinayakanangl
authored andcommitted
[nrf fromtree] 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 996a1da commit 34675d9

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
@@ -8617,7 +8617,7 @@ static void le_ltk_request(struct pdu_data *pdu_data, uint16_t handle,
86178617
}
86188618

86198619
static void encrypt_change(uint8_t err, uint16_t handle,
8620-
struct net_buf *buf)
8620+
struct net_buf *buf, bool encryption_on)
86218621
{
86228622
struct bt_hci_evt_encrypt_change *ep;
86238623

@@ -8630,7 +8630,7 @@ static void encrypt_change(uint8_t err, uint16_t handle,
86308630

86318631
ep->status = err;
86328632
ep->handle = sys_cpu_to_le16(handle);
8633-
ep->encrypt = !err ? 1 : 0;
8633+
ep->encrypt = encryption_on ? 1 : 0;
86348634
}
86358635
#endif /* CONFIG_BT_CTLR_LE_ENC */
86368636

@@ -8772,7 +8772,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
87728772
break;
87738773

87748774
case PDU_DATA_LLCTRL_TYPE_START_ENC_RSP:
8775-
encrypt_change(0x00, handle, buf);
8775+
encrypt_change(0x00, handle, buf, true);
87768776
break;
87778777
#endif /* CONFIG_BT_CTLR_LE_ENC */
87788778

@@ -8789,7 +8789,7 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
87898789
#if defined(CONFIG_BT_CTLR_LE_ENC)
87908790
case PDU_DATA_LLCTRL_TYPE_REJECT_IND:
87918791
encrypt_change(pdu_data->llctrl.reject_ind.error_code, handle,
8792-
buf);
8792+
buf, false);
87938793
break;
87948794
#endif /* CONFIG_BT_CTLR_LE_ENC */
87958795

0 commit comments

Comments
 (0)