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 2016/06/15 02:27:26 UTC
[04/50] [abbrv] incubator-mynewt-core git commit: BLE Host - SM:
correctly report encrypted state.
BLE Host - SM: correctly report encrypted state.
Prior to this change, encryption was always reported as disabled.
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/fbc2b609
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fbc2b609
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fbc2b609
Branch: refs/heads/develop
Commit: fbc2b6093acaf98b124a001e2e9cf3a52f76e0b1
Parents: c589590
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Jun 8 08:19:29 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 19:23:34 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/ble_sm.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fbc2b609/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 0f179d2..1189bb5 100644
--- a/net/nimble/host/src/ble_sm.c
+++ b/net/nimble/host/src/ble_sm.c
@@ -460,9 +460,15 @@ ble_sm_sec_state(struct ble_sm_proc *proc,
{
out_sec_state->pair_alg = proc->pair_alg;
out_sec_state->enc_enabled = enc_enabled;
- out_sec_state->authenticated =
- (proc->flags & BLE_SM_PROC_F_AUTHENTICATED) ? 1 : 0;
- out_sec_state->bonded = (proc->flags & BLE_SM_PROC_F_BONDED) ? 1 : 0;
+
+ if (enc_enabled) {
+ out_sec_state->authenticated =
+ (proc->flags & BLE_SM_PROC_F_AUTHENTICATED) ? 1 : 0;
+ out_sec_state->bonded = (proc->flags & BLE_SM_PROC_F_BONDED) ? 1 : 0;
+ } else {
+ out_sec_state->authenticated = 0;
+ out_sec_state->bonded = 0;
+ }
}
static void
@@ -1799,6 +1805,7 @@ ble_sm_key_exch_exec(struct ble_sm_proc *proc, struct ble_sm_result *res,
/* The procedure is now complete. */
proc->flags |= BLE_SM_PROC_F_BONDED;
proc->state = BLE_SM_PROC_STATE_NONE;
+ res->enc_state = 1;
res->enc_cb = 1;
}
@@ -1824,6 +1831,7 @@ ble_sm_key_rxed(struct ble_sm_proc *proc, struct ble_sm_result *res)
} else {
proc->flags |= BLE_SM_PROC_F_BONDED;
proc->state = BLE_SM_PROC_STATE_NONE;
+ res->enc_state = 1;
res->enc_cb = 1;
}
}