void ble_sm_lgcy_random_exec(struct ble_sm_proc *proc, struct ble_sm_result *res) { struct ble_sm_pair_random cmd; int rc; memcpy(cmd.value, ble_sm_our_pair_rand(proc), 16); rc = ble_sm_pair_random_tx(proc->conn_handle, &cmd); if (rc != 0) { res->app_status = rc; res->enc_cb = 1; res->sm_err = BLE_SM_ERR_UNSPECIFIED; return; } if (!(proc->flags & BLE_SM_PROC_F_INITIATOR)) { proc->state = BLE_SM_PROC_STATE_LTK_START; } }
void ble_sm_sc_random_exec(struct ble_sm_proc *proc, struct ble_sm_result *res) { struct ble_sm_pair_random cmd; uint8_t ioact; int rc; memcpy(cmd.value, ble_sm_our_pair_rand(proc), 16); rc = ble_sm_pair_random_tx(proc->conn_handle, &cmd); if (rc != 0) { res->app_status = rc; res->enc_cb = 1; res->sm_err = BLE_SM_ERR_UNSPECIFIED; return; } if (!(proc->flags & BLE_SM_PROC_F_INITIATOR)) { rc = ble_sm_sc_random_advance(proc); if (rc != 0) { res->app_status = rc; res->enc_cb = 1; res->sm_err = BLE_SM_ERR_UNSPECIFIED; return; } ioact = ble_sm_sc_io_action(proc); if (ble_sm_ioact_state(ioact) == proc->state && !(proc->flags & BLE_SM_PROC_F_IO_INJECTED)) { res->passkey_params.action = ioact; BLE_HS_DBG_ASSERT(ioact == BLE_SM_IOACT_NUMCMP); ble_sm_sc_gen_numcmp(proc, res); } } }