Skip to content

Commit

Permalink
Allow for example to disable the TEST_SETUP_PARAMS flag (#25322)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cliffamzn authored and pull[bot] committed Jul 4, 2023
1 parent b2272b5 commit 9879113
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config/standalone/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
// WARNING: This option makes it possible to circumvent basic chip security functionality.
// Because of this it SHOULD NEVER BE ENABLED IN PRODUCTION BUILDS.
//
#ifndef CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 1
#endif

// Enable reading DRBG seed data from /dev/(u)random.
// This is needed for test applications and the CHIP device manager to function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
#include <lib/support/CHIPMem.h>
#include <platform/PlatformManager.h>

#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#endif

#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
#endif

@interface CastingServerBridge ()

@property AppParameters * appParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

namespace {

#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT
#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT 1000
#endif

CHIP_ERROR GeneratePaseSalt(std::vector<uint8_t> & spake2pSaltVector)
{
constexpr size_t kSaltLen = kSpake2p_Max_PBKDF_Salt_Length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#define CHIP_CONFIG_KVS_PATH "/tmp/chip_casting_kvs"
#endif

#include <CHIPProjectConfig.h>

#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0

#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1
Expand All @@ -61,3 +59,12 @@
#define CHIP_ENABLE_ROTATING_DEVICE_ID 1

#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH 128

// Disable this since it should not be enabled for production setups
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 0

#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4

// Include the CHIPProjectConfig from config/standalone
// Add this at the end so that we can hit our #defines first
#include <CHIPProjectConfig.h>
4 changes: 4 additions & 0 deletions src/platform/android/CommissionableDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ using namespace chip::Crypto;

namespace {

#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT
#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT 1000
#endif

CHIP_ERROR GeneratePaseSalt(std::vector<uint8_t> & spake2pSaltVector)
{
constexpr size_t kSaltLen = kSpake2p_Max_PBKDF_Salt_Length;
Expand Down

0 comments on commit 9879113

Please sign in to comment.