mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-30 04:27:23 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user