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/05 11:51:58 UTC

[11/43] incubator-mynewt-core git commit: BLE Host - Move state repetition go->process_result.

BLE Host - Move state repetition go->process_result.


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/d9b09325
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d9b09325
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d9b09325

Branch: refs/heads/develop
Commit: d9b093253b7f87a0b54c01cedee232adfe3e20a1
Parents: 023769e
Author: Christopher Collins <cc...@apache.org>
Authored: Mon May 30 13:21:00 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sun Jun 5 19:08:48 2016 +0800

----------------------------------------------------------------------
 apps/bleprph/src/main.c                      |    4 +-
 apps/bletiny/src/cmd.c                       |    4 +-
 net/nimble/host/include/host/ble_gap.h       |    2 +-
 net/nimble/host/include/host/ble_hs_test.h   |    2 +-
 net/nimble/host/include/host/ble_l2cap.h     |  182 +-
 net/nimble/host/src/ble_gap.c                |    8 +-
 net/nimble/host/src/ble_hs.c                 |    2 +-
 net/nimble/host/src/ble_hs_conn.c            |    2 +-
 net/nimble/host/src/ble_hs_priv.h            |    2 +-
 net/nimble/host/src/ble_l2cap.c              |    2 +-
 net/nimble/host/src/ble_l2cap_sm.c           | 2434 --------------------
 net/nimble/host/src/ble_l2cap_sm_alg.c       |  466 ----
 net/nimble/host/src/ble_l2cap_sm_cmd.c       |  645 ------
 net/nimble/host/src/ble_l2cap_sm_priv.h      |  447 ----
 net/nimble/host/src/ble_sm.c                 | 2190 ++++++++++++++++++
 net/nimble/host/src/ble_sm_alg.c             |  464 ++++
 net/nimble/host/src/ble_sm_cmd.c             |  633 ++++++
 net/nimble/host/src/ble_sm_lgcy.c            |  120 +-
 net/nimble/host/src/ble_sm_priv.h            |  445 ++++
 net/nimble/host/src/ble_sm_sc.c              |  284 ++-
 net/nimble/host/src/host_hci.c               |    4 +-
 net/nimble/host/src/test/ble_hs_test.c       |    2 +-
 net/nimble/host/src/test/ble_l2cap_sm_test.c | 2487 ---------------------
 net/nimble/host/src/test/ble_sm_test.c       | 2487 +++++++++++++++++++++
 net/nimble/include/nimble/nimble_opt.h       |    2 +-
 25 files changed, 6514 insertions(+), 6806 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/apps/bleprph/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/main.c b/apps/bleprph/src/main.c
index 51bd7d7..8f8acac 100755
--- a/apps/bleprph/src/main.c
+++ b/apps/bleprph/src/main.c
@@ -316,8 +316,8 @@ main(void)
     cfg.max_l2cap_chans = 3;
     cfg.max_l2cap_sig_procs = 1;
     cfg.sm_bonding = 1;
-    cfg.sm_our_key_dist = BLE_L2CAP_SM_PAIR_KEY_DIST_ENC;
-    cfg.sm_their_key_dist = BLE_L2CAP_SM_PAIR_KEY_DIST_ENC;
+    cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
+    cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
     cfg.store_read_cb = store_read;
     cfg.store_write_cb = store_write;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index af343c5..7216377 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -1926,7 +1926,7 @@ cmd_passkey(int argc, char **argv)
 #endif
 
     uint16_t conn_handle;
-    struct ble_l2cap_sm_passkey pk;
+    struct ble_sm_passkey pk;
     int rc;
 
     conn_handle = parse_arg_uint16("conn", &rc);
@@ -1960,7 +1960,7 @@ cmd_passkey(int argc, char **argv)
          return EINVAL;
     }
 
-    rc = ble_l2cap_sm_set_tk(conn_handle, &pk);
+    rc = ble_sm_set_tk(conn_handle, &pk);
     if (rc != 0) {
         console_printf("error providing passkey; rc=%d\n", rc);
         return rc;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/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 65b1a11..e30fb1b 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -160,7 +160,7 @@ struct ble_gap_notify_params {
  * when the l2cap calls to the application, it will ask the application
  * to perform one of they key generation roles. In all cases, the
  * application must pass the passkey back to the l2cap via
- * ble_l2cap_sm_set_tk
+ * ble_sm_set_tk
  */
 #define BLE_GAP_PKACT_NONE          0
 #define BLE_GAP_PKACT_OOB           1

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/net/nimble/host/include/host/ble_hs_test.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_hs_test.h b/net/nimble/host/include/host/ble_hs_test.h
index b51224c..3ca3d28 100644
--- a/net/nimble/host/include/host/ble_hs_test.h
+++ b/net/nimble/host/include/host/ble_hs_test.h
@@ -27,7 +27,7 @@ void ble_hs_test_pkt_txed(struct os_mbuf *om);
 void ble_hs_test_hci_txed(uint8_t *cmdbuf);
 
 int ble_l2cap_test_all(void);
-int ble_l2cap_sm_test_all(void);
+int ble_sm_test_all(void);
 int ble_att_svr_test_all(void);
 int ble_att_clt_test_all(void);
 int ble_host_hci_test_all(void);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/net/nimble/host/include/host/ble_l2cap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_l2cap.h b/net/nimble/host/include/host/ble_l2cap.h
index a17a2de..05b75ff 100644
--- a/net/nimble/host/include/host/ble_l2cap.h
+++ b/net/nimble/host/include/host/ble_l2cap.h
@@ -20,98 +20,99 @@
 #ifndef H_BLE_L2CAP_
 #define H_BLE_L2CAP_
 
+#include "nimble/nimble_opt.h"
 struct ble_l2cap_sig_update_req;
 struct ble_hs_conn;
 
-#define BLE_L2CAP_SIG_OP_REJECT             0x01
-#define BLE_L2CAP_SIG_OP_CONNECT_REQ        0x02
-#define BLE_L2CAP_SIG_OP_CONNECT_RSP        0x03
-#define BLE_L2CAP_SIG_OP_CONFIG_REQ         0x04
-#define BLE_L2CAP_SIG_OP_CONFIG_RSP         0x05
-#define BLE_L2CAP_SIG_OP_DISCONN_REQ        0x06
-#define BLE_L2CAP_SIG_OP_DISCONN_RSP        0x07
-#define BLE_L2CAP_SIG_OP_ECHO_REQ           0x08
-#define BLE_L2CAP_SIG_OP_ECHO_RSP           0x09
-#define BLE_L2CAP_SIG_OP_INFO_REQ           0x0a
-#define BLE_L2CAP_SIG_OP_INFO_RSP           0x0b
-#define BLE_L2CAP_SIG_OP_CREATE_CHAN_REQ    0x0c
-#define BLE_L2CAP_SIG_OP_CREATE_CHAN_RSP    0x0d
-#define BLE_L2CAP_SIG_OP_MOVE_CHAN_REQ      0x0e
-#define BLE_L2CAP_SIG_OP_MOVE_CHAN_RSP      0x0f
-#define BLE_L2CAP_SIG_OP_MOVE_CHAN_CONF_REQ 0x10
-#define BLE_L2CAP_SIG_OP_MOVE_CHAN_CONF_RSP 0x11
-#define BLE_L2CAP_SIG_OP_UPDATE_REQ         0x12
-#define BLE_L2CAP_SIG_OP_UPDATE_RSP         0x13
-#define BLE_L2CAP_SIG_OP_CREDIT_CONNECT_REQ 0x14
-#define BLE_L2CAP_SIG_OP_CREDIT_CONNECT_RSP 0x15
-#define BLE_L2CAP_SIG_OP_FLOW_CTRL_CREDIT   0x16
-#define BLE_L2CAP_SIG_OP_MAX                0x17
+#define BLE_L2CAP_SIG_OP_REJECT                 0x01
+#define BLE_L2CAP_SIG_OP_CONNECT_REQ            0x02
+#define BLE_L2CAP_SIG_OP_CONNECT_RSP            0x03
+#define BLE_L2CAP_SIG_OP_CONFIG_REQ             0x04
+#define BLE_L2CAP_SIG_OP_CONFIG_RSP             0x05
+#define BLE_L2CAP_SIG_OP_DISCONN_REQ            0x06
+#define BLE_L2CAP_SIG_OP_DISCONN_RSP            0x07
+#define BLE_L2CAP_SIG_OP_ECHO_REQ               0x08
+#define BLE_L2CAP_SIG_OP_ECHO_RSP               0x09
+#define BLE_L2CAP_SIG_OP_INFO_REQ               0x0a
+#define BLE_L2CAP_SIG_OP_INFO_RSP               0x0b
+#define BLE_L2CAP_SIG_OP_CREATE_CHAN_REQ        0x0c
+#define BLE_L2CAP_SIG_OP_CREATE_CHAN_RSP        0x0d
+#define BLE_L2CAP_SIG_OP_MOVE_CHAN_REQ          0x0e
+#define BLE_L2CAP_SIG_OP_MOVE_CHAN_RSP          0x0f
+#define BLE_L2CAP_SIG_OP_MOVE_CHAN_CONF_REQ     0x10
+#define BLE_L2CAP_SIG_OP_MOVE_CHAN_CONF_RSP     0x11
+#define BLE_L2CAP_SIG_OP_UPDATE_REQ             0x12
+#define BLE_L2CAP_SIG_OP_UPDATE_RSP             0x13
+#define BLE_L2CAP_SIG_OP_CREDIT_CONNECT_REQ     0x14
+#define BLE_L2CAP_SIG_OP_CREDIT_CONNECT_RSP     0x15
+#define BLE_L2CAP_SIG_OP_FLOW_CTRL_CREDIT       0x16
+#define BLE_L2CAP_SIG_OP_MAX                    0x17
 
 #define BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD    0x0000
 #define BLE_L2CAP_SIG_ERR_MTU_EXCEEDED          0x0001
 #define BLE_L2CAP_SIG_ERR_INVALID_CID           0x0002
 
-#define BLE_L2CAP_SM_OP_PAIR_REQ                0x01
-#define BLE_L2CAP_SM_OP_PAIR_RSP                0x02
-#define BLE_L2CAP_SM_OP_PAIR_CONFIRM            0x03
-#define BLE_L2CAP_SM_OP_PAIR_RANDOM             0x04
-#define BLE_L2CAP_SM_OP_PAIR_FAIL               0x05
-#define BLE_L2CAP_SM_OP_ENC_INFO                0x06
-#define BLE_L2CAP_SM_OP_MASTER_ID               0x07
-#define BLE_L2CAP_SM_OP_IDENTITY_INFO           0x08
-#define BLE_L2CAP_SM_OP_IDENTITY_ADDR_INFO      0x09
-#define BLE_L2CAP_SM_OP_SIGN_INFO               0x0a
-#define BLE_L2CAP_SM_OP_SEC_REQ                 0x0b
-#define BLE_L2CAP_SM_OP_PAIR_PUBLIC_KEY         0x0c
-#define BLE_L2CAP_SM_OP_PAIR_DHKEY_CHECK        0x0d
-#define BLE_L2CAP_SM_OP_PAIR_KEYPRESS_NOTIFY    0x0e
-
-#define BLE_L2CAP_SM_ERR_PASSKEY            0x01
-#define BLE_L2CAP_SM_ERR_OOB                0x02
-#define BLE_L2CAP_SM_ERR_AUTHREQ            0x03
-#define BLE_L2CAP_SM_ERR_CONFIRM_MISMATCH   0x04
-#define BLE_L2CAP_SM_ERR_PAIR_NOT_SUPP      0x05
-#define BLE_L2CAP_SM_ERR_ENC_KEY_SZ         0x06
-#define BLE_L2CAP_SM_ERR_CMD_NOT_SUPP       0x07
-#define BLE_L2CAP_SM_ERR_UNSPECIFIED        0x08
-#define BLE_L2CAP_SM_ERR_REPEATED           0x09
-#define BLE_L2CAP_SM_ERR_INVAL              0x0a
-#define BLE_L2CAP_SM_ERR_DHKEY              0x0b
-#define BLE_L2CAP_SM_ERR_NUM_CMP            0x0c
-#define BLE_L2CAP_SM_ERR_ALREADY            0x0d
-#define BLE_L2CAP_SM_ERR_CROSS_TRANS        0x0e
-#define BLE_L2CAP_SM_ERR_MAX_PLUS_1         0x0f
-
-#define BLE_L2CAP_SM_PAIR_ALG_JW            0
-#define BLE_L2CAP_SM_PAIR_ALG_PASSKEY       1
-#define BLE_L2CAP_SM_PAIR_ALG_OOB           2
-#define BLE_L2CAP_SM_PAIR_ALG_NUM_CMP       3
-
-#define BLE_L2CAP_SM_PAIR_KEY_DIST_ENC      0x01
-#define BLE_L2CAP_SM_PAIR_KEY_DIST_ID       0x02
-#define BLE_L2CAP_SM_PAIR_KEY_DIST_SIGN     0x04
-#define BLE_L2CAP_SM_PAIR_KEY_DIST_LINK     0x08
-#define BLE_L2CAP_SM_PAIR_KEY_DIST_RESERVED 0xf0
-
-#define BLE_L2CAP_SM_IO_CAP_DISP_ONLY       0x00
-#define BLE_L2CAP_SM_IO_CAP_DISP_YES_NO     0x01
-#define BLE_L2CAP_SM_IO_CAP_KEYBOARD_ONLY   0x02
-#define BLE_L2CAP_SM_IO_CAP_NO_IO           0x03
-#define BLE_L2CAP_SM_IO_CAP_KEYBOARD_DISP   0x04
-#define BLE_L2CAP_SM_IO_CAP_RESERVED        0x05
-
-#define BLE_L2CAP_SM_PAIR_OOB_NO            0x00
-#define BLE_L2CAP_SM_PAIR_OOB_YES           0x01
-#define BLE_L2CAP_SM_PAIR_OOB_RESERVED      0x02
-
-#define BLE_L2CAP_SM_PAIR_AUTHREQ_BOND      0x01
-#define BLE_L2CAP_SM_PAIR_AUTHREQ_MITM      0x04
-#define BLE_L2CAP_SM_PAIR_AUTHREQ_SC        0x08
-#define BLE_L2CAP_SM_PAIR_AUTHREQ_KEYPRESS  0x10
-#define BLE_L2CAP_SM_PAIR_AUTHREQ_RESERVED  0xe2
-
-#define BLE_L2CAP_SM_PAIR_KEY_SZ_MIN        7
-#define BLE_L2CAP_SM_PAIR_KEY_SZ_MAX        16
+#define BLE_SM_OP_PAIR_REQ                      0x01
+#define BLE_SM_OP_PAIR_RSP                      0x02
+#define BLE_SM_OP_PAIR_CONFIRM                  0x03
+#define BLE_SM_OP_PAIR_RANDOM                   0x04
+#define BLE_SM_OP_PAIR_FAIL                     0x05
+#define BLE_SM_OP_ENC_INFO                      0x06
+#define BLE_SM_OP_MASTER_ID                     0x07
+#define BLE_SM_OP_IDENTITY_INFO                 0x08
+#define BLE_SM_OP_IDENTITY_ADDR_INFO            0x09
+#define BLE_SM_OP_SIGN_INFO                     0x0a
+#define BLE_SM_OP_SEC_REQ                       0x0b
+#define BLE_SM_OP_PAIR_PUBLIC_KEY               0x0c
+#define BLE_SM_OP_PAIR_DHKEY_CHECK              0x0d
+#define BLE_SM_OP_PAIR_KEYPRESS_NOTIFY          0x0e
+
+#define BLE_SM_ERR_PASSKEY                      0x01
+#define BLE_SM_ERR_OOB                          0x02
+#define BLE_SM_ERR_AUTHREQ                      0x03
+#define BLE_SM_ERR_CONFIRM_MISMATCH             0x04
+#define BLE_SM_ERR_PAIR_NOT_SUPP                0x05
+#define BLE_SM_ERR_ENC_KEY_SZ                   0x06
+#define BLE_SM_ERR_CMD_NOT_SUPP                 0x07
+#define BLE_SM_ERR_UNSPECIFIED                  0x08
+#define BLE_SM_ERR_REPEATED                     0x09
+#define BLE_SM_ERR_INVAL                        0x0a
+#define BLE_SM_ERR_DHKEY                        0x0b
+#define BLE_SM_ERR_NUM_CMP                      0x0c
+#define BLE_SM_ERR_ALREADY                      0x0d
+#define BLE_SM_ERR_CROSS_TRANS                  0x0e
+#define BLE_SM_ERR_MAX_PLUS_1                   0x0f
+
+#define BLE_SM_PAIR_ALG_JW                      0
+#define BLE_SM_PAIR_ALG_PASSKEY                 1
+#define BLE_SM_PAIR_ALG_OOB                     2
+#define BLE_SM_PAIR_ALG_NUM_CMP                 3
+
+#define BLE_SM_PAIR_KEY_DIST_ENC                0x01
+#define BLE_SM_PAIR_KEY_DIST_ID                 0x02
+#define BLE_SM_PAIR_KEY_DIST_SIGN               0x04
+#define BLE_SM_PAIR_KEY_DIST_LINK               0x08
+#define BLE_SM_PAIR_KEY_DIST_RESERVED           0xf0
+
+#define BLE_SM_IO_CAP_DISP_ONLY                 0x00
+#define BLE_SM_IO_CAP_DISP_YES_NO               0x01
+#define BLE_SM_IO_CAP_KEYBOARD_ONLY             0x02
+#define BLE_SM_IO_CAP_NO_IO                     0x03
+#define BLE_SM_IO_CAP_KEYBOARD_DISP             0x04
+#define BLE_SM_IO_CAP_RESERVED                  0x05
+
+#define BLE_SM_PAIR_OOB_NO                      0x00
+#define BLE_SM_PAIR_OOB_YES                     0x01
+#define BLE_SM_PAIR_OOB_RESERVED                0x02
+
+#define BLE_SM_PAIR_AUTHREQ_BOND                0x01
+#define BLE_SM_PAIR_AUTHREQ_MITM                0x04
+#define BLE_SM_PAIR_AUTHREQ_SC                  0x08
+#define BLE_SM_PAIR_AUTHREQ_KEYPRESS            0x10
+#define BLE_SM_PAIR_AUTHREQ_RESERVED            0xe2
+
+#define BLE_SM_PAIR_KEY_SZ_MIN                  7
+#define BLE_SM_PAIR_KEY_SZ_MAX                  16
 
 typedef void ble_l2cap_sig_update_fn(int status, void *arg);
 
@@ -127,7 +128,7 @@ int ble_l2cap_sig_update(uint16_t conn_handle,
                          ble_l2cap_sig_update_fn *cb, void *cb_arg);
 
 /* Strucure to pass the passkey info back to the l2cap */
-struct ble_l2cap_sm_passkey
+struct ble_sm_passkey
 {
     uint8_t action;
     union
@@ -137,13 +138,16 @@ struct ble_l2cap_sm_passkey
     };
 };
 
+#if NIMBLE_OPT(SM)
 /* If the application gets a passkey action, it must peform the action
  * and then call this function to notify the host that the action is
  * complete
  */
-int ble_l2cap_sm_set_tk(uint16_t conn_handle,
-                        struct ble_l2cap_sm_passkey *pkey);
-
-void ble_l2cap_sm_connection_broken(uint16_t conn_handle);
+int ble_sm_set_tk(uint16_t conn_handle, struct ble_sm_passkey *pkey);
+void ble_sm_connection_broken(uint16_t conn_handle);
+#else
+#define ble_sm_set_tk(conn_handle, pkey) (BLE_HS_ENOTSUP)
+#define ble_sm_connection_broken(conn_handle)
+#endif
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/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 3834346..2ce1828 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -569,7 +569,7 @@ ble_gap_conn_broken(struct ble_gap_snapshot *snap, int reason)
      * each fo the "connection_broken" functions below.
      */
 
-    ble_l2cap_sm_connection_broken(snap->desc.conn_handle);
+    ble_sm_connection_broken(snap->desc.conn_handle);
     ble_gattc_connection_broken(snap->desc.conn_handle);
 
     ble_hs_atomic_conn_delete(snap->desc.conn_handle);
@@ -2115,9 +2115,9 @@ ble_gap_security_initiate(uint16_t conn_handle)
          * is found, perform the encryption procedure rather than the pairing
          * procedure.
          */
-        rc = ble_l2cap_sm_pair_initiate(conn_handle);
+        rc = ble_sm_pair_initiate(conn_handle);
     } else {
-        rc = ble_l2cap_sm_slave_initiate(conn_handle);
+        rc = ble_sm_slave_initiate(conn_handle);
     }
 
     return rc;
@@ -2142,7 +2142,7 @@ ble_gap_encryption_initiate(uint16_t conn_handle,
         return BLE_HS_EROLE;
     }
 
-    rc = ble_l2cap_sm_enc_initiate(conn_handle, ltk, ediv, rand_val, auth);
+    rc = ble_sm_enc_initiate(conn_handle, ltk, ediv, rand_val, auth);
     return rc;
 }
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/net/nimble/host/src/ble_hs.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs.c b/net/nimble/host/src/ble_hs.c
index 9e53ff0..d22a85b 100644
--- a/net/nimble/host/src/ble_hs.c
+++ b/net/nimble/host/src/ble_hs.c
@@ -198,7 +198,7 @@ ble_hs_heartbeat(void *unused)
     ble_gattc_heartbeat();
     ble_gap_heartbeat();
     ble_l2cap_sig_heartbeat();
-    ble_l2cap_sm_heartbeat();
+    ble_sm_heartbeat();
 
     ble_hs_heartbeat_timer_reset();
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/net/nimble/host/src/ble_hs_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn.c b/net/nimble/host/src/ble_hs_conn.c
index 251a768..2883f30 100644
--- a/net/nimble/host/src/ble_hs_conn.c
+++ b/net/nimble/host/src/ble_hs_conn.c
@@ -136,7 +136,7 @@ ble_hs_conn_alloc(void)
      * to reject SM messages.
      */
 #if NIMBLE_OPT(SM)
-    chan = ble_l2cap_sm_create_chan();
+    chan = ble_sm_create_chan();
     if (chan == NULL) {
         goto err;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/net/nimble/host/src/ble_hs_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_priv.h b/net/nimble/host/src/ble_hs_priv.h
index 71ac8fa..d119a2a 100644
--- a/net/nimble/host/src/ble_hs_priv.h
+++ b/net/nimble/host/src/ble_hs_priv.h
@@ -34,7 +34,7 @@
 #include "ble_hs_startup_priv.h"
 #include "ble_l2cap_priv.h"
 #include "ble_l2cap_sig_priv.h"
-#include "ble_l2cap_sm_priv.h"
+#include "ble_sm_priv.h"
 #include "host/ble_hs.h"
 #include "log/log.h"
 #include "nimble/nimble_opt.h"

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d9b09325/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index 62244a7..87caa6e 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -337,7 +337,7 @@ ble_l2cap_init(void)
         goto err;
     }
 
-    rc = ble_l2cap_sm_init();
+    rc = ble_sm_init();
     if (rc != 0) {
         goto err;
     }