mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-11-11 15:00:34 +00:00
Merge pull request #370 from ccollins476ad/key-dist-0
BLE Host - Don't persist security material if either key distribution field is 0 X-Original-Commit: 8f499dd073e11ceb749650a561b52421e318b470
This commit is contained in:
@@ -1573,17 +1573,26 @@ ble_sm_pair_cfg(struct ble_sm_proc *proc)
|
||||
proc->flags |= BLE_SM_PROC_F_SC;
|
||||
}
|
||||
|
||||
ble_sm_key_dist(proc, &init_key_dist, &resp_key_dist);
|
||||
if (proc->flags & BLE_SM_PROC_F_INITIATOR) {
|
||||
rx_key_dist = resp_key_dist;
|
||||
} else {
|
||||
rx_key_dist = init_key_dist;
|
||||
}
|
||||
|
||||
if (pair_req->authreq & BLE_SM_PAIR_AUTHREQ_BOND &&
|
||||
pair_rsp->authreq & BLE_SM_PAIR_AUTHREQ_BOND) {
|
||||
|
||||
proc->flags |= BLE_SM_PROC_F_BONDING;
|
||||
}
|
||||
|
||||
ble_sm_key_dist(proc, &init_key_dist, &resp_key_dist);
|
||||
if (proc->flags & BLE_SM_PROC_F_INITIATOR) {
|
||||
rx_key_dist = resp_key_dist;
|
||||
} else {
|
||||
rx_key_dist = init_key_dist;
|
||||
/* In legacy mode, bonding requires the exchange of keys. If no key
|
||||
* exchange was specified, pretend bonding is not enabled.
|
||||
*/
|
||||
if (!(proc->flags & BLE_SM_PROC_F_SC) &&
|
||||
(init_key_dist == 0 || resp_key_dist == 0)) {
|
||||
|
||||
proc->flags &= ~BLE_SM_PROC_F_BONDING;
|
||||
}
|
||||
|
||||
proc->rx_key_flags = 0;
|
||||
|
||||
Reference in New Issue
Block a user