Lines Matching full:ctx
148 static void enc_setup_lll(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t role) in enc_setup_lll() argument
153 ecb_encrypt(&ctx->data.enc.ltk[0], &ctx->data.enc.skd[0], NULL, &conn->lll.ccm_rx.key[0]); in enc_setup_lll()
183 static struct node_tx *llcp_lp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in llcp_lp_enc_tx() argument
189 tx = llcp_tx_alloc(conn, ctx); in llcp_lp_enc_tx()
197 llcp_pdu_encode_enc_req(ctx, pdu); in llcp_lp_enc_tx()
212 ctx->tx_opcode = pdu->llctrl.opcode; in llcp_lp_enc_tx()
223 static void lp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) in lp_enc_ntf() argument
229 ntf = ctx->node_ref.rx; in lp_enc_ntf()
230 ctx->node_ref.rx = NULL; in lp_enc_ntf()
237 if (ctx->data.enc.error == BT_HCI_ERR_SUCCESS) { in lp_enc_ntf()
238 if (ctx->proc == PROC_ENCRYPTION_START) { in lp_enc_ntf()
242 } else if (ctx->proc == PROC_ENCRYPTION_PAUSE) { in lp_enc_ntf()
250 llcp_pdu_encode_reject_ind(pdu, ctx->data.enc.error); in lp_enc_ntf()
254 static void lp_enc_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_enc_complete() argument
256 lp_enc_ntf(conn, ctx); in lp_enc_complete()
258 ctx->state = LP_ENC_STATE_IDLE; in lp_enc_complete()
261 static void lp_enc_store_m(struct ll_conn *conn, struct proc_ctx *ctx, struct pdu_data *pdu) in lp_enc_store_m() argument
264 memcpy(&ctx->data.enc.skd[0], pdu->llctrl.enc_req.skdm, sizeof(pdu->llctrl.enc_req.skdm)); in lp_enc_store_m()
272 static void lp_enc_send_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_send_enc_req() argument
277 if (!llcp_tx_alloc_peek(conn, ctx)) { in lp_enc_send_enc_req()
278 ctx->state = LP_ENC_STATE_WAIT_TX_ENC_REQ; in lp_enc_send_enc_req()
280 tx = llcp_lp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_ENC_REQ); in lp_enc_send_enc_req()
281 lp_enc_store_m(conn, ctx, (struct pdu_data *)tx->pdu); in lp_enc_send_enc_req()
283 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_ENC_RSP; in lp_enc_send_enc_req()
284 ctx->state = LP_ENC_STATE_WAIT_RX_ENC_RSP; in lp_enc_send_enc_req()
292 static void lp_enc_send_pause_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_send_pause_enc_req() argument
295 if (!llcp_tx_alloc_peek(conn, ctx)) { in lp_enc_send_pause_enc_req()
296 ctx->state = LP_ENC_STATE_WAIT_TX_PAUSE_ENC_REQ; in lp_enc_send_pause_enc_req()
298 llcp_lp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ); in lp_enc_send_pause_enc_req()
300 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP; in lp_enc_send_pause_enc_req()
301 ctx->state = LP_ENC_STATE_WAIT_RX_PAUSE_ENC_RSP; in lp_enc_send_pause_enc_req()
305 static void lp_enc_send_pause_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_send_pause_enc_rsp() argument
308 if (!llcp_tx_alloc_peek(conn, ctx)) { in lp_enc_send_pause_enc_rsp()
309 ctx->state = LP_ENC_STATE_WAIT_TX_PAUSE_ENC_RSP; in lp_enc_send_pause_enc_rsp()
311 llcp_lp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP); in lp_enc_send_pause_enc_rsp()
313 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED; in lp_enc_send_pause_enc_rsp()
315 ctx->state = LP_ENC_STATE_UNENCRYPTED; in lp_enc_send_pause_enc_rsp()
325 static void lp_enc_send_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_send_start_enc_rsp() argument
328 if (!llcp_tx_alloc_peek(conn, ctx)) { in lp_enc_send_start_enc_rsp()
329 ctx->state = LP_ENC_STATE_WAIT_TX_START_ENC_RSP; in lp_enc_send_start_enc_rsp()
331 enc_setup_lll(conn, ctx, BT_HCI_ROLE_CENTRAL); in lp_enc_send_start_enc_rsp()
332 llcp_lp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_START_ENC_RSP); in lp_enc_send_start_enc_rsp()
335 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_RSP; in lp_enc_send_start_enc_rsp()
336 ctx->state = LP_ENC_STATE_WAIT_RX_START_ENC_RSP; in lp_enc_send_start_enc_rsp()
346 static void lp_enc_st_wait_tx_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_wait_tx_enc_req() argument
351 lp_enc_send_enc_req(conn, ctx, evt, param); in lp_enc_st_wait_tx_enc_req()
359 static void lp_enc_store_s(struct ll_conn *conn, struct proc_ctx *ctx, struct pdu_data *pdu) in lp_enc_store_s() argument
362 memcpy(&ctx->data.enc.skd[8], pdu->llctrl.enc_rsp.skds, sizeof(pdu->llctrl.enc_rsp.skds)); in lp_enc_store_s()
397 static void lp_enc_st_wait_rx_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_wait_rx_enc_rsp() argument
406 lp_enc_store_s(conn, ctx, pdu); in lp_enc_st_wait_rx_enc_rsp()
414 ctx->rx_greedy = 1U; in lp_enc_st_wait_rx_enc_rsp()
417 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_REQ; in lp_enc_st_wait_rx_enc_rsp()
418 ctx->state = LP_ENC_STATE_WAIT_RX_START_ENC_REQ; in lp_enc_st_wait_rx_enc_rsp()
427 ctx->data.enc.error = reject_error_code(pdu); in lp_enc_st_wait_rx_enc_rsp()
433 lp_enc_complete(conn, ctx, evt, param); in lp_enc_st_wait_rx_enc_rsp()
441 static void lp_enc_st_wait_rx_start_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_wait_rx_start_enc_req() argument
448 lp_enc_send_start_enc_rsp(conn, ctx, evt, param); in lp_enc_st_wait_rx_start_enc_req()
457 ctx->data.enc.error = reject_error_code(pdu); in lp_enc_st_wait_rx_start_enc_req()
463 ctx->rx_greedy = 0U; in lp_enc_st_wait_rx_start_enc_req()
465 lp_enc_complete(conn, ctx, evt, param); in lp_enc_st_wait_rx_start_enc_req()
473 static void lp_enc_st_wait_tx_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_wait_tx_start_enc_rsp() argument
478 lp_enc_send_start_enc_rsp(conn, ctx, evt, param); in lp_enc_st_wait_tx_start_enc_rsp()
486 static void lp_enc_st_wait_rx_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_wait_rx_start_enc_rsp() argument
495 ctx->data.enc.error = BT_HCI_ERR_SUCCESS; in lp_enc_st_wait_rx_start_enc_rsp()
501 ctx->rx_greedy = 0U; in lp_enc_st_wait_rx_start_enc_rsp()
503 lp_enc_complete(conn, ctx, evt, param); in lp_enc_st_wait_rx_start_enc_rsp()
511 static void lp_enc_st_unencrypted(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_unencrypted() argument
518 lp_enc_send_enc_req(conn, ctx, evt, param); in lp_enc_st_unencrypted()
526 static void lp_enc_state_encrypted(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_state_encrypted() argument
533 lp_enc_send_pause_enc_req(conn, ctx, evt, param); in lp_enc_state_encrypted()
541 static void lp_enc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_enc_st_idle() argument
546 if (ctx->proc == PROC_ENCRYPTION_PAUSE) { in lp_enc_st_idle()
547 lp_enc_state_encrypted(conn, ctx, evt, param); in lp_enc_st_idle()
549 lp_enc_st_unencrypted(conn, ctx, evt, param); in lp_enc_st_idle()
558 static void lp_enc_state_wait_tx_pause_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, in lp_enc_state_wait_tx_pause_enc_req() argument
563 lp_enc_send_pause_enc_req(conn, ctx, evt, param); in lp_enc_state_wait_tx_pause_enc_req()
571 static void lp_enc_state_wait_rx_pause_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, in lp_enc_state_wait_rx_pause_enc_rsp() argument
581 lp_enc_send_pause_enc_rsp(conn, ctx, evt, param); in lp_enc_state_wait_rx_pause_enc_rsp()
589 static void lp_enc_state_wait_tx_pause_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, in lp_enc_state_wait_tx_pause_enc_rsp() argument
594 lp_enc_send_pause_enc_rsp(conn, ctx, evt, param); in lp_enc_state_wait_tx_pause_enc_rsp()
602 static void lp_enc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_enc_execute_fsm() argument
604 switch (ctx->state) { in lp_enc_execute_fsm()
606 lp_enc_st_idle(conn, ctx, evt, param); in lp_enc_execute_fsm()
610 lp_enc_st_unencrypted(conn, ctx, evt, param); in lp_enc_execute_fsm()
613 lp_enc_st_wait_tx_enc_req(conn, ctx, evt, param); in lp_enc_execute_fsm()
616 lp_enc_st_wait_rx_enc_rsp(conn, ctx, evt, param); in lp_enc_execute_fsm()
619 lp_enc_st_wait_rx_start_enc_req(conn, ctx, evt, param); in lp_enc_execute_fsm()
622 lp_enc_st_wait_tx_start_enc_rsp(conn, ctx, evt, param); in lp_enc_execute_fsm()
625 lp_enc_st_wait_rx_start_enc_rsp(conn, ctx, evt, param); in lp_enc_execute_fsm()
629 lp_enc_state_encrypted(conn, ctx, evt, param); in lp_enc_execute_fsm()
632 lp_enc_state_wait_tx_pause_enc_req(conn, ctx, evt, param); in lp_enc_execute_fsm()
635 lp_enc_state_wait_rx_pause_enc_rsp(conn, ctx, evt, param); in lp_enc_execute_fsm()
638 lp_enc_state_wait_tx_pause_enc_rsp(conn, ctx, evt, param); in lp_enc_execute_fsm()
646 void llcp_lp_enc_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_lp_enc_rx() argument
652 lp_enc_execute_fsm(conn, ctx, LP_ENC_EVT_ENC_RSP, pdu); in llcp_lp_enc_rx()
655 lp_enc_execute_fsm(conn, ctx, LP_ENC_EVT_START_ENC_REQ, pdu); in llcp_lp_enc_rx()
658 lp_enc_execute_fsm(conn, ctx, LP_ENC_EVT_START_ENC_RSP, pdu); in llcp_lp_enc_rx()
662 lp_enc_execute_fsm(conn, ctx, LP_ENC_EVT_REJECT, pdu); in llcp_lp_enc_rx()
665 lp_enc_execute_fsm(conn, ctx, LP_ENC_EVT_PAUSE_ENC_RSP, pdu); in llcp_lp_enc_rx()
689 void llcp_lp_enc_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_lp_enc_run() argument
691 lp_enc_execute_fsm(conn, ctx, LP_ENC_EVT_RUN, param); in llcp_lp_enc_run()
701 static struct node_tx *llcp_rp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in llcp_rp_enc_tx() argument
707 tx = llcp_tx_alloc(conn, ctx); in llcp_rp_enc_tx()
728 llcp_pdu_encode_reject_ext_ind(pdu, ctx->reject_ext_ind.reject_opcode, in llcp_rp_enc_tx()
729 ctx->reject_ext_ind.error_code); in llcp_rp_enc_tx()
731 llcp_pdu_encode_reject_ind(pdu, ctx->reject_ext_ind.error_code); in llcp_rp_enc_tx()
738 ctx->tx_opcode = pdu->llctrl.opcode; in llcp_rp_enc_tx()
749 static void rp_enc_ntf_ltk(struct ll_conn *conn, struct proc_ctx *ctx) in rp_enc_ntf_ltk() argument
756 ntf = ctx->node_ref.rx; in rp_enc_ntf_ltk()
757 ctx->node_ref.rx = NULL; in rp_enc_ntf_ltk()
766 llcp_ntf_encode_enc_req(ctx, pdu); in rp_enc_ntf_ltk()
775 static void rp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) in rp_enc_ntf() argument
781 ntf = ctx->node_ref.rx; in rp_enc_ntf()
782 ctx->node_ref.rx = NULL; in rp_enc_ntf()
789 if (ctx->proc == PROC_ENCRYPTION_START) { in rp_enc_ntf()
793 } else if (ctx->proc == PROC_ENCRYPTION_PAUSE) { in rp_enc_ntf()
802 static void rp_enc_send_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt,
805 static void rp_enc_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_enc_complete() argument
807 rp_enc_ntf(conn, ctx); in rp_enc_complete()
808 rp_enc_send_start_enc_rsp(conn, ctx, evt, param); in rp_enc_complete()
811 static void rp_enc_store_s(struct ll_conn *conn, struct proc_ctx *ctx, struct pdu_data *pdu) in rp_enc_store_s() argument
814 memcpy(&ctx->data.enc.skds, pdu->llctrl.enc_rsp.skds, sizeof(pdu->llctrl.enc_rsp.skds)); in rp_enc_store_s()
822 static void rp_enc_send_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_send_enc_rsp() argument
827 if (!llcp_tx_alloc_peek(conn, ctx)) { in rp_enc_send_enc_rsp()
829 llcp_rx_node_retain(ctx); in rp_enc_send_enc_rsp()
830 ctx->state = RP_ENC_STATE_WAIT_TX_ENC_RSP; in rp_enc_send_enc_rsp()
832 tx = llcp_rp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_ENC_RSP); in rp_enc_send_enc_rsp()
833 rp_enc_store_s(conn, ctx, (struct pdu_data *)tx->pdu); in rp_enc_send_enc_rsp()
835 rp_enc_ntf_ltk(conn, ctx); in rp_enc_send_enc_rsp()
836 ctx->state = RP_ENC_STATE_WAIT_LTK_REPLY; in rp_enc_send_enc_rsp()
840 static void rp_enc_send_start_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_send_start_enc_req() argument
843 if (!llcp_tx_alloc_peek(conn, ctx)) { in rp_enc_send_start_enc_req()
844 ctx->state = RP_ENC_STATE_WAIT_TX_START_ENC_REQ; in rp_enc_send_start_enc_req()
846 enc_setup_lll(conn, ctx, BT_HCI_ROLE_PERIPHERAL); in rp_enc_send_start_enc_req()
847 llcp_rp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_START_ENC_REQ); in rp_enc_send_start_enc_req()
849 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_RSP; in rp_enc_send_start_enc_req()
850 ctx->state = RP_ENC_STATE_WAIT_RX_START_ENC_RSP; in rp_enc_send_start_enc_req()
857 static void rp_enc_send_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_send_reject_ind() argument
860 if (!llcp_tx_alloc_peek(conn, ctx)) { in rp_enc_send_reject_ind()
861 ctx->state = RP_ENC_STATE_WAIT_TX_REJECT_IND; in rp_enc_send_reject_ind()
863 llcp_rp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_REJECT_IND); in rp_enc_send_reject_ind()
866 if (ctx->data.enc.error == BT_HCI_ERR_PIN_OR_KEY_MISSING) { in rp_enc_send_reject_ind()
872 ctx->state = RP_ENC_STATE_UNENCRYPTED; in rp_enc_send_reject_ind()
880 } else if (ctx->data.enc.error == BT_HCI_ERR_LMP_PDU_NOT_ALLOWED) { in rp_enc_send_reject_ind()
892 static void rp_enc_send_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_send_start_enc_rsp() argument
895 if (!llcp_tx_alloc_peek(conn, ctx)) { in rp_enc_send_start_enc_rsp()
896 ctx->state = RP_ENC_STATE_WAIT_TX_START_ENC_RSP; in rp_enc_send_start_enc_rsp()
898 llcp_rp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_START_ENC_RSP); in rp_enc_send_start_enc_rsp()
900 ctx->state = RP_ENC_STATE_IDLE; in rp_enc_send_start_enc_rsp()
915 static void rp_enc_send_pause_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_send_pause_enc_rsp() argument
918 if (!llcp_tx_alloc_peek(conn, ctx)) { in rp_enc_send_pause_enc_rsp()
919 ctx->state = RP_ENC_STATE_WAIT_TX_PAUSE_ENC_RSP; in rp_enc_send_pause_enc_rsp()
921 llcp_rp_enc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP); in rp_enc_send_pause_enc_rsp()
923 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP; in rp_enc_send_pause_enc_rsp()
924 ctx->state = RP_ENC_STATE_WAIT_RX_PAUSE_ENC_RSP; in rp_enc_send_pause_enc_rsp()
931 static void rp_enc_store_m(struct ll_conn *conn, struct proc_ctx *ctx, struct pdu_data *pdu) in rp_enc_store_m() argument
934 memcpy(ctx->data.enc.rand, pdu->llctrl.enc_req.rand, sizeof(ctx->data.enc.rand)); in rp_enc_store_m()
937 ctx->data.enc.ediv[0] = pdu->llctrl.enc_req.ediv[0]; in rp_enc_store_m()
938 ctx->data.enc.ediv[1] = pdu->llctrl.enc_req.ediv[1]; in rp_enc_store_m()
941 memcpy(&ctx->data.enc.skdm, pdu->llctrl.enc_req.skdm, sizeof(ctx->data.enc.skdm)); in rp_enc_store_m()
950 static void rp_enc_state_wait_rx_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_wait_rx_enc_req() argument
963 rp_enc_store_m(conn, ctx, param); in rp_enc_state_wait_rx_enc_req()
965 rp_enc_send_enc_rsp(conn, ctx, evt, param); in rp_enc_state_wait_rx_enc_req()
973 static void rp_enc_state_wait_tx_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_wait_tx_enc_rsp() argument
978 rp_enc_send_enc_rsp(conn, ctx, evt, param); in rp_enc_state_wait_tx_enc_rsp()
986 static void rp_enc_state_wait_ltk_reply(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_wait_ltk_reply() argument
992 ctx->state = RP_ENC_STATE_WAIT_LTK_REPLY_CONTINUE; in rp_enc_state_wait_ltk_reply()
995 ctx->data.enc.error = BT_HCI_ERR_PIN_OR_KEY_MISSING; in rp_enc_state_wait_ltk_reply()
996 ctx->reject_ext_ind.reject_opcode = PDU_DATA_LLCTRL_TYPE_ENC_REQ; in rp_enc_state_wait_ltk_reply()
997 ctx->reject_ext_ind.error_code = BT_HCI_ERR_PIN_OR_KEY_MISSING; in rp_enc_state_wait_ltk_reply()
999 ctx->state = RP_ENC_STATE_WAIT_TX_REJECT_IND; in rp_enc_state_wait_ltk_reply()
1007 static void rp_enc_state_wait_ltk_reply_continue(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_ltk_reply_continue() argument
1012 rp_enc_send_start_enc_req(conn, ctx, evt, param); in rp_enc_state_wait_ltk_reply_continue()
1020 static void rp_enc_state_wait_tx_start_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_tx_start_enc_req() argument
1025 rp_enc_send_start_enc_req(conn, ctx, evt, param); in rp_enc_state_wait_tx_start_enc_req()
1033 static void rp_enc_state_wait_tx_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_wait_tx_reject_ind() argument
1038 rp_enc_send_reject_ind(conn, ctx, evt, param); in rp_enc_state_wait_tx_reject_ind()
1046 static void rp_enc_state_wait_rx_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_rx_start_enc_rsp() argument
1051 rp_enc_complete(conn, ctx, evt, param); in rp_enc_state_wait_rx_start_enc_rsp()
1059 static void rp_enc_state_wait_tx_start_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_tx_start_enc_rsp() argument
1064 rp_enc_send_start_enc_rsp(conn, ctx, evt, param); in rp_enc_state_wait_tx_start_enc_rsp()
1072 static void rp_enc_state_encrypted(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_encrypted() argument
1077 ctx->state = RP_ENC_STATE_WAIT_RX_PAUSE_ENC_REQ; in rp_enc_state_encrypted()
1085 static void rp_enc_state_unencrypted(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_unencrypted() argument
1090 ctx->state = RP_ENC_STATE_WAIT_RX_ENC_REQ; in rp_enc_state_unencrypted()
1098 static void rp_enc_state_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_enc_state_idle() argument
1103 if (ctx->proc == PROC_ENCRYPTION_PAUSE) { in rp_enc_state_idle()
1104 rp_enc_state_encrypted(conn, ctx, evt, param); in rp_enc_state_idle()
1106 rp_enc_state_unencrypted(conn, ctx, evt, param); in rp_enc_state_idle()
1114 static void rp_enc_state_wait_rx_pause_enc_req(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_rx_pause_enc_req() argument
1129 ctx->data.enc.error = BT_HCI_ERR_LMP_PDU_NOT_ALLOWED; in rp_enc_state_wait_rx_pause_enc_req()
1130 ctx->reject_ext_ind.reject_opcode = in rp_enc_state_wait_rx_pause_enc_req()
1132 ctx->reject_ext_ind.error_code = BT_HCI_ERR_LMP_PDU_NOT_ALLOWED; in rp_enc_state_wait_rx_pause_enc_req()
1133 rp_enc_send_reject_ind(conn, ctx, evt, param); in rp_enc_state_wait_rx_pause_enc_req()
1146 rp_enc_send_pause_enc_rsp(conn, ctx, evt, param); in rp_enc_state_wait_rx_pause_enc_req()
1154 static void rp_enc_state_wait_tx_pause_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_tx_pause_enc_rsp() argument
1159 rp_enc_send_pause_enc_rsp(conn, ctx, evt, param); in rp_enc_state_wait_tx_pause_enc_rsp()
1167 static void rp_enc_state_wait_rx_pause_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, in rp_enc_state_wait_rx_pause_enc_rsp() argument
1174 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_ENC_REQ; in rp_enc_state_wait_rx_pause_enc_rsp()
1175 ctx->state = RP_ENC_STATE_WAIT_RX_ENC_REQ; in rp_enc_state_wait_rx_pause_enc_rsp()
1186 static void rp_enc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_enc_execute_fsm() argument
1188 switch (ctx->state) { in rp_enc_execute_fsm()
1190 rp_enc_state_idle(conn, ctx, evt, param); in rp_enc_execute_fsm()
1194 rp_enc_state_unencrypted(conn, ctx, evt, param); in rp_enc_execute_fsm()
1197 rp_enc_state_wait_rx_enc_req(conn, ctx, evt, param); in rp_enc_execute_fsm()
1200 rp_enc_state_wait_tx_enc_rsp(conn, ctx, evt, param); in rp_enc_execute_fsm()
1203 rp_enc_state_wait_ltk_reply(conn, ctx, evt, param); in rp_enc_execute_fsm()
1206 rp_enc_state_wait_ltk_reply_continue(conn, ctx, evt, param); in rp_enc_execute_fsm()
1209 rp_enc_state_wait_tx_start_enc_req(conn, ctx, evt, param); in rp_enc_execute_fsm()
1212 rp_enc_state_wait_tx_reject_ind(conn, ctx, evt, param); in rp_enc_execute_fsm()
1215 rp_enc_state_wait_rx_start_enc_rsp(conn, ctx, evt, param); in rp_enc_execute_fsm()
1218 rp_enc_state_wait_tx_start_enc_rsp(conn, ctx, evt, param); in rp_enc_execute_fsm()
1222 rp_enc_state_encrypted(conn, ctx, evt, param); in rp_enc_execute_fsm()
1225 rp_enc_state_wait_rx_pause_enc_req(conn, ctx, evt, param); in rp_enc_execute_fsm()
1228 rp_enc_state_wait_tx_pause_enc_rsp(conn, ctx, evt, param); in rp_enc_execute_fsm()
1231 rp_enc_state_wait_rx_pause_enc_rsp(conn, ctx, evt, param); in rp_enc_execute_fsm()
1239 void llcp_rp_enc_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_rp_enc_rx() argument
1245 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_ENC_REQ, pdu); in llcp_rp_enc_rx()
1248 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_START_ENC_RSP, pdu); in llcp_rp_enc_rx()
1251 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_PAUSE_ENC_REQ, pdu); in llcp_rp_enc_rx()
1254 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_PAUSE_ENC_RSP, pdu); in llcp_rp_enc_rx()
1278 void llcp_rp_enc_ltk_req_reply(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_enc_ltk_req_reply() argument
1280 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_LTK_REQ_REPLY, NULL); in llcp_rp_enc_ltk_req_reply()
1283 void llcp_rp_enc_ltk_req_neg_reply(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_enc_ltk_req_neg_reply() argument
1285 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_LTK_REQ_NEG_REPLY, NULL); in llcp_rp_enc_ltk_req_neg_reply()
1288 bool llcp_rp_enc_ltk_req_reply_allowed(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_enc_ltk_req_reply_allowed() argument
1290 return (ctx->state == RP_ENC_STATE_WAIT_LTK_REPLY); in llcp_rp_enc_ltk_req_reply_allowed()
1293 void llcp_rp_enc_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_rp_enc_run() argument
1295 rp_enc_execute_fsm(conn, ctx, RP_ENC_EVT_RUN, param); in llcp_rp_enc_run()