Skip to content

Commit 23bc46a

Browse files
authored
Merge branch 'master' into dm_xml_new_grammar_for_command_direction
2 parents 632bab2 + 3e36245 commit 23bc46a

File tree

21 files changed

+171
-35
lines changed

21 files changed

+171
-35
lines changed

config/nrfconnect/chip-gn/.gn

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import("//build_overrides/build.gni")
1616
import("//build_overrides/chip.gni")
17+
import("//build_overrides/pigweed.gni")
1718

1819
# The location of the build configuration file.
1920
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
@@ -25,5 +26,14 @@ default_args = {
2526
target_cpu = "arm"
2627
target_os = "zephyr"
2728

29+
pw_sys_io_BACKEND = dir_pw_sys_io_stdio
30+
pw_assert_BACKEND = dir_pw_assert_log
31+
pw_log_BACKEND = dir_pw_log_basic
32+
33+
pw_build_LINK_DEPS = [
34+
"$dir_pw_assert:impl",
35+
"$dir_pw_log:impl",
36+
]
37+
2838
import("${chip_root}/config/nrfconnect/chip-gn/args.gni")
2939
}
Loading

examples/chip-tool/commands/common/CHIPCommand.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack()
166166
cdTrustStorePath = getenv(kCDTrustStorePathVariable);
167167
}
168168

169-
auto additionalCdCerts = chip::Credentials::LoadAllX509DerCerts(cdTrustStorePath);
169+
auto additionalCdCerts =
170+
chip::Credentials::LoadAllX509DerCerts(cdTrustStorePath, chip::Credentials::CertificateValidationMode::kPublicKeyOnly);
170171
if (cdTrustStorePath != nullptr && additionalCdCerts.size() == 0)
171172
{
172173
ChipLogError(chipTool, "Warning: no CD signing certs found in path: %s, only defaults will be used", cdTrustStorePath);

examples/light-switch-app/light-switch-common/light-switch-app.matter

+1
Original file line numberDiff line numberDiff line change
@@ -2628,6 +2628,7 @@ endpoint 0 {
26282628
ram attribute clusterRevision default = 1;
26292629

26302630
handle command RetrieveLogsRequest;
2631+
handle command RetrieveLogsResponse;
26312632
}
26322633

26332634
server cluster GeneralDiagnostics {

examples/light-switch-app/light-switch-common/light-switch-app.zap

+26
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,14 @@
15811581
"source": "client",
15821582
"isIncoming": 1,
15831583
"isEnabled": 1
1584+
},
1585+
{
1586+
"name": "RetrieveLogsResponse",
1587+
"code": 1,
1588+
"mfgCode": null,
1589+
"source": "server",
1590+
"isIncoming": 0,
1591+
"isEnabled": 1
15841592
}
15851593
],
15861594
"attributes": [
@@ -4605,6 +4613,24 @@
46054613
"define": "IDENTIFY_CLUSTER",
46064614
"side": "client",
46074615
"enabled": 1,
4616+
"commands": [
4617+
{
4618+
"name": "Identify",
4619+
"code": 0,
4620+
"mfgCode": null,
4621+
"source": "client",
4622+
"isIncoming": 0,
4623+
"isEnabled": 1
4624+
},
4625+
{
4626+
"name": "TriggerEffect",
4627+
"code": 64,
4628+
"mfgCode": null,
4629+
"source": "client",
4630+
"isIncoming": 0,
4631+
"isEnabled": 1
4632+
}
4633+
],
46084634
"attributes": [
46094635
{
46104636
"name": "ClusterRevision",

examples/lock-app/lock-common/lock-app.matter

+1
Original file line numberDiff line numberDiff line change
@@ -2663,6 +2663,7 @@ endpoint 0 {
26632663
ram attribute clusterRevision default = 1;
26642664

26652665
handle command RetrieveLogsRequest;
2666+
handle command RetrieveLogsResponse;
26662667
}
26672668

26682669
server cluster GeneralDiagnostics {

examples/lock-app/lock-common/lock-app.zap

+8
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,14 @@
21262126
"source": "client",
21272127
"isIncoming": 1,
21282128
"isEnabled": 1
2129+
},
2130+
{
2131+
"name": "RetrieveLogsResponse",
2132+
"code": 1,
2133+
"mfgCode": null,
2134+
"source": "server",
2135+
"isIncoming": 0,
2136+
"isEnabled": 1
21292137
}
21302138
],
21312139
"attributes": [

examples/thermostat/thermostat-common/thermostat.matter

+1
Original file line numberDiff line numberDiff line change
@@ -2240,6 +2240,7 @@ endpoint 0 {
22402240
ram attribute clusterRevision default = 1;
22412241

22422242
handle command RetrieveLogsRequest;
2243+
handle command RetrieveLogsResponse;
22432244
}
22442245

22452246
server cluster GeneralDiagnostics {

examples/thermostat/thermostat-common/thermostat.zap

+8
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,14 @@
17071707
"source": "client",
17081708
"isIncoming": 1,
17091709
"isEnabled": 1
1710+
},
1711+
{
1712+
"name": "RetrieveLogsResponse",
1713+
"code": 1,
1714+
"mfgCode": null,
1715+
"source": "server",
1716+
"isIncoming": 0,
1717+
"isEnabled": 1
17101718
}
17111719
],
17121720
"attributes": [

scripts/setup/constraints.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ghapi==1.0.3
9898
# via -r requirements.memory.txt
9999
humanfriendly==10.0
100100
# via coloredlogs
101-
idf-component-manager==1.2.2
101+
idf-component-manager==1.5.2
102102
# via -r requirements.esp32.txt
103103
idna==3.4
104104
# via requests

scripts/tools/check_includes_config.py

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@
160160
'src/tracing/json/json_tracing.cpp': {'string', 'sstream'},
161161
'src/tracing/json/json_tracing.h': {'fstream', 'unordered_map'},
162162

163+
# esp32 tracing
164+
'src/tracing/esp32_trace/esp32_tracing.h': {'unordered_map'},
165+
163166
# Not intended for embedded clients
164167
'src/app/PendingResponseTrackerImpl.h': {'unordered_set'},
165168

src/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ if (chip_build_tests) {
143143
if (chip_monolithic_tests) {
144144
# TODO [PW_MIGRATION] Remove this if after migartion to PW_TEST is completed for all platforms
145145
# TODO [PW_MIGRATION] There will be a list of already migrated platforms
146-
if (chip_device_platform == "esp32") {
146+
if (chip_device_platform == "esp32" ||
147+
chip_device_platform == "nrfconnect") {
147148
deps += [ "${chip_root}/src/lib/support:pw_tests_wrapper" ]
148149
}
149150
build_monolithic_library = true

src/app/CommandHandler.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,17 @@ void CommandHandler::AddStatus(const ConcreteCommandPath & aCommandPath, const P
595595
{
596596
// Return early in case of requests targeted to a group, since they should not add a response.
597597
VerifyOrReturn(!IsGroupRequest());
598-
VerifyOrDie(FallibleAddStatus(aCommandPath, aStatus, context) == CHIP_NO_ERROR);
598+
599+
CHIP_ERROR error = FallibleAddStatus(aCommandPath, aStatus, context);
600+
601+
if (error != CHIP_NO_ERROR)
602+
{
603+
ChipLogError(DataManagement, "Failed to add command status: %" CHIP_ERROR_FORMAT, error.Format());
604+
605+
// Do not crash if the status has not been added due to running out of packet buffers or other resources.
606+
// It is better to drop a single response than to go offline and lose all sessions and subscriptions.
607+
VerifyOrDie(error == CHIP_ERROR_NO_MEMORY);
608+
}
599609
}
600610

601611
CHIP_ERROR CommandHandler::FallibleAddStatus(const ConcreteCommandPath & path, const Protocols::InteractionModel::Status status,

src/app/zap-templates/zcl/data-model/chip/matter-devices.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ limitations under the License.
7474
<requireAttribute>ACTIVE_LOCALE</requireAttribute>
7575
<requireAttribute>SUPPORTED_LOCALES</requireAttribute>
7676
</include>
77-
<include cluster="Time Format Localization" client="false" server="true" clientLocked="true" serverLocked="false">
77+
<include cluster="Time Format Localization" client="false" server="false" clientLocked="true" serverLocked="false">
7878
<requireAttribute>HOUR_FORMAT</requireAttribute>
7979
</include>
80-
<include cluster="Unit Localization" client="false" server="true" clientLocked="true" serverLocked="false"></include>
80+
<include cluster="Unit Localization" client="false" server="false" clientLocked="true" serverLocked="false"></include>
8181
<include cluster="General Diagnostics" client="false" server="true" clientLocked="true" serverLocked="true">
8282
<requireAttribute>UP_TIME</requireAttribute>
8383
</include>
@@ -1417,7 +1417,6 @@ limitations under the License.
14171417
<requireAttribute>IDENTIFY_TYPE</requireAttribute>
14181418
<requireCommand>Identify</requireCommand>
14191419
<requireCommand>IdentifyQuery</requireCommand>
1420-
<requireCommand>TriggerEffect</requireCommand>
14211420
</include>
14221421
<include cluster="Descriptor" client="false" server="true" clientLocked="true" serverLocked="true">
14231422
<requireAttribute>DEVICE_TYPE_LIST</requireAttribute>
@@ -1475,7 +1474,6 @@ limitations under the License.
14751474
<requireAttribute>IDENTIFY_TYPE</requireAttribute>
14761475
<requireCommand>Identify</requireCommand>
14771476
<requireCommand>IdentifyQuery</requireCommand>
1478-
<requireCommand>TriggerEffect</requireCommand>
14791477
</include>
14801478
<include cluster="Descriptor" client="false" server="true" clientLocked="true" serverLocked="true">
14811479
<requireAttribute>DEVICE_TYPE_LIST</requireAttribute>

src/controller/java/BUILD.gn

+1-6
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,7 @@ kotlin_library("kotlin_matter_controller") {
365365

366366
output_name = "KotlinMatterController.jar"
367367

368-
deps = [
369-
":java",
370-
":tlv",
371-
"${chip_root}/third_party/java_deps:annotation",
372-
]
368+
deps = [ ":java" ]
373369

374370
sources = [
375371
"src/matter/controller/CompletionListenerAdapter.kt",
@@ -400,7 +396,6 @@ kotlin_library("kotlin_matter_controller") {
400396

401397
if (matter_enable_java_compilation) {
402398
deps += [
403-
"${chip_root}/third_party/java_deps:json",
404399
"${chip_root}/third_party/java_deps:kotlin-stdlib",
405400
"${chip_root}/third_party/java_deps:kotlinx-coroutines-core-jvm",
406401
"${chip_root}/third_party/java_deps/stub_src",

src/credentials/attestation_verifier/FileAttestationTrustStore.cpp

+26-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ FileAttestationTrustStore::FileAttestationTrustStore(const char * paaTrustStoreP
5353
mIsInitialized = true;
5454
}
5555

56-
std::vector<std::vector<uint8_t>> LoadAllX509DerCerts(const char * trustStorePath)
56+
std::vector<std::vector<uint8_t>> LoadAllX509DerCerts(const char * trustStorePath, CertificateValidationMode validationMode)
5757
{
5858
std::vector<std::vector<uint8_t>> certs;
5959
if (trustStorePath == nullptr)
@@ -89,21 +89,39 @@ std::vector<std::vector<uint8_t>> LoadAllX509DerCerts(const char * trustStorePat
8989
if ((certificateLength > 0) && (certificateLength <= kMaxDERCertLength))
9090
{
9191
certificate.resize(certificateLength);
92-
// Only accumulate certificate if it has a subject key ID extension
93-
{
94-
uint8_t kidBuf[Crypto::kSubjectKeyIdentifierLength] = { 0 };
95-
MutableByteSpan kidSpan{ kidBuf };
96-
ByteSpan certSpan{ certificate.data(), certificate.size() };
92+
ByteSpan certSpan{ certificate.data(), certificate.size() };
9793

94+
// Only accumulate certificate if it passes validation.
95+
bool isValid = false;
96+
switch (validationMode)
97+
{
98+
case CertificateValidationMode::kPAA: {
9899
if (CHIP_NO_ERROR != VerifyAttestationCertificateFormat(certSpan, Crypto::AttestationCertType::kPAA))
99100
{
100-
continue;
101+
break;
101102
}
102103

104+
uint8_t kidBuf[Crypto::kSubjectKeyIdentifierLength] = { 0 };
105+
MutableByteSpan kidSpan{ kidBuf };
103106
if (CHIP_NO_ERROR == Crypto::ExtractSKIDFromX509Cert(certSpan, kidSpan))
104107
{
105-
certs.push_back(certificate);
108+
isValid = true;
106109
}
110+
break;
111+
}
112+
case CertificateValidationMode::kPublicKeyOnly: {
113+
Crypto::P256PublicKey publicKey;
114+
if (CHIP_NO_ERROR == Crypto::ExtractPubkeyFromX509Cert(certSpan, publicKey))
115+
{
116+
isValid = true;
117+
}
118+
break;
119+
}
120+
}
121+
122+
if (isValid)
123+
{
124+
certs.push_back(certificate);
107125
}
108126
}
109127
fclose(file);

src/credentials/attestation_verifier/FileAttestationTrustStore.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,29 @@
2525
namespace chip {
2626
namespace Credentials {
2727

28+
enum class CertificateValidationMode
29+
{
30+
// Validate that the certificate is a valid PAA certificate.
31+
kPAA,
32+
// Validate just that the certificate has a public key we can extract
33+
// (e.g. it's a CD signing certificate).
34+
kPublicKeyOnly,
35+
};
36+
2837
/**
2938
* @brief Load all X.509 DER certificates in a given path.
3039
*
31-
* Silently ignores non-X.509 files and X.509 files without a subject key identifier.
40+
* Silently ignores non-X.509 files and X.509 files that fail validation as
41+
* determined by the provided validation mode.
3242
*
3343
* Returns an empty vector if no files are found or unrecoverable errors arise.
3444
*
3545
* @param trustStorePath - path from where to search for certificates.
46+
* @param validationMode - how the certificate files should be validated.
3647
* @return a vector of certificate DER data
3748
*/
38-
std::vector<std::vector<uint8_t>> LoadAllX509DerCerts(const char * trustStorePath);
49+
std::vector<std::vector<uint8_t>> LoadAllX509DerCerts(const char * trustStorePath,
50+
CertificateValidationMode validationMode = CertificateValidationMode::kPAA);
3951

4052
class FileAttestationTrustStore : public AttestationTrustStore
4153
{

src/platform/Zephyr/BLEManagerImpl.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#include <zephyr/bluetooth/addr.h>
4141
#include <zephyr/bluetooth/gatt.h>
42+
#include <zephyr/bluetooth/hci.h>
4243
#include <zephyr/random/rand32.h>
4344
#include <zephyr/sys/byteorder.h>
4445
#include <zephyr/sys/util.h>

src/test_driver/nrfconnect/main/runner.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
#include <lib/support/CodeUtils.h>
19+
#include <lib/support/UnitTest.h>
1920
#include <lib/support/UnitTestRegistration.h>
2021
#include <platform/CHIPDeviceLayer.h>
2122

@@ -35,6 +36,7 @@ extern "C" int main(void)
3536

3637
LOG_INF("Starting CHIP tests!");
3738
int status = RunRegisteredUnitTests();
39+
status += chip::test::RunAllTests();
3840
LOG_INF("CHIP test status: %d", status);
3941

4042
_exit(status);

0 commit comments

Comments
 (0)