Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-apple committed Feb 9, 2021
1 parent 81f21bb commit 1101c5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/app/server/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class AppDelegate
{
public:
virtual ~AppDelegate() {}
virtual void OnReceiveError(){};
virtual void OnRendezvousStarted(){};
virtual void OnRendezvousStopped(){};
virtual void OnPairingWindowOpened(){};
virtual void OnPairingWindowClosed(){};
virtual void OnReceiveError() {}
virtual void OnRendezvousStarted() {}
virtual void OnRendezvousStopped() {}
virtual void OnPairingWindowOpened() {}
virtual void OnPairingWindowClosed() {}
};
2 changes: 1 addition & 1 deletion src/controller/CHIPDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ CHIP_ERROR Device::OpenPairingWindow(uint32_t timeout, bool useToken, uint16_t d
// Issue: https://github.com/project-chip/connectedhomeip/issues/4725

// Construct and send "open pairing window" message to the device
System::PacketBufferHandle buf = System::PacketBufferHandle::New(0);
System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::kMaxPacketBufferSize);
System::PacketBufferTLVWriter writer;

writer.Init(std::move(buf));
Expand Down
16 changes: 8 additions & 8 deletions src/transport/PASESession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void PASESession::Clear()
// This function zeroes out and resets the memory used by the object.
// It's done so that no security related information will be leaked.
memset(&mPoint[0], 0, sizeof(mPoint));
memset(&mWS[0][0], 0, sizeof(mWS));
memset(&mPASEVerifier[0][0], 0, sizeof(mPASEVerifier));
memset(&mKe[0], 0, sizeof(mKe));
mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2pError;

Expand Down Expand Up @@ -234,7 +234,7 @@ CHIP_ERROR PASESession::SetupSpake2p(uint32_t pbkdf2IterCount, const uint8_t * s
VerifyOrExit(salt != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrExit(saltLen > 0, err = CHIP_ERROR_INVALID_ARGUMENT);

err = PASESession::ComputePASEVerifier(mSetupPINCode, pbkdf2IterCount, salt, saltLen, mWS);
err = PASESession::ComputePASEVerifier(mSetupPINCode, pbkdf2IterCount, salt, saltLen, mPASEVerifier);
SuccessOrExit(err);
}

Expand Down Expand Up @@ -295,7 +295,7 @@ CHIP_ERROR PASESession::WaitForPairing(const PASEVerifier & verifier, Optional<N
strlen(kSpake2pKeyExchangeSalt), myNodeId, myKeyId, delegate);
SuccessOrExit(err);

memmove(&mWS, verifier, sizeof(verifier));
memmove(&mPASEVerifier, verifier, sizeof(verifier));
mComputeVerifier = false;

exit:
Expand Down Expand Up @@ -364,7 +364,7 @@ CHIP_ERROR PASESession::Pair(const Transport::PeerAddress peerAddress, const PAS
mConnectionState.SetPeerAddress(peerAddress);
mConnectionState.SetPeerNodeId(peerNodeId);

memmove(&mWS, verifier, sizeof(verifier));
memmove(&mPASEVerifier, verifier, sizeof(verifier));
mComputeVerifier = false;

err = SendPBKDFParamRequest();
Expand Down Expand Up @@ -498,7 +498,7 @@ CHIP_ERROR PASESession::SendPBKDFParamResponse()
err = SetupSpake2p(mIterationCount, mSalt, mSaltLength);
SuccessOrExit(err);

err = mSpake2p.ComputeL(mPoint, &sizeof_point, &mWS[1][0], kSpake2p_WS_Length);
err = mSpake2p.ComputeL(mPoint, &sizeof_point, &mPASEVerifier[1][0], kSpake2p_WS_Length);
SuccessOrExit(err);

mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2p1;
Expand Down Expand Up @@ -574,7 +574,7 @@ CHIP_ERROR PASESession::SendMsg1()
System::PacketBufferHandle msg_pA;

CHIP_ERROR err = mSpake2p.BeginProver(reinterpret_cast<const uint8_t *>(""), 0, reinterpret_cast<const uint8_t *>(""), 0,
&mWS[0][0], kSpake2p_WS_Length, &mWS[1][0], kSpake2p_WS_Length);
&mPASEVerifier[0][0], kSpake2p_WS_Length, &mPASEVerifier[1][0], kSpake2p_WS_Length);
SuccessOrExit(err);

err = mSpake2p.ComputeRoundOne(X, &X_len);
Expand Down Expand Up @@ -615,8 +615,8 @@ CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(const PacketHeader & header, con
VerifyOrExit(buf != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE);
VerifyOrExit(buf_len == kMAX_Point_Length, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);

err = mSpake2p.BeginVerifier(reinterpret_cast<const uint8_t *>(""), 0, reinterpret_cast<const uint8_t *>(""), 0, &mWS[0][0],
kSpake2p_WS_Length, mPoint, sizeof(mPoint));
err = mSpake2p.BeginVerifier(reinterpret_cast<const uint8_t *>(""), 0, reinterpret_cast<const uint8_t *>(""), 0,
&mPASEVerifier[0][0], kSpake2p_WS_Length, mPoint, sizeof(mPoint));
SuccessOrExit(err);

err = mSpake2p.ComputeRoundOne(Y, &Y_len);
Expand Down
2 changes: 1 addition & 1 deletion src/transport/PASESession.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class DLL_EXPORT PASESession
uint8_t mPoint[kMAX_Point_Length];

/* w0s and w1s */
PASEVerifier mWS;
PASEVerifier mPASEVerifier;

uint32_t mSetupPINCode;

Expand Down

0 comments on commit 1101c5a

Please sign in to comment.