@@ -167,7 +167,7 @@ void SessionManager::Shutdown()
167167 */
168168void SessionManager::FabricRemoved (FabricIndex fabricIndex)
169169{
170- gGroupPeerTable ->FabricRemoved (fabricIndex);
170+ TEMPORARY_RETURN_IGNORED gGroupPeerTable ->FabricRemoved (fabricIndex);
171171}
172172
173173CHIP_ERROR SessionManager::PrepareMessage (const SessionHandle & sessionHandle, PayloadHeader & payloadHeader,
@@ -211,7 +211,7 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P
211211
212212 packetHeader.SetDestinationGroupId (groupSession->GetGroupId ());
213213 packetHeader.SetMessageCounter (mGroupClientCounter .GetCounter (isControlMsg));
214- mGroupClientCounter .IncrementCounter (isControlMsg);
214+ TEMPORARY_RETURN_IGNORED mGroupClientCounter .IncrementCounter (isControlMsg);
215215 packetHeader.SetSessionType (Header::SessionType::kGroupSession );
216216 sourceNodeId = fabric->GetNodeId ();
217217 packetHeader.SetSourceNodeId (sourceNodeId);
@@ -238,7 +238,8 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P
238238 CHIP_TRACE_MESSAGE_SENT (payloadHeader, packetHeader, destination_address, message->Start (), message->TotalLength ());
239239
240240 CryptoContext::NonceStorage nonce;
241- CryptoContext::BuildNonce (nonce, packetHeader.GetSecurityFlags (), packetHeader.GetMessageCounter (), sourceNodeId);
241+ ReturnErrorOnFailure (
242+ CryptoContext::BuildNonce (nonce, packetHeader.GetSecurityFlags (), packetHeader.GetMessageCounter (), sourceNodeId));
242243 CHIP_ERROR err = SecureMessageCodec::Encrypt (cryptoContext, nonce, payloadHeader, packetHeader, message);
243244 keyContext->Release ();
244245 ReturnErrorOnFailure (err);
@@ -277,7 +278,7 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P
277278
278279 CryptoContext::NonceStorage nonce;
279280 sourceNodeId = session->GetLocalScopedNodeId ().GetNodeId ();
280- CryptoContext::BuildNonce (nonce, packetHeader.GetSecurityFlags (), messageCounter, sourceNodeId);
281+ ReturnErrorOnFailure ( CryptoContext::BuildNonce (nonce, packetHeader.GetSecurityFlags (), messageCounter, sourceNodeId) );
281282
282283 ReturnErrorOnFailure (SecureMessageCodec::Encrypt (cryptoContext, nonce, payloadHeader, packetHeader, message));
283284
@@ -454,10 +455,10 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand
454455
455456 while (interfaceIt.Next ())
456457 {
457- char name[Inet::InterfaceId::kMaxIfNameLength ];
458- interfaceIt.GetInterfaceName (name, Inet::InterfaceId::kMaxIfNameLength );
459458 if (interfaceIt.SupportsMulticast () && interfaceIt.IsUp ())
460459 {
460+ char name[Inet::InterfaceId::kMaxIfNameLength ];
461+ TEMPORARY_RETURN_IGNORED interfaceIt.GetInterfaceName (name, Inet::InterfaceId::kMaxIfNameLength );
461462 interfaceId = interfaceIt.GetInterfaceId ();
462463 if (CHIP_NO_ERROR == interfaceId.GetLinkLocalAddr (&addr))
463464 {
@@ -946,10 +947,11 @@ void SessionManager::SecureUnicastMessageDispatch(const PacketHeader & partialPa
946947 CryptoContext::NonceStorage nonce;
947948 // PASE Sessions use the undefined node ID of all zeroes, since there is no node ID to use
948949 // and the key is short-lived and always different for each PASE session.
949- CryptoContext::BuildNonce (nonce, packetHeader.GetSecurityFlags (), packetHeader.GetMessageCounter (),
950- secureSession->GetSecureSessionType () == SecureSession::Type::kCASE ? secureSession->GetPeerNodeId ()
951- : kUndefinedNodeId );
952- if (SecureMessageCodec::Decrypt (secureSession->GetCryptoContext (), nonce, payloadHeader, packetHeader, msg) != CHIP_NO_ERROR)
950+ CHIP_ERROR nonceResult = CryptoContext::BuildNonce (
951+ nonce, packetHeader.GetSecurityFlags (), packetHeader.GetMessageCounter (),
952+ secureSession->GetSecureSessionType () == SecureSession::Type::kCASE ? secureSession->GetPeerNodeId () : kUndefinedNodeId );
953+ if ((nonceResult != CHIP_NO_ERROR) ||
954+ SecureMessageCodec::Decrypt (secureSession->GetCryptoContext (), nonce, payloadHeader, packetHeader, msg) != CHIP_NO_ERROR)
953955 {
954956 ChipLogError (Inet, " Secure transport received message, but failed to decode/authenticate it, discarding" );
955957 return ;
@@ -1056,9 +1058,11 @@ static bool GroupKeyDecryptAttempt(const PacketHeader & partialPacketHeader, Pac
10561058 }
10571059
10581060 CryptoContext::NonceStorage nonce;
1059- CryptoContext::BuildNonce (nonce, packetHeaderCopy.GetSecurityFlags (), packetHeaderCopy.GetMessageCounter (),
1060- packetHeaderCopy.GetSourceNodeId ().Value ());
1061- decrypted = (CHIP_NO_ERROR == SecureMessageCodec::Decrypt (context, nonce, payloadHeader, packetHeaderCopy, msgCopy));
1061+ CHIP_ERROR nonceResult =
1062+ CryptoContext::BuildNonce (nonce, packetHeaderCopy.GetSecurityFlags (), packetHeaderCopy.GetMessageCounter (),
1063+ packetHeaderCopy.GetSourceNodeId ().Value ());
1064+ decrypted = (nonceResult == CHIP_NO_ERROR) &&
1065+ (CHIP_NO_ERROR == SecureMessageCodec::Decrypt (context, nonce, payloadHeader, packetHeaderCopy, msgCopy));
10621066
10631067 return decrypted;
10641068}
0 commit comments