You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/02/24 04:00:40 UTC
[2/3] incubator-mynewt-core git commit: nimble/sm: Fix for bonding
information storing
nimble/sm: Fix for bonding information storing
Consider following scenario:
Devices are bonded with unathenticated link key and after that
they decide to increase security. In this case old link keys
are not deleted.
That leads to situation that authenticated keys where never used
for encription but instead re-bonding was performed for following
encryption attempts. It was happening because each time SM checks
for keys in the storage, it found unauthenticated keys in first place
which did not match security level.
This patch fixes that.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/71fdd5db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/71fdd5db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/71fdd5db
Branch: refs/heads/develop
Commit: 71fdd5db184f56ca945cd352f922ce626b143a88
Parents: 673169f
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Wed Feb 15 01:19:17 2017 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Thu Feb 23 00:23:31 2017 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_sm.c | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/71fdd5db/net/nimble/host/src/ble_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c
index 6f88830..bb2c1aa 100644
--- a/net/nimble/host/src/ble_sm.c
+++ b/net/nimble/host/src/ble_sm.c
@@ -553,6 +553,9 @@ ble_sm_persist_keys(struct ble_sm_proc *proc)
ble_gap_identity_event(proc->conn_handle);
}
+ /* Lets remove old keys if we had them */
+ ble_sm_unbond(peer_addr.type, peer_addr.val);
+
authenticated = proc->flags & BLE_SM_PROC_F_AUTHENTICATED;
ble_sm_fill_store_value(peer_addr.type, peer_addr.val, authenticated,