You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2019/03/22 10:23:29 UTC
[mynewt-nimble] branch master updated: nimble/sm: Fix bonding when
key distribution is one-sided
This is an automated email from the ASF dual-hosted git repository.
naraj 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 2776b8f nimble/sm: Fix bonding when key distribution is one-sided
2776b8f is described below
commit 2776b8f738629bf4ad25104e83225212b94bb1d9
Author: MichaĆ Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Mar 13 12:40:55 2019 +0100
nimble/sm: Fix bonding when key distribution is one-sided
When using Legacy pairing, Nimble is a slave/responder and
the initiator set key distribution to 0 then our LTK would
not be stored and it wouldn't be possible to restore encryption later.
In legacy mode, bonding requires the exchange of keys at least
from one side. If no key exchange was specified, pretend bonding
is not enabled.
This fixes SM/SLA/KDU/BV-07-C.
---
nimble/host/src/ble_sm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c
index 1b8bbca..b688a66 100644
--- a/nimble/host/src/ble_sm.c
+++ b/nimble/host/src/ble_sm.c
@@ -1590,11 +1590,12 @@ ble_sm_pair_cfg(struct ble_sm_proc *proc)
proc->flags |= BLE_SM_PROC_F_BONDING;
}
- /* In legacy mode, bonding requires the exchange of keys. If no key
- * exchange was specified, pretend bonding is not enabled.
+ /* In legacy mode, bonding requires the exchange of keys
+ * at least from one side. If no key exchange was specified,
+ * pretend bonding is not enabled.
*/
if (!(proc->flags & BLE_SM_PROC_F_SC) &&
- (init_key_dist == 0 || resp_key_dist == 0)) {
+ (init_key_dist == 0 && resp_key_dist == 0)) {
proc->flags &= ~BLE_SM_PROC_F_BONDING;
}