Skip to content

Commit

Permalink
Added fix for WF200 certificate injection (project-chip#23012)
Browse files Browse the repository at this point in the history
* Added fix for WF200 certificate injection

* Adds changes according to comments

* Adds changes according to comments

* Add restyled changes according to comment

Co-authored-by: riwaghe <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
3 people authored and adbridge committed Nov 17, 2022
1 parent 6189e5d commit fc70083
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/platform/efr32/EFR32DeviceAttestationCreds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "efr32_creds.h"
#include "psa/crypto.h"

extern uint32_t __attestation_credentials_base;
extern uint8_t __attestation_credentials_base[];

namespace chip {
namespace Credentials {
Expand All @@ -37,7 +37,7 @@ class DeviceAttestationCredsEFR32 : public DeviceAttestationCredentialsProvider
public:
CHIP_ERROR GetCertificationDeclaration(MutableByteSpan & out_buffer) override
{
ByteSpan cd_span(((uint8_t *) &__attestation_credentials_base) + EFR32_CREDENTIALS_CD_OFFSET, EFR32_CREDENTIALS_CD_SIZE);
ByteSpan cd_span(((uint8_t *) __attestation_credentials_base) + EFR32_CREDENTIALS_CD_OFFSET, EFR32_CREDENTIALS_CD_SIZE);
return CopySpanToMutableSpan(cd_span, out_buffer);
}

Expand All @@ -50,15 +50,13 @@ class DeviceAttestationCredsEFR32 : public DeviceAttestationCredentialsProvider

CHIP_ERROR GetDeviceAttestationCert(MutableByteSpan & out_buffer) override
{
ByteSpan cert_span(((uint8_t *) &__attestation_credentials_base) + EFR32_CREDENTIALS_DAC_OFFSET,
EFR32_CREDENTIALS_DAC_SIZE);
ByteSpan cert_span(((uint8_t *) __attestation_credentials_base) + EFR32_CREDENTIALS_DAC_OFFSET, EFR32_CREDENTIALS_DAC_SIZE);
return CopySpanToMutableSpan(cert_span, out_buffer);
}

CHIP_ERROR GetProductAttestationIntermediateCert(MutableByteSpan & out_pai_buffer) override
{
ByteSpan cert_span(((uint8_t *) &__attestation_credentials_base) + EFR32_CREDENTIALS_PAI_OFFSET,
EFR32_CREDENTIALS_PAI_SIZE);
ByteSpan cert_span(((uint8_t *) __attestation_credentials_base) + EFR32_CREDENTIALS_PAI_OFFSET, EFR32_CREDENTIALS_PAI_SIZE);
return CopySpanToMutableSpan(cert_span, out_pai_buffer);
}

Expand Down

0 comments on commit fc70083

Please sign in to comment.