You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UseSecurityFeatures.md
+63-43Lines changed: 63 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -2,26 +2,36 @@
2
2
3
3
## 1 Pre-requisites
4
4
5
-
In the [Getting Started Guide](GettingStartedGuide.md), one would have setup the ESP32-C3 device, installed the required software, setup AWS IoT, configured the demo project with the AWS IoT endpoint, thing name, private key and certificates, and built and run the demo.
5
+
In the [Getting Started Guide](GettingStartedGuide.md), one would have setup
6
+
the ESP32-C3 device, installed the required software, setup AWS IoT, configured
7
+
the demo project with the AWS IoT endpoint, thing name, private key and
8
+
certificates, and built and run the demo.
6
9
7
10
## 2 Enable the DS peripheral
8
11
9
12
1. Run `idf.py menuconfig`
10
-
2. Select `Featured FreeRTOS IoT Integration`.
11
-
3. Select `Use DS Peripheral`.
12
-
4. Go back to the main menu.
13
+
1. Select `Component config`.
14
+
1. Select `ESP-TLS`.
15
+
1. Enable `Use Digital Signature (DS) Peripheral with ESP-TLS`.
16
+
It should have `*` marked with the entry when enabled.
17
+
1. Go back to `Component config` menu.
18
+
1. Select `ESP Secure Cert Manager`.
19
+
1. Enable `Enable DS peripheral support`.
20
+
It should have `*` marked with the entry when enabled.
21
+
1. Go back to main menu.
13
22
14
23
## 3 Enable flash encryption
15
24
16
-
5. Select `Security features`.
17
-
6. Set `Enable flash encryption on boot (READ DOCS FIRST)` to true.
18
-
7. Select `Enable usage mode`.
19
-
8. Set `Development (NOT SECURE)` to true.
20
-
9. Go back to `Security features`.
21
-
10. Go back to main menu, Save and Exit.
25
+
1. Select `Security features`.
26
+
1. Set `Enable flash encryption on boot (READ DOCS FIRST)` to true.
27
+
1. Select `Enable usage mode`.
28
+
1. Enable `Development (NOT SECURE)`. It should have `X` marked with the entry
29
+
when enabled.
30
+
1. Go back to `Security features`.
31
+
1. Go back to main menu, Save and Exit.
22
32
23
-
**NOTE**: This enables Flash Encryption in **Development Mode**. For production devices,
24
-
refer to Espressif's documentation on
33
+
**NOTE**: This enables Flash Encryption in **Development Mode**. For production
34
+
devices, refer to Espressif's documentation on
25
35
[**Release Mode** for Flash Encryption](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/security/flash-encryption.html#release-mode)
26
36
27
37
## 4 Provision the ESP32-C3 with the private key, device certificate and CA certificate in Development Mode
@@ -31,23 +41,25 @@ connection will be encrypted and stored in a special flash partition.
31
41
1. Download the necessary components by running `idf.py reconfigure`
32
42
1. Create the `esp_secure_crt` partition binary. If this is the first time
33
43
running this command, an eFuse block in the ESP32-C3 will be burnt with a
34
-
generated key and this **CANNOT** be reversed:
44
+
generated key and this **CANNOT** be reversed.
45
+
46
+
- Replace the following:
47
+
- **PORT** with the serial port to which the ESP32-C3 board is connected.
48
+
- **CA_CERT_FILEPATH** with the file path to the **PEM-encoded root CA certificate**.
49
+
- **DEVICE_CERT_FILEPATH** with the file path to the **PEM-encoded device certificate**.
50
+
- **PRIVATE_KEY_FILEPATH** with the file path to the **PEM-encoded private key**.
51
+
- **CHIP_TYPE** with chip type of the target (eg. esp32c3).
52
+
- **PRIVATE_KEY_ALGORITHM** with the algorithm used on the private key.
**PORT** with the serial port to which the ESP32-C3 board is connected.
40
-
**CA_CERT_FILEPATH** with the file path to the **PEM-encoded root CA certificate**.
41
-
**DEVICE_CERT_FILEPATH** with the file path to the **PEM-encoded device certificate**.
42
-
**PRIVATE_KEY_FILEPATH** with the file path to the **PEM-encoded private key**.
60
+
- Type in **BURN** when prompted to.
43
61
44
-
Type in BURN when prompted to.
45
62
46
-
2. Write the `esp_secure_crt` partition binary (stored in `esp_secure_cert_data/esp_secure_crt.bin`) to the ESP32-C3's flash by running the following command:
47
-
```
48
-
esptool.py --no-stub --port PORT write_flash 0xD000 esp_secure_cert_data/esp_secure_cert.bin
49
-
```
50
-
Replace **PORT** with the serial port to which the ESP32-C3 board is connected.
51
63
52
64
## 5 Configure Secure Boot
53
65
@@ -57,7 +69,7 @@ to the Secure Boot section in the
57
69
[Featured FreeRTOS IoT Integration page for the ESP32-C3](https://www.freertos.org/featured-freertos-iot-integration-targeting-an-espressif-esp32-c3-risc-v-mcu/)
58
70
on FreeRTOS.org for further details. The private key can be generated with the
2. Flash the bootloader by copying and pasting the command under "Secure boot
97
-
enabled, so bootloader not flashed automatically," (the second block of text)
110
+
enabled, so bootloader not flashed automatically," (the second block of text),
98
111
replacing:
99
-
**PORT** with the serial port to which the ESP32-C3 is connected. (Do not include
100
-
the opening and closing braces around PORT in the command)
101
-
**BAUD** with 460800.
112
+
- **(PORT)** with the serial port to which the ESP32-C3 is connected.
113
+
(Do not includethe opening and closing braces around PORT in the command)
114
+
- **(BAUD)** with 460800.
115
+
102
116
103
117
## 6 Build and flash the demo project
104
118
@@ -117,7 +131,8 @@ Run the following command to build and flash the demo project:
117
131
```
118
132
idf.py -p PORT flash monitor
119
133
```
120
-
Replace **PORT** with the serial port to which the ESP32-C3 is connected.
134
+
Replace:
135
+
-**PORT** with the serial port to which the ESP32-C3 is connected.
121
136
122
137
**NOTE**: If Flash Encryption was enabled, instead of `flash`, you must use
123
138
`encrypted-flash` to flash the board AFTER this step i.e. with subsequent flashes.
@@ -198,8 +213,7 @@ Create a binary with a higher version number.
198
213
```
199
214
idf.py build
200
215
```
201
-
If successful, there will be a new binary under the 'build' directory - build/
202
-
GoldenReferenceIntegration.bin. Copy this binary to another location, else it will
216
+
If successful, there will be a new binary under the 'build' directory - build/FeaturedFreeRTOSIoTIntegration.bin. Copy this binary to another location, else it will
203
217
be overwritten in the next step.
204
218
205
219
### 8.2 Build and flash the device with a binary with a lower version number
@@ -212,8 +226,8 @@ idf.py -p PORT encrypted-flash monitor
212
226
`flash`, we use `encrypted-flash` to flash the board for this step.
213
227
214
228
### 8.3 Upload the binary with the higher version number (created in step 8.1) and create an OTA Update Job
215
-
1. In the navigation pane of the AWS IoT console, choose 'Manage', and then choose 'Jobs'.
216
-
Choose 'Create a job'.
229
+
1. In the navigation pane of the AWS IoT console, choose 'Remote actions',
230
+
and then choose 'Jobs'. Choose 'Create a job'.
217
231
2. Next to 'Create a FreeRTOS Over-the-Air (OTA) update job', choose
218
232
'Create FreeRTOS OTA update job'. Provide a name for the job and click on 'Next'.
219
233
3. You can deploy an OTA update to a single device or a group of devices.
@@ -227,16 +241,18 @@ with your devices.
227
241
created earlier.
228
242
7. Under 'File', choose 'Upload a new file' then click 'Choose file'. A file
229
243
browser pops up. Select the signed binary image with the higher version number.
230
-
8. Under 'File upload location in S3', click 'Browse S3', then select the S3 bucket
231
-
that you had earlier created for this job. Click 'Choose'
244
+
8. Under 'File upload location in S3', click 'Browse S3', then select the S3
245
+
bucket that you had earlier created for this job. Click 'Choose'
232
246
9. Under 'Path name of file on device', type 'NA'
233
247
10. Under 'IAM role for OTA update job', choose the role that you created
234
248
earlier for the OTA update from the drop down list.
235
-
11. Click 'Next', then click on 'Create job'. Confirm if the job was created successfully.
249
+
11. Click 'Next', then click on 'Create job'. Confirm if the job was created
250
+
successfully.
236
251
237
252
### 8.4 Monitor OTA
238
253
239
-
Once the job is created successfully, the demo should start downloading the firmware in chunks. For eg.
254
+
Once the job is created successfully, the demo should start downloading the
255
+
firmware in chunks. For eg.
240
256
```
241
257
I (196573) ota_over_mqtt_demo: OTA Event processing completed. Freeing the event buffer to pool.
242
258
I (196583) AWS_OTA: Current State=[WaitingForFileBlock], Event=[ReceivedFileBlock], New state=[WaitingForFileBlock]
@@ -253,8 +269,12 @@ I (197603) ota_over_mqtt_demo: Received: 160 Queued: 160 Processed: 160 D
Once all the firmware image chunks are downloaded and the signature is validated, the device reboots with the new image, during which the Secure Boot sequence is executed. See the OTA section in the [Featured FreeRTOS IoT Integration page for the ESP32-C3](https://www.freertos.org/featured-freertos-iot-integration-targeting-an-espressif-esp32-c3-risc-v-mcu/) on FreeRTOS.org for more details.
257
-
You can see the new version number of the demo binary. Look for the string "Application version"
272
+
Once all the firmware image chunks are downloaded and the signature is validated,
273
+
the device reboots with the new image, during which the Secure Boot sequence is
274
+
executed. See the OTA section in the
275
+
[Featured FreeRTOS IoT Integration page for the ESP32-C3](https://www.freertos.org/featured-freertos-iot-integration-targeting-an-espressif-esp32-c3-risc-v-mcu/)
276
+
on FreeRTOS.org for more details. You can see the new version number of the
277
+
demo binary. Look for the string "Application version"
0 commit comments