!3112 修复:dsoftbus在对报文加密后对密钥清零 和 删除br连接问题

Merge pull request !3112 from xuhengxiang/master
This commit is contained in:
openharmony_ci 2022-11-26 01:05:14 +00:00 committed by Gitee
commit 533bcf2434
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 1 deletions

View File

@ -174,8 +174,10 @@ static int32_t TransProxyEncryptPacketData(int32_t channelId, int32_t seq, Proxy
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "memcpy_s key error.");
return SOFTBUS_ERR;
}
(void)memset_s(sessionKey, sizeof(sessionKey), 0, sizeof(sessionKey));
int32_t ret = SoftBusEncryptDataWithSeq(&cipherKey, dataInfo->inData, dataInfo->inLen,
dataInfo->outData, &(dataInfo->outLen), seq);
(void)memset_s(&cipherKey, sizeof(AesGcmCipherKey), 0, sizeof(AesGcmCipherKey));
if (ret != SOFTBUS_OK || dataInfo->outLen != checkLen) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "Trans Proxy encrypt error. %d ", ret);
return SOFTBUS_ENCRYPT_ERR;

View File

@ -271,7 +271,7 @@ void TransDelSessionConnById(int32_t channelId)
}
LIST_FOR_EACH_ENTRY_SAFE(item, next, &g_sessionConnList->list, SessionConn, node) {
if (item->channelId == channelId) {
if (item->listenMod == DIRECT_CHANNEL_SERVER_P2P && item->authId != AUTH_INVALID_ID) {
if (item->listenMod == DIRECT_CHANNEL_SERVER_P2P && item->authId != AUTH_INVALID_ID && !item->serverSide) {
AuthCloseConn(item->authId);
}
ListDelete(&item->node);