You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2019/02/07 19:51:19 UTC

[mynewt-nimble] branch master updated: nimble/ll: Fix handling RX data while encryption as a Slave

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 44569e1  nimble/ll: Fix handling RX data while encryption as a Slave
44569e1 is described below

commit 44569e1c72951a014a07ec7c088e85a8596e52f1
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Thu Feb 7 00:55:48 2019 +0100

    nimble/ll: Fix handling RX data while encryption as a Slave
    
    Set enc_stat in the LL_ENC_REQ handler and not when sending LL_ENC_RSP.
    This is in order to make sure that next incoming PDU will be
    alread verified
    
    This fix small rate of failures of LL/SEC/SLA/BI-05
---
 nimble/controller/src/ble_ll_ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nimble/controller/src/ble_ll_ctrl.c b/nimble/controller/src/ble_ll_ctrl.c
index 709209c..06b76c4 100644
--- a/nimble/controller/src/ble_ll_ctrl.c
+++ b/nimble/controller/src/ble_ll_ctrl.c
@@ -1295,6 +1295,8 @@ ble_ll_ctrl_rx_enc_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
         return BLE_LL_CTRL_UNKNOWN_RSP;
     }
 
+    connsm->enc_data.enc_state = CONN_ENC_S_LTK_REQ_WAIT;
+
     /* In case we were already encrypted we need to reset packet counters */
     connsm->enc_data.rx_pkt_cntr = 0;
     connsm->enc_data.tx_pkt_cntr = 0;
@@ -2621,7 +2623,6 @@ ble_ll_ctrl_tx_done(struct os_mbuf *txpdu, struct ble_ll_conn_sm *connsm)
         connsm->enc_data.enc_state = CONN_ENC_S_ENC_RSP_WAIT;
         break;
     case BLE_LL_CTRL_ENC_RSP:
-        connsm->enc_data.enc_state = CONN_ENC_S_LTK_REQ_WAIT;
         connsm->csmflags.cfbit.send_ltk_req = 1;
         break;
     case BLE_LL_CTRL_START_ENC_RSP: