|
77 | 77 | #include "AppMain.h"
|
78 | 78 | #include "CommissionableInit.h"
|
79 | 79 |
|
80 |
| -#if CHIP_CRYPTO_HSM |
81 | 80 | #include "DeviceAttestationSe05xCredsExample.h"
|
82 |
| -#include "se05x_t4t_utils.h" |
83 |
| -#include <crypto/hsm/CHIPCryptoPALHsm.h> |
84 |
| -#include <crypto/hsm/nxp/PersistentStorageOperationalKeystoreHSM.h> |
85 |
| -#endif |
| 81 | +#include <CHIPCryptoPALHsm_se05x_config.h> |
86 | 82 |
|
87 | 83 | using namespace chip;
|
88 | 84 | using namespace chip::ArgParser;
|
@@ -289,95 +285,10 @@ int ChipLinuxAppInit(int argc, char * const argv[], OptionSet * customOptions)
|
289 | 285 | return 0;
|
290 | 286 | }
|
291 | 287 |
|
292 |
| -#ifdef ENABLE_HSM_EC_KEY |
293 |
| - |
294 |
| -struct CommonCaseDeviceServerInitParams_Se05x : public CommonCaseDeviceServerInitParams |
295 |
| -{ |
296 |
| - CHIP_ERROR InitializeStaticResourcesBeforeServerInit() |
297 |
| - { |
298 |
| - static chip::KvsPersistentStorageDelegate sKvsPersistenStorageDelegate; |
299 |
| - static chip::PersistentStorageOperationalKeystoreHSM sPersistentStorageOperationalKeystore; |
300 |
| - static chip::Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; |
301 |
| - static chip::Credentials::GroupDataProviderImpl sGroupDataProvider; |
302 |
| - static Credentials::IgnoreCertificateValidityPeriodPolicy sDefaultCertValidityPolicy; |
303 |
| - static chip::Crypto::DefaultSessionKeystore sSessionKeystore; |
304 |
| - |
305 |
| -#if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION |
306 |
| - static chip::SimpleSessionResumptionStorage sSessionResumptionStorage; |
307 |
| -#endif |
308 |
| - static chip::app::DefaultAclStorage sAclStorage; |
309 |
| - |
310 |
| - // KVS-based persistent storage delegate injection |
311 |
| - if (persistentStorageDelegate == nullptr) |
312 |
| - { |
313 |
| - chip::DeviceLayer::PersistedStorage::KeyValueStoreManager & kvsManager = |
314 |
| - DeviceLayer::PersistedStorage::KeyValueStoreMgr(); |
315 |
| - ReturnErrorOnFailure(sKvsPersistenStorageDelegate.Init(&kvsManager)); |
316 |
| - this->persistentStorageDelegate = &sKvsPersistenStorageDelegate; |
317 |
| - } |
318 |
| - |
319 |
| - // PersistentStorageDelegate "software-based" operational key access injection |
320 |
| - if (this->operationalKeystore == nullptr) |
321 |
| - { |
322 |
| - // WARNING: PersistentStorageOperationalKeystore::Finish() is never called. It's fine for |
323 |
| - // for examples and for now. |
324 |
| - ReturnErrorOnFailure(sPersistentStorageOperationalKeystore.Init(this->persistentStorageDelegate)); |
325 |
| - this->operationalKeystore = &sPersistentStorageOperationalKeystore; |
326 |
| - } |
327 |
| - |
328 |
| - // OpCertStore can be injected but default to persistent storage default |
329 |
| - // for simplicity of the examples. |
330 |
| - if (this->opCertStore == nullptr) |
331 |
| - { |
332 |
| - // WARNING: PersistentStorageOpCertStore::Finish() is never called. It's fine for |
333 |
| - // for examples and for now, since all storage is immediate for that impl. |
334 |
| - ReturnErrorOnFailure(sPersistentStorageOpCertStore.Init(this->persistentStorageDelegate)); |
335 |
| - this->opCertStore = &sPersistentStorageOpCertStore; |
336 |
| - } |
337 |
| - |
338 |
| - // Session Keystore injection |
339 |
| - this->sessionKeystore = &sSessionKeystore; |
340 |
| - |
341 |
| - // Group Data provider injection |
342 |
| - sGroupDataProvider.SetStorageDelegate(this->persistentStorageDelegate); |
343 |
| - sGroupDataProvider.SetSessionKeystore(this->sessionKeystore); |
344 |
| - ReturnErrorOnFailure(sGroupDataProvider.Init()); |
345 |
| - this->groupDataProvider = &sGroupDataProvider; |
346 |
| - |
347 |
| -#if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION |
348 |
| - ReturnErrorOnFailure(sSessionResumptionStorage.Init(this->persistentStorageDelegate)); |
349 |
| - this->sessionResumptionStorage = &sSessionResumptionStorage; |
350 |
| -#else |
351 |
| - this->sessionResumptionStorage = nullptr; |
352 |
| -#endif |
353 |
| - |
354 |
| - // Inject access control delegate |
355 |
| - this->accessDelegate = Access::Examples::GetAccessControlDelegate(); |
356 |
| - |
357 |
| - // Inject ACL storage. (Don't initialize it.) |
358 |
| - this->aclStorage = &sAclStorage; |
359 |
| - |
360 |
| - // Inject certificate validation policy compatible with non-wall-clock-time-synced |
361 |
| - // embedded systems. |
362 |
| - this->certificateValidityPolicy = &sDefaultCertValidityPolicy; |
363 |
| - |
364 |
| - return CHIP_NO_ERROR; |
365 |
| - } |
366 |
| -}; |
367 |
| - |
368 |
| -#endif |
369 |
| - |
370 | 288 | void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl)
|
371 | 289 | {
|
372 |
| -#ifdef ENABLE_HSM_EC_KEY |
373 |
| - static CommonCaseDeviceServerInitParams_Se05x initParams; |
374 |
| -#else |
375 | 290 | static chip::CommonCaseDeviceServerInitParams initParams;
|
376 |
| -#endif |
377 | 291 |
|
378 |
| -#if CHIP_CRYPTO_HSM |
379 |
| - VerifyOrDie(se05x_enable_contactless_interface() == 0); |
380 |
| -#endif |
381 | 292 | VerifyOrDie(initParams.InitializeStaticResourcesBeforeServerInit() == CHIP_NO_ERROR);
|
382 | 293 |
|
383 | 294 | #if defined(ENABLE_CHIP_SHELL)
|
@@ -423,7 +334,7 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl)
|
423 | 334 | PrintOnboardingCodes(LinuxDeviceOptions::GetInstance().payload);
|
424 | 335 |
|
425 | 336 | // Initialize device attestation config
|
426 |
| -#ifdef ENABLE_HSM_DEVICE_ATTESTATION |
| 337 | +#if ENABLE_SE05X_DEVICE_ATTESTATION |
427 | 338 | SetDeviceAttestationCredentialsProvider(Examples::GetExampleSe05xDACProvider());
|
428 | 339 | #else
|
429 | 340 | SetDeviceAttestationCredentialsProvider(LinuxDeviceOptions::GetInstance().dacProvider);
|
|
0 commit comments