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/10 18:26:25 UTC
incubator-mynewt-core git commit: BLE Host - Fix build when security
disabled.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 7db67c72f -> 84f0e6c72
BLE Host - Fix build when security disabled.
The host failed to compile when NIMBLE_OPT_SM was disabled. This commit
fixes this build error.
The change which broke the build should never have been committed in the
first place. That change is part of a larger set of changes that need
to be committed at the same time. This was my screw up. Sorry
everyone!
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/84f0e6c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/84f0e6c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/84f0e6c7
Branch: refs/heads/develop
Commit: 84f0e6c72b1cc0f7502955b1a2483378407b4ca0
Parents: 7db67c7
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Jun 10 11:23:52 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Jun 10 11:23:52 2016 -0700
----------------------------------------------------------------------
net/nimble/host/include/host/ble_gap.h | 1 +
net/nimble/host/src/ble_gap.c | 18 ++++++++++++++++--
net/nimble/host/src/ble_sm_lgcy.c | 4 ++++
net/nimble/host/src/ble_sm_priv.h | 5 +++++
net/nimble/host/src/test/ble_sm_test.c | 1 +
net/nimble/include/nimble/nimble_opt.h | 4 ++--
net/nimble/include/nimble/nimble_opt_auto.h | 12 ++++++++++++
7 files changed, 41 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/host/include/host/ble_gap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_gap.h b/net/nimble/host/include/host/ble_gap.h
index 7da00e4..c68a957 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -270,4 +270,5 @@ ble_gap_encryption_initiate(uint16_t conn_handle, uint8_t *ltk,
uint16_t ediv, uint64_t rand_val, int auth);
int ble_gap_provide_ltk(uint16_t conn_handle, uint8_t *ltk);
void ble_gap_init_identity_addr(uint8_t *addr);
+
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index abf4401..c7020f7 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2094,10 +2094,13 @@ done:
* $security *
*****************************************************************************/
-#if NIMBLE_OPT(SM)
int
ble_gap_security_initiate(uint16_t conn_handle)
{
+#if !NIMBLE_OPT(SM)
+ return BLE_HS_ENOTSUP;
+#endif
+
ble_hs_conn_flags_t conn_flags;
int rc;
@@ -2126,6 +2129,10 @@ ble_gap_encryption_initiate(uint16_t conn_handle,
uint64_t rand_val,
int auth)
{
+#if !NIMBLE_OPT(SM)
+ return BLE_HS_ENOTSUP;
+#endif
+
ble_hs_conn_flags_t conn_flags;
int rc;
@@ -2141,12 +2148,15 @@ ble_gap_encryption_initiate(uint16_t conn_handle,
rc = ble_sm_enc_initiate(conn_handle, ltk, ediv, rand_val, auth);
return rc;
}
-#endif
void
ble_gap_passkey_event(uint16_t conn_handle,
struct ble_gap_passkey_action *passkey_action)
{
+#if !NIMBLE_OPT(SM)
+ return;
+#endif
+
struct ble_gap_conn_ctxt ctxt;
struct ble_gap_snapshot snap;
struct ble_hs_conn *conn;
@@ -2179,6 +2189,10 @@ void
ble_gap_enc_event(uint16_t conn_handle, int status,
struct ble_gap_sec_state *sec_state)
{
+#if !NIMBLE_OPT(SM)
+ return;
+#endif
+
struct ble_gap_conn_ctxt ctxt;
struct ble_gap_snapshot snap;
struct ble_hs_conn *conn;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/host/src/ble_sm_lgcy.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_lgcy.c b/net/nimble/host/src/ble_sm_lgcy.c
index 19451fa..b95a7a2 100644
--- a/net/nimble/host/src/ble_sm_lgcy.c
+++ b/net/nimble/host/src/ble_sm_lgcy.c
@@ -25,6 +25,8 @@
#include "host/ble_sm.h"
#include "ble_hs_priv.h"
+#if NIMBLE_OPT(SM)
+
/**
* Create some shortened names for the passkey actions so that the table is
* easier to read.
@@ -264,3 +266,5 @@ ble_sm_lgcy_random_rx(struct ble_sm_proc *proc, struct ble_sm_result *res)
res->execute = 1;
}
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/host/src/ble_sm_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_priv.h b/net/nimble/host/src/ble_sm_priv.h
index b4554df..fc34037 100644
--- a/net/nimble/host/src/ble_sm_priv.h
+++ b/net/nimble/host/src/ble_sm_priv.h
@@ -466,6 +466,11 @@ int ble_sm_init(void);
#define ble_sm_heartbeat()
#define ble_sm_connection_broken(conn_handle)
+#define ble_sm_pair_initiate(conn_handle) BLE_HS_ENOTSUP
+#define ble_sm_slave_initiate(conn_handle) BLE_HS_ENOTSUP
+#define ble_sm_enc_initiate(conn_handle, ltk, ediv, rand_val, auth) \
+ BLE_HS_ENOTSUP
+
#define ble_sm_init() 0
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/host/src/test/ble_sm_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test.c b/net/nimble/host/src/test/ble_sm_test.c
index 71a5fca..50900d3 100644
--- a/net/nimble/host/src/test/ble_sm_test.c
+++ b/net/nimble/host/src/test/ble_sm_test.c
@@ -1798,6 +1798,7 @@ ble_sm_test_util_us_bonding_good(int send_enc_req, uint8_t *ltk,
value_sec.rand_num = rand_num;
memcpy(value_sec.ltk, ltk, sizeof value_sec.ltk);
value_sec.ltk_present = 1;
+ value_sec.irk_present = 0;
value_sec.authenticated = authenticated;
value_sec.sc = 0;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/include/nimble/nimble_opt.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/nimble_opt.h b/net/nimble/include/nimble/nimble_opt.h
index b173343..8eb6bec 100644
--- a/net/nimble/include/nimble/nimble_opt.h
+++ b/net/nimble/include/nimble/nimble_opt.h
@@ -52,13 +52,13 @@
#define NIMBLE_OPT_WHITELIST 1
#endif
-/** HOST: Security manager. Enabled by default. */
+/** HOST: Security manager legacy pairing. Enabled by default. */
#ifndef NIMBLE_OPT_SM
#define NIMBLE_OPT_SM 1
#endif
-/** HOST: Security connections (4.2). Disabled by default. */
+/** HOST: Security manage secure connections (4.2). Disabled by default. */
#ifndef NIMBLE_OPT_SM_SC
#define NIMBLE_OPT_SM_SC 0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/84f0e6c7/net/nimble/include/nimble/nimble_opt_auto.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/nimble_opt_auto.h b/net/nimble/include/nimble/nimble_opt_auto.h
index 0996537..2547c6c 100644
--- a/net/nimble/include/nimble/nimble_opt_auto.h
+++ b/net/nimble/include/nimble/nimble_opt_auto.h
@@ -91,4 +91,16 @@
#undef NIMBLE_OPT_ATT_CLT_INDICATE
#define NIMBLE_OPT_ATT_CLT_INDICATE (NIMBLE_OPT_GATT_INDICATE)
+/** Security manager settings. */
+
+/* Secure connections implies security manager support
+ * Note: For now, security manager is synonymous with legacy pairing. In the
+ * future, a new setting for legacy pairing may be introduced as a sibling of
+ * the SC setting.
+ */
+#if NIMBLE_OPT_SM_SC
+#undef NIMBLE_OPT_SM
+#define NIMBLE_OPT_SM 1
+#endif
+
#endif