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/12/13 03:08:44 UTC
[5/9] incubator-mynewt-core git commit: nimble/sm: Fix
AuthReq/KeyDist validation in pairing req/rsp
nimble/sm: Fix AuthReq/KeyDist validation in pairing req/rsp
The reserved bits in AuthReq and key distribution flags shall be
ignored on reception thus non-zero values do not make pairing command
invalid. This is to ensure compatibility with future specs.
This fixes following PTS test cases for SM:
- TP/JW/BI-03-C
- TP/JW/BI-04-C
Reference:
Bluetooth Specification 4.2, Vol 3, Part H, Section 3.5.2
Bluetooth Specification 4.2, Vol 3, Part H, Section 3.6.1
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/9627249a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9627249a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9627249a
Branch: refs/heads/develop
Commit: 9627249a1fd3ce031fdca821646692adb9ebe31a
Parents: 2e6367c
Author: Andrzej Kaczmarek <an...@codecoup.pl>
Authored: Tue Nov 15 22:56:02 2016 +0100
Committer: Andrzej Kaczmarek <an...@codecoup.pl>
Committed: Mon Dec 12 23:58:47 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_sm_cmd.c | 12 ------------
1 file changed, 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9627249a/net/nimble/host/src/ble_sm_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_cmd.c b/net/nimble/host/src/ble_sm_cmd.c
index 34609c6..e438c02 100644
--- a/net/nimble/host/src/ble_sm_cmd.c
+++ b/net/nimble/host/src/ble_sm_cmd.c
@@ -101,24 +101,12 @@ ble_sm_pair_cmd_is_valid(struct ble_sm_pair_cmd *cmd)
return 0;
}
- if (cmd->authreq & BLE_SM_PAIR_AUTHREQ_RESERVED) {
- return 0;
- }
-
if (cmd->max_enc_key_size < BLE_SM_PAIR_KEY_SZ_MIN ||
cmd->max_enc_key_size > BLE_SM_PAIR_KEY_SZ_MAX) {
return 0;
}
- if (cmd->init_key_dist & BLE_SM_PAIR_KEY_DIST_RESERVED) {
- return 0;
- }
-
- if (cmd->resp_key_dist & BLE_SM_PAIR_KEY_DIST_RESERVED) {
- return 0;
- }
-
return 1;
}