From 175620159c71388ba06de913fe8ae82ed51e6288 Mon Sep 17 00:00:00 2001 From: Kevin Coppock <47542933+g-coppock@users.noreply.github.com> Date: Wed, 1 Jun 2022 11:58:16 -0500 Subject: [PATCH] Move GetAttestationChallenge() implementation to DeviceProxy.cpp (#19058) Followup from https://github.com/project-chip/connectedhomeip/pull/18867#discussion_r886358738 --- src/app/DeviceProxy.cpp | 11 +++++++++++ src/app/DeviceProxy.h | 11 +---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/DeviceProxy.cpp b/src/app/DeviceProxy.cpp index 8488e78f24f9f5..b3618742a55961 100644 --- a/src/app/DeviceProxy.cpp +++ b/src/app/DeviceProxy.cpp @@ -46,4 +46,15 @@ CHIP_ERROR DeviceProxy::SendCommands(app::CommandSender * commandObj, OptionalSendCommandRequest(GetSecureSession().Value(), timeout); } +CHIP_ERROR DeviceProxy::GetAttestationChallenge(ByteSpan & attestationChallenge) +{ + Optional secureSessionHandle; + + secureSessionHandle = GetSecureSession(); + VerifyOrReturnError(secureSessionHandle.HasValue(), CHIP_ERROR_INCORRECT_STATE); + + attestationChallenge = secureSessionHandle.Value()->AsSecureSession()->GetCryptoContext().GetAttestationChallenge(); + return CHIP_NO_ERROR; +} + } // namespace chip diff --git a/src/app/DeviceProxy.h b/src/app/DeviceProxy.h index 843ebd9d364111..3f4bdb89649cc7 100644 --- a/src/app/DeviceProxy.h +++ b/src/app/DeviceProxy.h @@ -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 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;