Skip to content

Commit 2affb95

Browse files
Fixed the CD check to set certification declaration through api (#34350)
1 parent 111f62f commit 2affb95

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/platform/ESP32/ESP32FactoryDataProvider.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ CHIP_ERROR ESP32FactoryDataProvider::GetSpake2pVerifier(MutableByteSpan & verifi
9898

9999
CHIP_ERROR ESP32FactoryDataProvider::GetCertificationDeclaration(MutableByteSpan & outBuffer)
100100
{
101+
#ifdef CONFIG_ENABLE_SET_CERT_DECLARATION_API
102+
return CopySpanToMutableSpan(mCD, outBuffer);
103+
#else
101104
size_t certSize;
102105
ReturnErrorOnFailure(
103106
ESP32Config::ReadConfigValueBin(ESP32Config::kConfigKey_CertDeclaration, outBuffer.data(), outBuffer.size(), certSize));
104107
outBuffer.reduce_size(certSize);
105108
return CHIP_NO_ERROR;
109+
#endif // CONFIG_ENABLE_SET_CERT_DECLARATION_API
106110
}
107111

108112
CHIP_ERROR ESP32FactoryDataProvider::GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer)
@@ -123,15 +127,11 @@ CHIP_ERROR ESP32FactoryDataProvider::GetDeviceAttestationCert(MutableByteSpan &
123127

124128
CHIP_ERROR ESP32FactoryDataProvider::GetProductAttestationIntermediateCert(MutableByteSpan & outBuffer)
125129
{
126-
#ifdef CONFIG_ENABLE_SET_CERT_DECLARATION_API
127-
return CopySpanToMutableSpan(mCD, outBuffer);
128-
#else
129130
size_t certSize;
130131
ReturnErrorOnFailure(
131132
ESP32Config::ReadConfigValueBin(ESP32Config::kConfigKey_PAICert, outBuffer.data(), outBuffer.size(), certSize));
132133
outBuffer.reduce_size(certSize);
133134
return CHIP_NO_ERROR;
134-
#endif // CONFIG_ENABLE_SET_CERT_DECLARATION_API
135135
}
136136

137137
CHIP_ERROR ESP32FactoryDataProvider::SignWithDeviceAttestationKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer)

0 commit comments

Comments
 (0)