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:03:17 UTC
[4/8] incubator-mynewt-core git commit: bletiny - Separate pairing
from encryption.
bletiny - Separate pairing from encryption.
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/12ab7cbc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/12ab7cbc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/12ab7cbc
Branch: refs/heads/upf54
Commit: 12ab7cbc52bd607fdc180b0883e8f6f6be58a254
Parents: 5a2c445
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 16:19:39 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 16:19:39 2016 -0700
----------------------------------------------------------------------
apps/bletiny/src/cmd.c | 7 ++++++-
apps/bletiny/src/main.c | 2 +-
net/nimble/host/include/host/ble_gap.h | 6 +++---
net/nimble/host/src/ble_gap.c | 10 ++++++++++
4 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index 3ac8592..fc05aa2 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -388,7 +388,12 @@ cmd_conn(int argc, char **argv)
}
if (addr_type != BLE_GAP_ADDR_TYPE_WL) {
- rc = parse_arg_mac("addr", peer_addr);
+ rc = parse_arg_mac("peer_addr", peer_addr);
+ if (rc == ENOENT) {
+ /* Allow "addr" for backwards compatibility. */
+ rc = parse_arg_mac("addr", peer_addr);
+ }
+
if (rc != 0) {
return rc;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index de633e9..1c0ffa7 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -1359,7 +1359,7 @@ bletiny_sec_pair(uint16_t conn_handle)
int rc;
- rc = ble_sm_pair_initiate(conn_handle);
+ rc = ble_gap_pair_initiate(conn_handle);
return rc;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/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 df9ae64..da4af64 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -268,9 +268,9 @@ int ble_gap_wl_set(struct ble_gap_white_entry *white_list,
int ble_gap_update_params(uint16_t conn_handle,
struct ble_gap_upd_params *params);
int ble_gap_security_initiate(uint16_t conn_handle);
-int
-ble_gap_encryption_initiate(uint16_t conn_handle, uint8_t *ltk,
- uint16_t ediv, uint64_t rand_val, int auth);
+int ble_gap_pair_initiate(uint16_t conn_handle);
+int 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/12ab7cbc/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 2d0edce..7aca181 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2154,6 +2154,16 @@ ble_gap_security_initiate(uint16_t conn_handle)
}
int
+ble_gap_pair_initiate(uint16_t conn_handle)
+{
+ int rc;
+
+ rc = ble_sm_pair_initiate(conn_handle);
+
+ return rc;
+}
+
+int
ble_gap_encryption_initiate(uint16_t conn_handle,
uint8_t *ltk,
uint16_t ediv,