Skip to content

Commit 63f4b79

Browse files
authored
[Infineon] CYW30739 supports using provisioned data from Optiga Trust M. (#33564)
* Update CYW30739 README files. * Add OptigaFactoryDataProvider class to support using provisioned data from Optiga Trust M. * Add UnprovisionedOptigaFactoryDataProvider class to support updating factory data to an unprovisioned Optiga Trust M.
1 parent c3ef110 commit 63f4b79

File tree

18 files changed

+568
-30
lines changed

18 files changed

+568
-30
lines changed

examples/light-switch-app/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/light-switch-app/infineon/cyw30739 out/cyw30739-light-switch \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode

examples/lighting-app/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/lighting-app/infineon/cyw30739 out/cyw30739-light \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode

examples/lock-app/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/lock-app/infineon/cyw30739 out/cyw30739-lock \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode

examples/platform/infineon/cyw30739/matter_config.cpp

+22-5
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,21 @@
4444
#include <lib/support/CHIPPlatformMemory.h>
4545
#include <mbedtls/platform.h>
4646
#include <platform/DeviceInstanceInfoProvider.h>
47-
#include <platform/Infineon/CYW30739/FactoryDataProvider.h>
4847
#include <platform/KeyValueStoreManager.h>
4948
#include <protocols/secure_channel/PASESession.h>
50-
#ifdef BOARD_ENABLE_OPTIGA
51-
#include "wiced_optiga.h"
52-
#endif
5349
#include <wiced_rtos.h>
5450

51+
#ifdef BOARD_USE_OPTIGA
52+
#include "wiced_optiga.h"
53+
#ifdef USE_PROVISIONED_OPTIGA
54+
#include <platform/Infineon/CYW30739/OptigaFactoryDataProvider.h>
55+
#else /* !USE_PROVISIONED_OPTIGA */
56+
#include <platform/Infineon/CYW30739/UnprovisionedOptigaFactoryDataProvider.h>
57+
#endif /* USE_PROVISIONED_OPTIGA */
58+
#else /* !BOARD_USE_OPTIGA */
59+
#include <platform/Infineon/CYW30739/FactoryDataProvider.h>
60+
#endif /* BOARD_USE_OPTIGA */
61+
5562
using namespace ::chip;
5663
using namespace ::chip::Inet;
5764
using namespace ::chip::Credentials;
@@ -60,7 +67,15 @@ using namespace ::chip::Shell;
6067
using namespace ::chip::app;
6168

6269
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
70+
#ifdef BOARD_USE_OPTIGA
71+
#ifdef USE_PROVISIONED_OPTIGA
72+
static OptigaFactoryDataProvider sFactoryDataProvider;
73+
#else /* !USE_PROVISIONED_OPTIGA */
74+
static UnprovisionedOptigaFactoryDataProvider sFactoryDataProvider;
75+
#endif /* USE_PROVISIONED_OPTIGA */
76+
#else /* !BOARD_USE_OPTIGA */
6377
static FactoryDataProvider sFactoryDataProvider;
78+
#endif /* BOARD_USE_OPTIGA */
6479

6580
// NOTE! This key is for test/certification only and should not be available in production devices!
6681
uint8_t sTestEventTriggerEnableKey[chip::TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
@@ -135,7 +150,7 @@ void CYW30739MatterConfig::InitBoard(void)
135150
#ifdef BOARD_ENABLE_DISPLAY
136151
GUI_Init();
137152
#endif
138-
#ifdef BOARD_ENABLE_OPTIGA
153+
#ifdef BOARD_USE_OPTIGA
139154
wiced_optiga_init();
140155
#endif
141156
}
@@ -186,6 +201,8 @@ void CYW30739MatterConfig::InitApp(void)
186201
LogAppInit();
187202
ConfigurationMgr().LogDeviceConfig();
188203

204+
sFactoryDataProvider.Init();
205+
189206
// Print QR Code URL
190207
PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE));
191208
/* Start CHIP datamodel server */

examples/thermostat/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode
+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
leb128
2+
zcbor

src/platform/Infineon/CYW30739/BUILD.gn

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ static_library("CYW30739") {
3434
"ConfigurationManagerImpl.h",
3535
"ConnectivityManagerImpl.cpp",
3636
"ConnectivityManagerImpl.h",
37-
"FactoryDataProvider.cpp",
38-
"FactoryDataProvider.h",
3937
"InetPlatformConfig.h",
4038
"KeyValueStoreManagerImpl.cpp",
4139
"KeyValueStoreManagerImpl.h",
@@ -57,6 +55,8 @@ static_library("CYW30739") {
5755
"EventFlags.h",
5856
"FactoryDataProvider.h",
5957
"OTAImageProcessorImpl.h",
58+
"OptigaFactoryDataProvider.h",
59+
"UnprovisionedOptigaFactoryDataProvider.h",
6060
"cycfg_gatt_db.h",
6161
]
6262

src/platform/Infineon/CYW30739/CYW30739Config.h

+27-19
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,33 @@ class CYW30739Config
7272
static constexpr Key kConfigKey_PAICert = CYW30739ConfigKey(kChipFactory_KeyBase, 0x22);
7373
static constexpr Key kConfigKey_CertDeclaration = CYW30739ConfigKey(kChipFactory_KeyBase, 0x23);
7474
// CHIP Config Keys
75-
static constexpr Key kConfigKey_ServiceConfig = CYW30739ConfigKey(kChipConfig_KeyBase, 0x00);
76-
static constexpr Key kConfigKey_PairedAccountId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x01);
77-
static constexpr Key kConfigKey_ServiceId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x02);
78-
static constexpr Key kConfigKey_LastUsedEpochKeyId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x03);
79-
static constexpr Key kConfigKey_FailSafeArmed = CYW30739ConfigKey(kChipConfig_KeyBase, 0x04);
80-
static constexpr Key kConfigKey_GroupKey = CYW30739ConfigKey(kChipConfig_KeyBase, 0x05);
81-
static constexpr Key kConfigKey_RegulatoryLocation = CYW30739ConfigKey(kChipConfig_KeyBase, 0x07);
82-
static constexpr Key kConfigKey_CountryCode = CYW30739ConfigKey(kChipConfig_KeyBase, 0x08);
83-
static constexpr Key kConfigKey_RebootCount = CYW30739ConfigKey(kChipConfig_KeyBase, 0x09);
84-
static constexpr Key kConfigKey_UniqueId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0a);
85-
static constexpr Key kConfigKey_LockUser = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0b);
86-
static constexpr Key kConfigKey_Credential = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0c);
87-
static constexpr Key kConfigKey_LockUserName = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0d);
88-
static constexpr Key kConfigKey_CredentialData = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0e);
89-
static constexpr Key kConfigKey_UserCredentials = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0f);
90-
static constexpr Key kConfigKey_WeekDaySchedules = CYW30739ConfigKey(kChipConfig_KeyBase, 0x10);
91-
static constexpr Key kConfigKey_YearDaySchedules = CYW30739ConfigKey(kChipConfig_KeyBase, 0x11);
92-
static constexpr Key kConfigKey_HolidaySchedules = CYW30739ConfigKey(kChipConfig_KeyBase, 0x12);
93-
static constexpr Key kConfigKey_BootReason = CYW30739ConfigKey(kChipConfig_KeyBase, 0x13);
75+
static constexpr Key kConfigKey_ServiceConfig = CYW30739ConfigKey(kChipConfig_KeyBase, 0x00);
76+
static constexpr Key kConfigKey_PairedAccountId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x01);
77+
static constexpr Key kConfigKey_ServiceId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x02);
78+
static constexpr Key kConfigKey_LastUsedEpochKeyId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x03);
79+
static constexpr Key kConfigKey_FailSafeArmed = CYW30739ConfigKey(kChipConfig_KeyBase, 0x04);
80+
static constexpr Key kConfigKey_GroupKey = CYW30739ConfigKey(kChipConfig_KeyBase, 0x05);
81+
static constexpr Key kConfigKey_RegulatoryLocation = CYW30739ConfigKey(kChipConfig_KeyBase, 0x07);
82+
static constexpr Key kConfigKey_CountryCode = CYW30739ConfigKey(kChipConfig_KeyBase, 0x08);
83+
static constexpr Key kConfigKey_RebootCount = CYW30739ConfigKey(kChipConfig_KeyBase, 0x09);
84+
static constexpr Key kConfigKey_UniqueId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0a);
85+
static constexpr Key kConfigKey_LockUser = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0b);
86+
static constexpr Key kConfigKey_Credential = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0c);
87+
static constexpr Key kConfigKey_LockUserName = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0d);
88+
static constexpr Key kConfigKey_CredentialData = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0e);
89+
static constexpr Key kConfigKey_UserCredentials = CYW30739ConfigKey(kChipConfig_KeyBase, 0x0f);
90+
static constexpr Key kConfigKey_WeekDaySchedules = CYW30739ConfigKey(kChipConfig_KeyBase, 0x10);
91+
static constexpr Key kConfigKey_YearDaySchedules = CYW30739ConfigKey(kChipConfig_KeyBase, 0x11);
92+
static constexpr Key kConfigKey_HolidaySchedules = CYW30739ConfigKey(kChipConfig_KeyBase, 0x12);
93+
static constexpr Key kConfigKey_BootReason = CYW30739ConfigKey(kChipConfig_KeyBase, 0x13);
94+
static constexpr Key kConfigKey_ProvisioningDAC = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe0);
95+
static constexpr Key kConfigKey_ProvisioningPAICert = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe1);
96+
static constexpr Key kConfigKey_ProvisioningSecret = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe2);
97+
static constexpr Key kConfigKey_ProvisioningSecretMetaData = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe3);
98+
static constexpr Key kConfigKey_ProvisioningDACMetaData = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe4);
99+
static constexpr Key kConfigKey_ProvisioningDACKeyMetaData = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe5);
100+
static constexpr Key kConfigKey_ProvisioningManifest = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe6);
101+
static constexpr Key kConfigKey_ProvisioningFragment = CYW30739ConfigKey(kChipConfig_KeyBase, 0xe7);
94102

95103
// Set key id limits for each group.
96104
static constexpr Key kMinConfigKey_ChipFactory = CYW30739ConfigKey(kChipFactory_KeyBase, 0x00);

src/platform/Infineon/CYW30739/FactoryDataProvider.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ namespace DeviceLayer {
2525

2626
using namespace chip::DeviceLayer::Internal;
2727

28+
CHIP_ERROR FactoryDataProvider::Init()
29+
{
30+
return CHIP_NO_ERROR;
31+
}
32+
2833
/*
2934
* Members functions that implement the CommissionableDataProvider
3035
*/

src/platform/Infineon/CYW30739/FactoryDataProvider.h

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class FactoryDataProvider : public CommissionableDataProvider,
3030
public DeviceInstanceInfoProvider
3131
{
3232
public:
33+
CHIP_ERROR Init();
34+
3335
// ===== Members functions that implement the CommissionableDataProvider
3436
CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator);
3537
CHIP_ERROR SetSetupDiscriminator(uint16_t setupDiscriminator);

0 commit comments

Comments
 (0)