Skip to content

Commit

Permalink
Move GetAttestationChallenge() implementation to DeviceProxy.cpp (#19058
Browse files Browse the repository at this point in the history
)

Followup from #18867 (comment)
  • Loading branch information
g-coppock authored and pull[bot] committed Jul 5, 2022
1 parent 99fb46f commit 5f7ecb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/app/DeviceProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,15 @@ CHIP_ERROR DeviceProxy::SendCommands(app::CommandSender * commandObj, Optional<S
return commandObj->SendCommandRequest(GetSecureSession().Value(), timeout);
}

CHIP_ERROR DeviceProxy::GetAttestationChallenge(ByteSpan & attestationChallenge)
{
Optional<SessionHandle> secureSessionHandle;

secureSessionHandle = GetSecureSession();
VerifyOrReturnError(secureSessionHandle.HasValue(), CHIP_ERROR_INCORRECT_STATE);

attestationChallenge = secureSessionHandle.Value()->AsSecureSession()->GetCryptoContext().GetAttestationChallenge();
return CHIP_NO_ERROR;
}

} // namespace chip
11 changes: 1 addition & 10 deletions src/app/DeviceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,7 @@ class DLL_EXPORT DeviceProxy
*
* @return CHIP_ERROR CHIP_NO_ERROR on success, or CHIP_ERROR_INVALID_ARGUMENT if no secure session is active
*/
virtual CHIP_ERROR GetAttestationChallenge(ByteSpan & attestationChallenge)
{
Optional<SessionHandle> secureSessionHandle;

secureSessionHandle = GetSecureSession();
VerifyOrReturnError(secureSessionHandle.HasValue(), CHIP_ERROR_INCORRECT_STATE);

attestationChallenge = secureSessionHandle.Value()->AsSecureSession()->GetCryptoContext().GetAttestationChallenge();
return CHIP_NO_ERROR;
}
virtual CHIP_ERROR GetAttestationChallenge(ByteSpan & attestationChallenge);

protected:
virtual bool IsSecureConnected() const = 0;
Expand Down

0 comments on commit 5f7ecb7

Please sign in to comment.