Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hnnajh committed Dec 4, 2023
1 parent 976cb70 commit 94d1d8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,10 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P
CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), packetHeader.GetMessageCounter(), sourceNodeId);
CHIP_ERROR err = CHIP_NO_ERROR;
SecureSession * session = sessionHandle->AsSecureSession();
if (session == nullptr)
{
return CHIP_ERROR_NOT_CONNECTED;
}
VerifyOrReturnError(session == nullptr, CHIP_ERROR_NOT_CONNECTED);
if (session->GetPeerAddress().GetTransportType() == Transport::Type::kTcp) {
// support large payloads
err = SecureMessageCodec::Encrypt(CryptoContext(keyContext), nonce, payloadHeader, packetHeader, message, kLargePayloadMaxSizeBytes);
err = SecureMessageCodec::Encrypt(CryptoContext(keyContext), nonce, payloadHeader, packetHeader, message, kLargePayloadMaxMessageSizeBytes);
} else {
err = SecureMessageCodec::Encrypt(CryptoContext(keyContext), nonce, payloadHeader, packetHeader, message, kMaxAppMessageLen);
}
Expand Down
2 changes: 1 addition & 1 deletion src/transport/raw/MessageHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static_assert(detail::kMaxApplicationPayloadAndMICSizeBytes > kMaxTagLen, "Need
// those in the header sizes.
static constexpr size_t kMaxAppMessageLen = detail::kMaxApplicationPayloadAndMICSizeBytes - kMaxTagLen;
// large payload limit
static constexpr size_t kLargePayloadMaxSizeBytes = 128000;
static constexpr size_t kLargePayloadMaxMessageSizeBytes = 128000;

static constexpr uint16_t kMsgUnicastSessionIdUnsecured = 0x0000;

Expand Down

0 comments on commit 94d1d8c

Please sign in to comment.