Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions nimble/host/src/ble_sm_lgcy.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ ble_sm_lgcy_random_rx(struct ble_sm_proc *proc, struct ble_sm_result *res)

ble_sm_ia_ra(proc, &iat, ia, &rat, ra);

/* If the peer echoed our own random back (Srand == Mrand), the c1 check
* would trivially pass because the peer also mirrored Mconfirm.
* Reject this immediately with Confirm Value Failed.
*/
if ((proc->flags & BLE_SM_PROC_F_INITIATOR) &&
memcmp(ble_sm_peer_pair_rand(proc), ble_sm_our_pair_rand(proc), 16) == 0) {
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_CONFIRM_MISMATCH);
res->sm_err = BLE_SM_ERR_CONFIRM_MISMATCH;
res->enc_cb = 1;
return;
}

rc = ble_sm_alg_c1(proc->tk, ble_sm_peer_pair_rand(proc), proc->pair_req,
proc->pair_rsp, iat, rat, ia, ra, confirm_val);
if (rc != 0) {
Expand Down
Loading