Skip to content

Commit 2c3f777

Browse files
Merge branch 'air-purifier-app-ci-build' of github.com:raul-marquez-csa/connectedhomeip into air-purifier-app-ci-build
2 parents 14fa564 + 109c095 commit 2c3f777

File tree

10 files changed

+61
-28
lines changed

10 files changed

+61
-28
lines changed

config/esp32/components/chip/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER)
444444
list(APPEND matter_requires espressif__esp_secure_cert_mgr)
445445
endif()
446446

447+
if (CONFIG_ENABLE_ENCRYPTED_OTA)
448+
list(APPEND matter_requires espressif__esp_encrypted_img)
449+
endif()
450+
447451
add_prebuilt_library(matterlib "${CMAKE_CURRENT_BINARY_DIR}/lib/libCHIP.a"
448452
REQUIRES ${matter_requires})
449453

config/esp32/components/chip/idf_component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
- if: "idf_version >=4.3"
1212

1313
espressif/esp_encrypted_img:
14-
version: "2.1.0"
14+
version: "2.3.0"
1515
require: public
1616
rules:
1717
- if: "idf_version >=4.4"

docs/platforms/esp32/ota.md

+30-15
Original file line numberDiff line numberDiff line change
@@ -92,35 +92,50 @@ image can be encrypted/decrypted using an RSA-3072 key pair.
9292
9393
Please follow the steps below to generate an application image for OTA upgrades:
9494
95-
1. Generate a new RSA-3072 key pair or use an existing one.
95+
1. Generate a new RSA-3072 key pair or use an existing one.
9696
97-
- To generate a key pair, use the following command:
97+
- To generate a key pair, use the following command:
9898
9999
```
100100
openssl genrsa -out esp_image_encryption_key.pem 3072
101101
```
102102
103-
- Extract the public key from the key pair:
103+
- Extract the public key from the key pair:
104104
```
105105
openssl rsa -in esp_image_encryption_key.pem -pubout -out esp_image_encryption_public_key.pem
106106
```
107107
108-
2. Encrypt the application binary using the
109-
[esp_enc_img_gen.py](https://github.com/espressif/idf-extra-components/blob/master/esp_encrypted_img/tools/esp_enc_img_gen.py)
110-
script.
108+
2. Encrypt the application binary using the
109+
[esp_enc_img_gen.py](https://github.com/espressif/idf-extra-components/blob/master/esp_encrypted_img/tools/esp_enc_img_gen.py)
110+
script.
111111
112-
- Use the following command to encrypt the OTA image with the public key:
112+
Use the following command to encrypt the OTA image with the public key:
113113
114-
```
115-
python3 esp_enc_img_gen.py encrypt lighting-app.bin esp_image_encryption_public_key.pem lighting-app-encrypted.bin
116-
```
114+
```
115+
python3 esp_enc_img_gen.py encrypt lighting-app.bin esp_image_encryption_public_key.pem lighting-app-encrypted.bin
116+
```
117117
118-
- Append the Matter OTA header:
119-
```
120-
src/app/ota_image_tool.py create --vendor-id 0xFFF1 --product-id 0x8000 --version 2 --version-str "v2.0" -da sha256 lighting-app-encrypted.bin lighting-app-encrypted-ota.bin
121-
```
118+
Optionally, you can use the cmake function `create_esp_enc_img()` to encrypt
119+
the OTA image during the build process. Please find the usage below. This is
120+
also demonstrated in the `examples/lighting-app/esp32/main/CMakeLists.txt`
121+
file.
122+
123+
```
124+
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
125+
${project_dir}/esp_image_encryption_public_key.pem
126+
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-encrypted.bin
127+
app)
128+
```
129+
130+
3. Append the Matter OTA header
131+
132+
```
133+
src/app/ota_image_tool.py create --vendor-id 0xFFF1 --product-id 0x8000 \
134+
--version 2 --version-str "v2.0" -da sha256 \
135+
lighting-app-encrypted.bin lighting-app-encrypted-ota.bin
136+
```
122137
123-
3. Use the `lighting-app-encrypted-ota.bin` file with the OTA Provider app.
138+
4. Use the `lighting-app-encrypted-ota.bin` file with the OTA Provider app.
124139
125140
## Delta OTA
126141

examples/all-clusters-app/nrfconnect/prj.conf

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
5757

5858
# Increase the settings partition
5959
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000
60+
61+
# Increase heap size
62+
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=10240

examples/all-clusters-app/nrfconnect/prj_dfu.conf

+3
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y
5555

5656
# Enable the Read Client for binding purposes
5757
CONFIG_CHIP_ENABLE_READ_CLIENT=y
58+
59+
# Increase heap size
60+
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=10240

examples/all-clusters-app/nrfconnect/prj_release.conf

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
6666
# Enable LTO to reduce the flash usage
6767
CONFIG_LTO=y
6868
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
69+
70+
# Increase heap size
71+
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=10240

examples/lighting-app/esp32/main/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ target_compile_options(${COMPONENT_LIB} PUBLIC
8282
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
8383
)
8484

85+
if (CONFIG_ENABLE_ENCRYPTED_OTA)
86+
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
87+
${project_dir}/esp_image_encryption_public_key.pem
88+
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-encrypted.bin
89+
app)
90+
endif()
91+
8592
if (CONFIG_ENABLE_PW_RPC)
8693

8794
get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH)

examples/platform/silabs/sensors/AirQuality/AirQualitySensor.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@
2222
#include <platform/CHIPDeviceLayer.h>
2323

2424
#ifdef USE_SPARKFUN_AIR_QUALITY_SENSOR
25-
#ifdef __cplusplus
26-
extern "C" {
27-
#endif
28-
#include <sparkfun_sgp40.h>
29-
}
3025
#include "sl_i2cspm_instances.h"
26+
#include <sparkfun_sgp40.h>
3127
#endif // USE_SPARKFUN_AIR_QUALITY_SENSOR
3228

3329
namespace {

scripts/build/builders/nrf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _build(self):
220220
# Note: running zephyr/zephyr.elf has the same result except it creates
221221
# a flash.bin in the current directory. ctest has more options and does not
222222
# pollute the source directory
223-
self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', os.path.join(self.output_dir, 'nrfconnect')],
223+
self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', os.path.join(self.output_dir, 'nrfconnect'), '--no-tests=error'],
224224
title='Run Tests ' + self.identifier)
225225

226226
def _bundle(self):

src/credentials/FabricTable.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,17 @@ CHIP_ERROR FabricTable::ValidateIncomingNOCChain(const ByteSpan & noc, const Byt
346346
ChipLogProgress(FabricProvisioning, "Validating NOC chain");
347347
CHIP_ERROR err = FabricTable::VerifyCredentials(noc, icac, rcac, validContext, outCompressedFabricId, outFabricId, outNodeId,
348348
outNocPubkey, &outRootPubkey);
349-
if (err != CHIP_NO_ERROR && err != CHIP_ERROR_WRONG_NODE_ID)
350-
{
351-
err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT;
352-
}
353349
if (err != CHIP_NO_ERROR)
354350
{
355-
ChipLogError(FabricProvisioning, "Failed NOC chain validation: %" CHIP_ERROR_FORMAT, err.Format());
351+
ChipLogError(FabricProvisioning, "Failed NOC chain validation, VerifyCredentials returned: %" CHIP_ERROR_FORMAT,
352+
err.Format());
353+
354+
if (err != CHIP_ERROR_WRONG_NODE_ID)
355+
{
356+
err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT;
357+
}
358+
return err;
356359
}
357-
ReturnErrorOnFailure(err);
358360

359361
// Validate fabric ID match for cases like UpdateNOC.
360362
if (existingFabricId != kUndefinedFabricId)

0 commit comments

Comments
 (0)