From 29c4294df647d2000ddca5694352af9238796ccd Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Tue, 15 Nov 2016 22:56:02 +0100 Subject: [PATCH] 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 X-Original-Commit: 9627249a1fd3ce031fdca821646692adb9ebe31a --- nimble/host/src/ble_sm_cmd.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/nimble/host/src/ble_sm_cmd.c b/nimble/host/src/ble_sm_cmd.c index 34609c6c8..e438c023b 100644 --- a/nimble/host/src/ble_sm_cmd.c +++ b/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; }