-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Linux / Darwin: Enable passcode / verifier config from PosixConfig #39765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux / Darwin: Enable passcode / verifier config from PosixConfig #39765
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request effectively implements the stated objectives, enabling the configuration of passcode, verifier, and discriminator settings from PosixConfig
while maintaining command-line precedence and providing a guarded fallback to test parameters. The changes improve code correctness and maintainability by introducing const
correctness for LinuxDeviceOptions
parameters and refactoring the initialization logic into smaller, more focused helper functions. The updated documentation in the header file is also a valuable addition. The overall quality of the changes is high, and no critical, high, or medium severity issues were identified.
e05846d
to
977ae4e
Compare
PR #39765: Size comparison from 18ec87c to 977ae4e Increases above 0.2%:
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
- If discriminator, passcode, verifier and related options are not specified on the command line, look up the relevant keys in PosixConfig if present before falling back to hard-coded test values. - Guard using test config behind CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS=1 - Make the LinuxDeviceOptions parameters to the CommissionableInit functions const (and don't update the passed in options.payload anymore as this is not necessary or documented behavior).
977ae4e
to
1db91a1
Compare
PR #39765: Size comparison from c4c6bea to 1db91a1 Increases above 0.2%:
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the Linux platform commissioning setup by reading passcode, verifier, salt, iteration count, and discriminator from PosixConfig before falling back to test parameters, and updates function signatures to use const LinuxDeviceOptions&
.
- Add helper functions in
CommissionableInit.cpp
to read optional values from PosixConfig and handle fallbacks. - Remove
TestOnlyCommissionableDataProvider
and guard test parameters behindCHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS
. - Change
InitCommissionableDataProvider
andInitConfigurationManager
to acceptconst LinuxDeviceOptions &
and no longer modifyoptions.payload
.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
examples/platform/linux/CommissionableInit.h | Updated doc comments; changed signatures to take const LinuxDeviceOptions & . |
examples/platform/linux/CommissionableInit.cpp | Refactored commissioning init to use PosixConfig, added helper functions, removed test-only provider include. |
Comments suppressed due to low confidence (3)
examples/platform/linux/CommissionableInit.h:36
- [nitpick] The doc comment should note that
options
is now passed asconst
and is not modified by this function to avoid confusion about payload-side effects.
* @param options - LinuxDeviceOptions instance configured via command-line parsing
examples/platform/linux/CommissionableInit.cpp:33
- [nitpick] The helper name
IsNotFound
is quite generic—consider renaming it toIsConfigNotFound
or similar to clarify its purpose.
bool IsNotFound(CHIP_ERROR err)
examples/platform/linux/CommissionableInit.cpp:101
- New logic for reading/falling back salt from PosixConfig and behind test flags isn’t covered by existing CI tests; consider adding unit tests for
GetSpake2pSalt
,GetIterationCount
, andGetDiscriminator
.
CHIP_ERROR GetSpake2pSalt(const LinuxDeviceOptions & options, chip::Optional<std::vector<uint8_t>> & outSalt)
PR #39765: Size comparison from c4c6bea to e591584 Increases above 0.2%:
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
…roject-chip#39765) * Linux / Darwin: Enable passcode / verifier config from PosixConfig - If discriminator, passcode, verifier and related options are not specified on the command line, look up the relevant keys in PosixConfig if present before falling back to hard-coded test values. - Guard using test config behind CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS=1 - Make the LinuxDeviceOptions parameters to the CommissionableInit functions const (and don't update the passed in options.payload anymore as this is not necessary or documented behavior). * Make error handling logic clearer as per review
Summary
Testing
Existing CI tests verify that passing commissionable parameters via command line still works as before. Manually verified that pre-populating the PosixConfig file (kvs on Darwin or chip-factory.ini on Linux) works for configuring these settings as well, and that example apps refuse to start without configuration when compiling with CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS=0.