mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-12-02 14:46:46 +00:00
fix:clear devicekey
Signed-off-by: fangdong7 <fangdong7@huawei.com>
This commit is contained in:
parent
92df267f3e
commit
10757752b3
@ -416,8 +416,9 @@ static void SaveDeviceKey(AuthFsm *authFsm, int32_t keyType, AuthLinkType type)
|
||||
deviceKey.isServerSide = authFsm->info.isServer;
|
||||
if (AuthInsertDeviceKey(&authFsm->info.nodeInfo, &deviceKey, type) != SOFTBUS_OK) {
|
||||
AUTH_LOGE(AUTH_FSM, "insert deviceKey fail");
|
||||
return;
|
||||
}
|
||||
(void)memset_s(&deviceKey, sizeof(AuthDeviceKeyInfo), 0, sizeof(AuthDeviceKeyInfo));
|
||||
(void)memset_s(&sessionKey, sizeof(SessionKey), 0, sizeof(SessionKey));
|
||||
}
|
||||
|
||||
static void CompleteAuthSession(AuthFsm *authFsm, int32_t result)
|
||||
@ -565,8 +566,10 @@ static int32_t RecoveryFastAuthKey(AuthFsm *authFsm)
|
||||
ret = AuthSessionSaveSessionKey(authFsm->authSeq, key.deviceKey, key.keyLen);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
AUTH_LOGE(AUTH_FSM, "post save sessionKey event");
|
||||
(void)memset_s(&key, sizeof(AuthDeviceKeyInfo), 0, sizeof(AuthDeviceKeyInfo));
|
||||
return ret;
|
||||
}
|
||||
(void)memset_s(&key, sizeof(AuthDeviceKeyInfo), 0, sizeof(AuthDeviceKeyInfo));
|
||||
return AuthSessionHandleAuthFinish(authFsm->authSeq);
|
||||
}
|
||||
|
||||
|
@ -312,8 +312,8 @@ int32_t GetLatestSessionKey(const SessionKeyList *list, AuthLinkType type, int32
|
||||
latestKey->lastUseTime = GetCurrentTimeMs();
|
||||
latestKey->useTime[type] = latestKey->lastUseTime;
|
||||
*index = latestKey->index;
|
||||
AUTH_LOGI(AUTH_FSM, "get session key succ, index=%{public}d, type=%{public}u, time=%{public}" PRIu64,
|
||||
latestKey->index, latestKey->type, latestKey->lastUseTime);
|
||||
AUTH_LOGI(AUTH_FSM, "get session key succ, index=%{public}d, authtype=%{public}d, keytype=%{public}u, "
|
||||
"time=%{public}" PRIu64, latestKey->index, type, latestKey->type, latestKey->lastUseTime);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
|
@ -372,15 +372,13 @@ static bool IsNeedConnectOnLine(DeviceInfo *device, HbRespData *hbResp)
|
||||
}
|
||||
if (LnnRetrieveDeviceInfo(device->devId, &deviceInfo) != SOFTBUS_OK ||
|
||||
strlen(deviceInfo.connectInfo.macAddr) == 0) {
|
||||
LNN_LOGI(LNN_HEART_BEAT,
|
||||
"don't support ble direct online because peer state version change, ver:%{public}d->%{public}d",
|
||||
deviceInfo.stateVersion, (int32_t)hbResp->stateVersion);
|
||||
LNN_LOGI(LNN_HEART_BEAT, "don't support ble direct online because retrieve fail, "
|
||||
"stateVersion=%{public}d->%{public}d", deviceInfo.stateVersion, (int32_t)hbResp->stateVersion);
|
||||
return true;
|
||||
}
|
||||
if (LnnGetLocalNumInfo(NUM_KEY_STATE_VERSION, &stateVersion) == SOFTBUS_OK &&
|
||||
stateVersion != deviceInfo.localStateVersion) {
|
||||
LNN_LOGI(LNN_HEART_BEAT,
|
||||
"don't support ble direct online because local state version change, ver:%{public}d->%{public}d",
|
||||
LNN_LOGI(LNN_HEART_BEAT, "don't support ble direct online because local stateVersion=%{public}d->%{public}d",
|
||||
deviceInfo.localStateVersion, stateVersion);
|
||||
return true;
|
||||
}
|
||||
@ -395,7 +393,7 @@ static bool IsNeedConnectOnLine(DeviceInfo *device, HbRespData *hbResp)
|
||||
LNN_LOGI(LNN_HEART_BEAT, "don't support ble direct online because key not exist");
|
||||
return true;
|
||||
}
|
||||
// update capability
|
||||
(void)memset_s(&keyInfo, sizeof(AuthDeviceKeyInfo), 0, sizeof(AuthDeviceKeyInfo));
|
||||
SetDeviceNetCapability(&deviceInfo.netCapacity, hbResp);
|
||||
if ((ret = LnnUpdateRemoteDeviceInfo(&deviceInfo)) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_HEART_BEAT, "don't support ble direct online because update device info fail ret=%{public}d", ret);
|
||||
|
Loading…
Reference in New Issue
Block a user