Skip to content

Commit b7302f2

Browse files
cliffamznDavid Lechner
authored and
David Lechner
committed
Allow for example to disable the TEST_SETUP_PARAMS flag (project-chip#25322)
Documentation indicates that the `CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS` can be dangerous to include in production use cases (see `config/standalone/CHIPProjectConfig.h`) We should disable it where necessary
1 parent 2ce6066 commit b7302f2

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

config/standalone/CHIPProjectConfig.h

+2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
// WARNING: This option makes it possible to circumvent basic chip security functionality.
4040
// Because of this it SHOULD NEVER BE ENABLED IN PRODUCTION BUILDS.
4141
//
42+
#ifndef CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS
4243
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 1
44+
#endif
4345

4446
// Enable reading DRBG seed data from /dev/(u)random.
4547
// This is needed for test applications and the CHIP device manager to function

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
#include <lib/support/CHIPMem.h>
3434
#include <platform/PlatformManager.h>
3535

36+
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
37+
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
38+
#endif
39+
40+
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR
41+
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
42+
#endif
43+
3644
@interface CastingServerBridge ()
3745

3846
@property AppParameters * appParameters;

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionableDataProviderImpl.mm

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333

3434
namespace {
3535

36+
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT
37+
#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT 1000
38+
#endif
39+
3640
CHIP_ERROR GeneratePaseSalt(std::vector<uint8_t> & spake2pSaltVector)
3741
{
3842
constexpr size_t kSaltLen = kSpake2p_Max_PBKDF_Salt_Length;

examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
#define CHIP_CONFIG_KVS_PATH "/tmp/chip_casting_kvs"
3434
#endif
3535

36-
#include <CHIPProjectConfig.h>
37-
3836
#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0
3937

4038
#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1
@@ -61,3 +59,12 @@
6159
#define CHIP_ENABLE_ROTATING_DEVICE_ID 1
6260

6361
#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH 128
62+
63+
// Disable this since it should not be enabled for production setups
64+
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 0
65+
66+
#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4
67+
68+
// Include the CHIPProjectConfig from config/standalone
69+
// Add this at the end so that we can hit our #defines first
70+
#include <CHIPProjectConfig.h>

src/platform/android/CommissionableDataProviderImpl.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ using namespace chip::Crypto;
3434

3535
namespace {
3636

37+
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT
38+
#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT 1000
39+
#endif
40+
3741
CHIP_ERROR GeneratePaseSalt(std::vector<uint8_t> & spake2pSaltVector)
3842
{
3943
constexpr size_t kSaltLen = kSpake2p_Max_PBKDF_Salt_Length;

0 commit comments

Comments
 (0)