Skip to content

Commit

Permalink
Use MRP parameters provided by CASE/PASE (#12490)
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-apple authored and pull[bot] committed Dec 8, 2021
1 parent 68de583 commit 3350195
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/app/OperationalDeviceProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ CHIP_ERROR OperationalDeviceProxy::UpdateDeviceData(const Transport::PeerAddress

mMRPConfig = config;

// Initialize CASE session state with any MRP parameters that DNS-SD has provided.
// It can be overridden by CASE session protocol messages that include MRP parameters.
mCASESession.SetMRPConfig(mMRPConfig);

if (mState == State::NeedsAddress)
{
mState = State::Initialized;
Expand Down Expand Up @@ -225,7 +229,6 @@ void OperationalDeviceProxy::OnSessionEstablished()
VerifyOrReturn(mState != State::Uninitialized,
ChipLogError(Controller, "OnSessionEstablished was called while the device was not initialized"));

// TODO Update the MRP params based on the MRP params extracted from CASE, when this is available.
CHIP_ERROR err = mInitParams.sessionManager->NewPairing(
Optional<Transport::PeerAddress>::Value(mDeviceAddress), mPeerId.GetNodeId(), &mCASESession,
CryptoContext::SessionRole::kInitiator, mInitParams.fabricInfo->GetFabricIndex());
Expand Down
4 changes: 4 additions & 0 deletions src/controller/CommissioneeDeviceProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ CHIP_ERROR CommissioneeDeviceProxy::UpdateDeviceData(const Transport::PeerAddres

mMRPConfig = config;

// Initialize PASE session state with any MRP parameters that DNS-SD has provided.
// It can be overridden by PASE session protocol messages that include MRP parameters.
mPairing.SetMRPConfig(mMRPConfig);

ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(didLoad));

if (!mSecureSession.HasValue())
Expand Down
10 changes: 5 additions & 5 deletions src/transport/PairingSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ class DLL_EXPORT PairingSession
* @brief
* Get the value of peer session counter which is synced during session establishment
*/
virtual const ReliableMessageProtocolConfig & GetMRPConfig() const
{
// TODO(#6652): This is a stub implementation, should be replaced by the real one when CASE and PASE is completed
return gDefaultMRPConfig;
}
virtual const ReliableMessageProtocolConfig & GetMRPConfig() const { return mMRPConfig; }

void SetMRPConfig(const ReliableMessageProtocolConfig & config) { mMRPConfig = config; }

virtual const char * GetI2RSessionInfo() const = 0;

Expand Down Expand Up @@ -186,6 +184,8 @@ class DLL_EXPORT PairingSession
Transport::PeerAddress mPeerAddress = Transport::PeerAddress::Uninitialized();

Optional<uint16_t> mPeerSessionId;

ReliableMessageProtocolConfig mMRPConfig = gDefaultMRPConfig;
};

} // namespace chip

0 comments on commit 3350195

Please sign in to comment.