You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2019/08/12 20:24:53 UTC
[mynewt-nimble] branch master updated: nimble/controller: Packet
counter size in connection incorrect.
This is an automated email from the ASF dual-hosted git repository.
wes3 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 943983f nimble/controller: Packet counter size in connection incorrect.
new e52a1f5 Merge pull request #553 from wes3/conn_pkt_cntr_fix
943983f is described below
commit 943983f5e9c3bd03f70d78137d4b1976f9408eed
Author: Will San Filippo <wi...@juul.com>
AuthorDate: Tue Aug 6 14:47:47 2019 -0700
nimble/controller: Packet counter size in connection incorrect.
The transmit and receive packet counters were incorrectly sized at
16 bits. The specification dictates 39 bits of packet counter. The
fix makes them 32 bits as opposed to the full 39 as we do not think
the chance of there being more than 2^32 packets during a connection
likely and thus does not warrant the additioal RAM usage per
connection (nor the slight addition to code space and speed).
---
nimble/controller/include/controller/ble_ll_conn.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/nimble/controller/include/controller/ble_ll_conn.h b/nimble/controller/include/controller/ble_ll_conn.h
index 14a1972..97492af 100644
--- a/nimble/controller/include/controller/ble_ll_conn.h
+++ b/nimble/controller/include/controller/ble_ll_conn.h
@@ -81,14 +81,20 @@ enum conn_enc_state {
/*
* Note that the LTK is the key, the SDK is the plain text, and the
* session key is the cipher text portion of the encryption block.
+ *
+ * NOTE: we have intentionally violated the specification by making the
+ * transmit and receive packet counters 32-bits as opposed to 39 (as per the
+ * specification). We do this to save code space, ram and calculation time. The
+ * only drawback is that any encrypted connection that sends more than 2^32
+ * packets will suffer a MIC failure and thus be disconnected.
*/
struct ble_ll_conn_enc_data
{
uint8_t enc_state;
uint8_t tx_encrypted;
uint16_t enc_div;
- uint16_t tx_pkt_cntr;
- uint16_t rx_pkt_cntr;
+ uint32_t tx_pkt_cntr;
+ uint32_t rx_pkt_cntr;
uint64_t host_rand_num;
uint8_t iv[8];
struct ble_encryption_block enc_block;