diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e2763ec41069f3..af102bf96ea5b8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -436,7 +436,7 @@ jobs: env: BUILD_TYPE: default run: | - # We want to build various standalone example apps similar to what examples-linux-standalone.yaml + # We want to build various standalone example apps (similar to what examples-linux-standalone.yaml # does), so use target_os="all" to get those picked up as part of the "unified" build. But then # to save CI resources we want to exclude the "host clang" build, which uses the pigweed clang. scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false chip_data_model_check_die_on_failure=true' --export-compile-commands diff --git a/config/esp32/components/chip/idf_component.yml b/config/esp32/components/chip/idf_component.yml index aeffec708dba8c..1917fcf4de18f5 100644 --- a/config/esp32/components/chip/idf_component.yml +++ b/config/esp32/components/chip/idf_component.yml @@ -26,6 +26,14 @@ dependencies: - if: "idf_version >=5.0" - if: "target != esp32h2" + # This matches the dependency of esp_insights + espressif/esp_diag_data_store: + version: "1.0.1" + require: public + rules: + - if: "idf_version >=5.0" + - if: "target != esp32h2" + espressif/esp_rcp_update: version: "1.2.0" rules: diff --git a/examples/all-clusters-minimal-app/tizen/.gn b/examples/all-clusters-minimal-app/tizen/.gn deleted file mode 100644 index edd34d34bd13d2..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/.gn +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/build.gni") - -# The location of the build configuration file. -buildconfig = "${build_root}/config/BUILDCONFIG.gn" - -# CHIP uses angle bracket includes. -check_system_includes = true - -default_args = { - target_os = "tizen" - - import("//args.gni") -} diff --git a/examples/all-clusters-minimal-app/tizen/BUILD.gn b/examples/all-clusters-minimal-app/tizen/BUILD.gn deleted file mode 100644 index 99f857e86303ea..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/BUILD.gn +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") -import("//build_overrides/tizen.gni") - -import("${chip_root}/build/chip/tools.gni") -import("${chip_root}/src/app/common_flags.gni") - -import("${tizen_sdk_build_root}/tizen_sdk.gni") -assert(chip_build_tools) - -source_set("chip-all-clusters-common") { - sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - ] - - deps = [ - "${chip_root}/examples/all-clusters-minimal-app/all-clusters-common", - "${chip_root}/examples/platform/tizen:app-main", - "${chip_root}/src/lib/shell:shell_core", - ] - - include_dirs = - [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] -} - -executable("chip-all-clusters-minimal-app") { - sources = [ - "include/CHIPProjectAppConfig.h", - "src/main.cpp", - ] - - deps = [ - ":chip-all-clusters-common", - "${chip_root}/examples/all-clusters-minimal-app/all-clusters-common", - "${chip_root}/examples/platform/tizen:app-main", - "${chip_root}/src/lib", - ] - - include_dirs = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "include", - ] - - output_dir = root_out_dir -} - -tizen_sdk_package("chip-all-clusters-minimal-app:tpk") { - deps = [ - ":chip-all-clusters-minimal-app", - "${chip_root}/examples/platform/tizen:author-certificate-CHIP", - ] - manifest = "tizen-manifest.xml" - sign_security_profile = "CHIP" -} - -group("tizen") { - deps = [ ":chip-all-clusters-minimal-app" ] -} - -group("tizen:tpk") { - deps = [ ":chip-all-clusters-minimal-app:tpk" ] -} - -group("default") { - deps = [ ":tizen" ] -} diff --git a/examples/all-clusters-minimal-app/tizen/args.gni b/examples/all-clusters-minimal-app/tizen/args.gni deleted file mode 100644 index bf1ef5219e5d93..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/args.gni +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") - -import("${chip_root}/config/standalone/args.gni") - -chip_device_project_config_include = "" -chip_project_config_include = "" -chip_system_project_config_include = "" - -chip_project_config_include_dirs = - [ "${chip_root}/examples/all-clusters-minimal-app/tizen/include" ] -chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] diff --git a/examples/all-clusters-minimal-app/tizen/build_overrides b/examples/all-clusters-minimal-app/tizen/build_overrides deleted file mode 120000 index e578e73312ebd1..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../build_overrides \ No newline at end of file diff --git a/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h b/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h deleted file mode 100644 index cecc041dc2d34b..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#pragma once - -// include the CHIPProjectConfig from config/standalone -#include diff --git a/examples/all-clusters-minimal-app/tizen/src/main.cpp b/examples/all-clusters-minimal-app/tizen/src/main.cpp deleted file mode 100644 index 2d37747fe82c12..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/src/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace chip; -using namespace chip::app; -using namespace chip::DeviceLayer; - -// Network commissioning -namespace { -constexpr EndpointId kNetworkCommissioningEndpointMain = 0; -constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; - -NetworkCommissioning::TizenEthernetDriver sEthernetDriver; -Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; -Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); -} // namespace - -void ApplicationInit() -{ - // Enable secondary endpoint only when we need it. - emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); - - sEthernetNetworkCommissioningInstance.Init(); - Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); -} - -void ApplicationShutdown(){}; - -int main(int argc, char * argv[]) -{ - TizenServiceAppMain app; - VerifyOrDie(app.Init(argc, argv) == 0); - - VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); - - return app.RunMainLoop(); -} diff --git a/examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip b/examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip deleted file mode 120000 index 11a54ed360106c..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../../ \ No newline at end of file diff --git a/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml b/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml deleted file mode 100644 index cbd365aec78e74..00000000000000 --- a/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - http://tizen.org/privilege/bluetooth - http://tizen.org/privilege/internet - http://tizen.org/privilege/network.get - http://tizen.org/privilege/network.set - http://tizen.org/privilege/network.profile - - true - true - true - true - true - diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 0539af8bf6a1ba..42738adce7c0c8 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -669,7 +669,6 @@ def BuildTizenTarget(): # apps target.AppendFixedTargets([ TargetPart('all-clusters', app=TizenApp.ALL_CLUSTERS), - TargetPart('all-clusters-minimal', app=TizenApp.ALL_CLUSTERS_MINIMAL), TargetPart('chip-tool', app=TizenApp.CHIP_TOOL), TargetPart('light', app=TizenApp.LIGHT), TargetPart('tests', app=TizenApp.TESTS), diff --git a/scripts/build/builders/tizen.py b/scripts/build/builders/tizen.py index b9b9c59661cf74..8c7968888e67e5 100644 --- a/scripts/build/builders/tizen.py +++ b/scripts/build/builders/tizen.py @@ -39,11 +39,6 @@ class TizenApp(Enum): 'examples/all-clusters-app/tizen', ('chip-all-clusters-app', 'chip-all-clusters-app.map')) - ALL_CLUSTERS_MINIMAL = App( - 'chip-all-clusters-minimal-app', - 'examples/all-clusters-minimal-app/tizen', - ('chip-all-clusters-minimal-app', - 'chip-all-clusters-minimal-app.map')) LIGHT = App( 'chip-lighting-app', 'examples/lighting-app/tizen', diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 51d507072bacfd..c9a9a40eedf5f6 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -21,6 +21,6 @@ nrf-native-posix-64-tests nuttx-x64-light qpg-qpg6105-{lock,light,shell,persistent-storage,light-switch,thermostat}[-updateimage][-data-model-disabled][-data-model-enabled] stm32-stm32wb5mm-dk-light -tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan][-with-ui] +tizen-arm-{all-clusters,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan][-with-ui] telink-{tlsr9118bdk40d,tlsr9518adk80d,tlsr9528a,tlsr9528a_retention,tlsr9258a,tlsr9258a_retention}-{air-quality-sensor,all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-ota][-dfu][-shell][-rpc][-factory-data][-4mb][-mars][-usb][-data-model-disabled][-data-model-enabled] openiotsdk-{shell,lock}[-mbedtls][-psa] diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index 6178348ad5d5d5..345b307f26c24d 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -139,10 +139,7 @@ CHIP_ERROR PASESession::GeneratePASEVerifier(Spake2pVerifier & verifier, uint32_ if (useRandomPIN) { - ReturnErrorOnFailure(DRBG_get_bytes(reinterpret_cast(&setupPINCode), sizeof(setupPINCode))); - - // Passcodes shall be restricted to the values 00000001 to 99999998 in decimal, see 5.1.1.6 - setupPINCode = (setupPINCode % kSetupPINCodeMaximumValue) + 1; + ReturnErrorOnFailure(SetupPayload::generateRandomSetupPin(setupPINCode)); } return verifier.Generate(pbkdf2IterCount, salt, setupPINCode); diff --git a/src/setup_payload/SetupPayload.cpp b/src/setup_payload/SetupPayload.cpp index 9683da21f8a7f9..915f20c4a2c863 100644 --- a/src/setup_payload/SetupPayload.cpp +++ b/src/setup_payload/SetupPayload.cpp @@ -23,6 +23,7 @@ #include "SetupPayload.h" +#include #include #include #include @@ -207,6 +208,34 @@ CHIP_ERROR SetupPayload::removeSerialNumber() return CHIP_NO_ERROR; } +CHIP_ERROR SetupPayload::generateRandomSetupPin(uint32_t & setupPINCode) +{ + uint8_t retries = 0; + const uint8_t maxRetries = 10; + + do + { + ReturnErrorOnFailure(Crypto::DRBG_get_bytes(reinterpret_cast(&setupPINCode), sizeof(setupPINCode))); + + // Passcodes shall be restricted to the values 00000001 to 99999998 in decimal, see 5.1.1.6 + // TODO: Consider revising this method to ensure uniform distribution of setup PIN codes + setupPINCode = (setupPINCode % kSetupPINCodeMaximumValue) + 1; + + // Make sure that the Generated Setup Pin code is not one of the invalid passcodes/pin codes defined in the + // specification. + if (IsValidSetupPIN(setupPINCode)) + { + return CHIP_NO_ERROR; + } + + retries++; + // We got pretty unlucky with the random number generator, Just try again. + // This shouldn't take many retries assuming DRBG_get_bytes is not broken. + } while (retries < maxRetries); + + return CHIP_ERROR_INTERNAL; +} + CHIP_ERROR SetupPayload::addOptionalVendorData(const OptionalQRCodeInfo & info) { VerifyOrReturnError(IsVendorTag(info.tag), CHIP_ERROR_INVALID_ARGUMENT); diff --git a/src/setup_payload/SetupPayload.h b/src/setup_payload/SetupPayload.h index 3d5d101fbf4c6e..829af128bf7627 100644 --- a/src/setup_payload/SetupPayload.h +++ b/src/setup_payload/SetupPayload.h @@ -259,6 +259,17 @@ class SetupPayload : public PayloadContents **/ static bool IsVendorTag(uint8_t tag) { return !IsCommonTag(tag); } + /** @brief Generate a Random Setup Pin Code (Passcode) + * + * This function generates a random passcode within the defined limits (00000001 to 99999998) + * It also checks that the generated passcode is not equal to any invalid passcode values as defined in 5.1.7.1. + * + * @param[out] setupPINCode The generated random setup PIN code. + * @return Returns a CHIP_ERROR_INTERNAL if unable to generate a valid passcode within a reasonable number of attempts, + * CHIP_NO_ERROR otherwise + **/ + static CHIP_ERROR generateRandomSetupPin(uint32_t & setupPINCode); + private: std::map optionalVendorData; std::map optionalExtensionData;