Skip to content

Commit 3475f0f

Browse files
rcasallas-silabsmkardous-silabs
authored andcommitted
Pull request project-chip#1783: [AUTO] Provision: README updated.
Merge in WMN_TOOLS/matter from docs/provision_readme to RC_2.3.0-1.3 Squashed commit of the following: commit 4bae60a059f6e8d924a84a7ec1da67a33279ff77 Author: Ricardo Casallas <77841255+rcasallas-silabs@users.noreply.github.com> Date: Thu Apr 25 08:30:51 2024 -0400 Code review. commit cb6e5c6db430eef9e55d4dafa06d1e6e3893a989 Author: Ricardo Casallas <77841255+rcasallas-silabs@users.noreply.github.com> Date: Wed Apr 24 08:13:59 2024 -0400 Provision: README updated.
1 parent 04c0100 commit 3475f0f

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

provision/README.md

+49-49
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,43 @@ The provisioning script on this folder now supercedes the following tools:
1818

1919
## Provisioned Data
2020

21-
The Commissionable Data includes Serial Number, Vendor Id, Product Id, and the Setup Payload (typicallty displayed in the QR),
22-
while the Attestation Credentials includes the Certificate Declaration (CD), the Product Attestation Intermediate (PAI) certificate,
23-
and the DAC (Device Attestation Certificate).
21+
The _Commissionable Data_ includes _Serial Number_, _Vendor Id_, _Product Id_, and the _Setup Payload_ (typicallty displayed in the QR code),
22+
while the _Attestation Credentials_ include the _Certificate Declaration_ (CD), the _Product Attestation Intermediate certificate_ (PAI),
23+
and the _Device Attestation Certificate_ (DAC).
2424

2525
During commissioning, Matter devices perform a Password Authenticated Key Exchange using the SPAKE2+ protocol.
26-
Calculating the SPAKE2+ verifier is computationally costly. For large iteration counts, the target device may require several minutes to compute. For this reason, the SPAKE2+ verifier is calculated on the host side by the script itself.
26+
Calculating the SPAKE2+ verifier is computationally costly, for large iteration counts it may take several minutes to
27+
compute on the target device. For this reason, the SPAKE2+ verifier is calculated on the host side by the script itself.
2728

28-
The passcode is used to derive a QR code, typically printed on the label, or displayed by the device itself.
29+
The `passcode` is used to derive a QR code, typically printed on the label, or displayed by the device itself.
2930
The QR code contains the pre-computed setup payload, which allows the commissioner to establish a session with the device.
3031
The parameters required to generate and validate the session keys are static and stored in NVM3.
3132

3233
To protect the attestation private-key (used to generate the DAC), the asymmetric key-pair may be generated on-device, using PSA,
33-
and in the most secure storage location available to the specific part. However, the private-key may be generated externally,
34-
and imported using the --dac_key option.
34+
and the most secure storage location available to the specific part. However, the private-key may be generated externally,
35+
and imported using the `--dac_key` option.
3536

36-
The DAC is generated and signed by a Certification Authority (CA), which may reside on a separate host. The `modules/signing_server.py`
37+
The DAC is generated and signed by a _Certification Authority_ (CA), which may operate from a separate host. The `modules/signing_server.py`
3738
script simulates the role of the CA, and uses OpenSSL to to generate and sign the DAC. In a real factory environment,
3839
this script is replaced by an actual CA.
3940

4041
## Generator Firmware
4142

42-
The Generator Firmware (GFW) is a FreeRTOS application that runs on the targeted device, and assists with the provisioning of the device.
43+
The _Generator Firmware_ (GFW) is a FreeRTOS application that runs on the targeted device, and assists with the provisioning of the device.
4344
The GFW performs the following tasks:
4445
* When key-generation is used:
4546
- Generates the key-pair on device in the most secure location available.
46-
- Generates and returns a CSR (Certificate Signing Request). The CSR contains the device public-key, Vendor Id, Product Id, and Serial Number.
47+
- Generates and returns a _Certificate Signing Request_ (CSR). The CSR contains the device public-key, Vendor Id, Product Id, and Serial Number.
4748
* When key-import is used:
4849
- Imports the key into the most secure location available.
49-
* Calculates the Setup Payload
50-
* Stores the Commissionable Data into NVM3 (including the Setup Payload)
50+
* Calculates the _Setup Payload_.
51+
* Stores the Commissionable Data into NVM3 (including the _Setup Payload_).
5152
* Stores the Attestation Data on the main flash (CD, PAI, DAC)
5253
* Stores the size and offsets used to store the Attestation Data, along with the KeyId used to store the private-key.
5354

5455
The main source code of the GFW is located under `./generator`, while the board support is located under `./support`.
5556
Pre-compiled images for the supported chips can be found in `./images`.
56-
Backwards-compatibility files are stored under `./modules/vX_Y` where X.Y matches the targeted version.
57+
Backwards-compatibility script files are stored under `./modules/vX_Y` where X.Y matches the targeted version.
5758

5859
The directory structure is as follows:
5960
- provision
@@ -91,8 +92,8 @@ The Provisioner Script executes the following steps:
9192

9293
The Provision Tool exchange information with the Provision firmware (either GFW or the PFW itself) using a proprietary protocol.
9394
The original protocol, known as version 1.x, serves the basic purposes of CPMS and other factory environments, but is limited in scope.
94-
To overcome these limitations, a new protocol has been developed. For backwards compatibility, users familiar to this tool should not notice
95-
the difference between the protocols. It should only become evident when new functionality is required, which is only supported in version 2.0.
95+
It can only transmit a pre-defined structures, and it doesn't support fragmentation. To overcome these limitations, a new protocol (version 2.x) has been developed. For backwards compatibility, users familiar to 1.x should not notice the difference between the protocols. The difference
96+
only becomes evident when new functionality is required, which is only supported in version 2.x.
9697

9798
### Version 1.x
9899
Verion 1 defines the following commands:
@@ -108,25 +109,24 @@ There are no extension capabilities on this protocol, nor any provision to read-
108109
Version 2 of the Provision Protocol enforces a maximum package size. Data larger than the limit is fragmented in
109110
as many packages are needed. This is done in both directions. Commands defined in this protocol are:
110111
* Init: Used for initialization. Sends the flash size and location to the firmware.
111-
* Finish: Sent to signal that provisioning is complete.
112+
* Finish: Signal that provisioning is complete.
112113
* CSR: Used for on-device key and CSR generation.
113114
* Write: Send any number of arguments to the target device.
114115
* Read: Returns any number of arguments from the target device.
115-
With Write and Read, any number of arguments, of any length, may be sent in any order.
116-
However, by default, the script uses the Write and Read commands to send the same data as version 1,
116+
With _Write_ and _Read_, any number of arguments, of any length, may be sent in any order.
117+
However, by default, the script uses the _Write_ and _Read_ commands to send the same data as version 1,
117118
thus preserving the user experience of the tool.
118119
Instead of fixed-positions, this protocol uses IDs to identify the arguments in both ends.
119-
Custom arguments must have IDs range 0x00 to 0xff (255).
120120

121121
## Channels
122122

123123
The Provision Tool can transfer the arguments to the device in two ways:
124124
* J-Link RTT: When the device is physically connected to the host, the GFW can communicate through the serial port using J-Link RTT.
125-
This method can be used both in development and factory environments. This methods works with the legacy Protocol version 1.0 or
126-
the new protocol version 2.0.
125+
This method can be used both in development and factory environments. This method works with the legacy Protocol version 1.x or
126+
the new protocol version 2.x.
127127
* Bluetooth: The provision script can transmit the data directly to applications running in provision-mode. While in this mode,
128-
Silicon Labs' example applications use Bluetooth communication to receive provisioning data. The Bluetooh channel requires
129-
Provision Protocol v2.0.
128+
Silicon Labs' example applications use the bluetooth communication to receive provisionning data. The Bluetooh channel requires
129+
Provision Protocol v2.x.
130130

131131
### Parameters
132132

@@ -185,6 +185,7 @@ file defines the well-known (default) parameters used by the automatic provision
185185
| -dp, --key_pass | optional<sup>3</sup> | string | Password for the key file. |
186186
| -dx, --pkcs12 | optional<sup>3</sup> | string | Path to the PKCS#12 attestation certificates file. Formerly --att_certs. |
187187
| -dn, --common_name | optional<sup>4</sup> | string | Common Name to use in the Device Certificate (DAC) . |
188+
| -ok, --ota_key | optional | string | Over The Air (OTA) update key. |
188189

189190
<sup>1</sup> Use xxxxxxxxx for serial, xxx.xxx.xxx.xxx[:yyyy] for TCP, or bt:XXXXXXXXXXXXXXXX for bluetooth
190191
<sup>2</sup> If not provided (or zero), the `discriminator` is generated at random
@@ -193,8 +194,8 @@ file defines the well-known (default) parameters used by the automatic provision
193194
<sup>5</sup> If not provided, the `unique_id` is randomly generated
194195
<sup>6</sup> Salt and verifier must be provided as base64 string
195196

196-
>WARNING:
197-
With the release of version 2.0, many shortcuts have been modified. Single characters are now reserved for tool options.
197+
WARNING:
198+
With the release of version 2.0, many shortcuts have been modified. Single-characters are now reserved for tool options.
198199
Most long versions have been preserved, with the exception of `--config` and `--att_certs`.
199200

200201
### Custom Parameters
@@ -226,7 +227,7 @@ Otherwise, the path to the parameters file may be provided with the `--params` o
226227
Supported types are int8u, int16u, int32u, string, binary, and path. The `path` parameters must point to an existing file in the filesystem.
227228
If such file exists, its contents are read and sent to the firmware as a binary value.
228229

229-
Given the previous configuration, the actual argument may be provided via command-line:
230+
Given the previous configuration, the actual arguments may be provided as command-line:
230231
```
231232
python3 provision.py -x1 99 --example2 "ABC123"
232233
```
@@ -250,14 +251,13 @@ Or, as part of an input file:
250251
}
251252
```
252253

253-
On the firmware side, custom parameters are routed to the [Custom Provision Storage](examples/platform/silabs/provision/ProvisionStorageCustom.cpp).
254-
A sample implementation is provided, but it must be replaced with a class that matches the parameters defined in the YAML descriptor.
254+
On the firmware side, custom parameters are sent to the [Custom Provision Storage](examples/platform/silabs/provision/ProvisionStorageCustom.cpp).
255+
A sample implementation is provided, but it must be replaced with a class that matches with parameters defined in the YAML descriptor.
255256

256257

257258
## Actions
258259

259-
When using version 1.x, there is only one action available. This action performs the device provisioning as automatically as possible.
260-
260+
When using version 1.x, there is only action available, which performs device provisioning as automatically as possible.
261261
In contrast, version 2.x defines the following actions:
262262
* `auto`: This is the default action, and emulates the automatic provisioning performed in version 1.
263263
This action sends: `version`, `serial_number`, `vendor_id`, `vendor_name`, `product_id`, `product_name`, `product_label`, `product_url`, `part_number`, `hw_version`, `hw_version_str`, `manufacturing_date`, `unique_id`, `discriminator`, `spake2p_passcode`, `spake2p_iterations`, `spake2p_salt`, `spake2p_verifier`, `setup_payload`, `commissioning_flow`, `rendezvous_flags`, `firmware_info`, `dac_cert`, `pai_cert`, `certification`, `dac_key`
@@ -288,7 +288,7 @@ Any or all of these arguments may be overwritten though the command line.
288288

289289
The -i/--inputs argument reads all the required arguments from a provided JSON file. The same validation rules apply
290290
both for command line or configuration file, but JSON does not support hexadecimal numbers. Command line arguments
291-
override arguments read from a configuration file. For instance, with the configuration `example.json`:
291+
take precedence over file arguments. For instance, with the configuration `example.json`:
292292
```
293293
{
294294
"version": "2.0",
@@ -315,27 +315,27 @@ You may run:
315315
```
316316
python3 ./provision.py --inputs example.json
317317
```
318-
Which will set the connected device with discriminator 3840, product ID 32773, and use 15000 SPAKE2+ iterations.
319-
320-
However, if you run instead:
318+
Which will set the connected device with discriminator **3840**, product ID **32773**, and use **15000** SPAKE2+ iterations. However, if you run instead:
321319
```
322320
python3 ./provision.py --inputs example.json --discriminator 2748 --product_id 0x8006 --spake2p_iterations 10000
323321
```
324-
The connected device will be set with discriminator 2748 (instead of 3840), product ID 32774 (instead of 32773),
325-
and use 10000 SPAKE2+ iterations (instead of 15000).
322+
The connected device will be set with discriminator **2748** (instead of 3840), product ID **32774** (instead of 32773),
323+
and use **10000** SPAKE2+ iterations (instead of 15000).
326324

327-
For each run, `provision.py` will generate a local file `./latest.json`, containing the arguments compiled from the different sources.
325+
For each run, `provision.py` will generate a local file `latest.json`, containing the arguments compiled from the different sources.
328326
Example input files may be found under `./inputs/`:
329327
```
330328
python3 ./provision.py --inputs inputs/develop.json
331329
```
330+
NOTE:
331+
In earlier versions, the JSON files where found under `./config`. Version 2.x uses two kinds of files: parameters (YAML) and inputs (JSON).
332332

333333
### Default Arguments
334334

335-
To ease development and testing, either `provision.py` or the firmware provide defaults for all arguments. The only
335+
To ease development and testing, either the Provision Tool or the firmware provide defaults for all arguments. The only
336336
arguments that are truly mandatory are `vendor_id`, and `product_id`, and these are included in `defaults.json`.
337-
Test certificates may be auto-generated using the `--generate` flag (provided the `chip-cert` can be found either
338-
in the default location or through the `--cert-tool` argument).
337+
Test certificates may be auto-generated using the `--generate` flag (provided the `chip-cert` can be found, either
338+
in the default location, or through the `--cert-tool` argument).
339339
For instance, you may run:
340340
```
341341
python3 ./provision.py --vendor_id 0x1049 --product_id 0x8005 --generate
@@ -360,19 +360,19 @@ Which will generate the test certificates using `chip-cert`, and provide the dev
360360

361361
## Attestation Files
362362

363-
The `--generate` option instructs the `provider.py` script to generate test attestation files with the given Vendor ID, and Product ID.
363+
The `--generate` option instructs the `provider.py` script to generate test attestation files with the given _Vendor ID_, and _Product ID_.
364364
These files are generated using [the chip-cert tool](../src/tools/chip-cert/README.md),
365365
and stored under the `./temp` folder (or the folder selected with `--temp` option).
366366

367-
To generate the certificates manually:
367+
To generate the certificates manually (check chip-cert help for details):
368368
```
369-
./out/debug/chip-cert gen-cd -f 1 -V 0xfff1 -p 0x8005 -d 0x0016 -c ZIG20142ZB330003-24 -l 0 -i 0 -n 257 -t 0 -o 0xfff1 -r 0x8005 -C ./credentials/test/certification-declaration/Chip-Test-CD-Signing-Cert.pem -K ./credentials/test/certification-declaration/Chip-Test-CD-Signing-Key.pem -O ./temp/cd.der
369+
chip-cert gen-cd -f 1 -V 0xfff1 -p 0x8005 -d 0x0016 -c ZIG20142ZB330003-24 -l 0 -i 0 -n 257 -t 0 -o 0xfff1 -r 0x8005 -C credentials/test/certification-declaration/Chip-Test-CD-Signing-Cert.pem -K credentials/test/certification-declaration/Chip-Test-CD-Signing-Key.pem -O ./temp/cd.der
370370
371-
./out/debug/chip-cert gen-att-cert -t a -l 3660 -c "Matter PAA" -V 0xfff1 -o ./temp/paa_cert.pem -O ./temp/paa_key.pem
371+
chip-cert gen-att-cert -t a -l 3660 -c "Matter PAA" -V 0xfff1 -o ./temp/paa_cert.pem -O ./temp/paa_key.pem
372372
373-
./out/debug/chip-cert gen-att-cert -t i -l 3660 -c "Matter PAI" -V 0xfff1 -P 0x8005 -C ./temp/paa_cert.pem -K ./temp/paa_key.pem -o ./temp/pai_cert.pem -O ./temp/pai_key.pem
373+
chip-cert gen-att-cert -t i -l 3660 -c "Matter PAI" -V 0xfff1 -P 0x8005 -C ./temp/paa_cert.pem -K ./temp/paa_key.pem -o ./temp/pai_cert.pem -O ./temp/pai_key.pem
374374
375-
./out/debug/chip-cert gen-att-cert -t d -l 3660 -c "Matter DAC" -V 0xfff1 -P 0x8005 -C ./temp/pai_cert.pem -K ./temp/pai_key.pem -o ./temp/dac_cert.pem -O ./temp/dac_key.pem
375+
chip-cert gen-att-cert -t d -l 3660 -c "Matter DAC" -V 0xfff1 -P 0x8005 -C ./temp/pai_cert.pem -K ./temp/pai_key.pem -o ./temp/dac_cert.pem -O ./temp/dac_key.pem
376376
```
377377

378378
By default, `provision.py` uses the Matter Test PAA [Chip-Test-PAA-NoVID-Cert.der](../credentials/test/attestation/Chip-Test-PAA-NoVID-Cert.der) and
@@ -388,7 +388,7 @@ From the root of the Silicon Labs Matter repo, build an sample application. For
388388

389389
Set up the device with key generation:
390390
```
391-
python3 ./provision.py --channel 440144100 --vendor_id 0x1049 --product_id 0x8005 \
391+
python3 ./provision.py --vendor_id 0x1049 --product_id 0x8005 \
392392
--csr --common_name "Silabs Device" --certification ./samples/light/1/cd.bin --pai_cert ./samples/light/1/pai_cert.der \
393393
--dac_cert ./samples/light/1/dac_cert.der -dk ./samples/light/1/dac_key.der \
394394
--spake2p_passcode 62034001 --spake2p_salt 95834coRGvFhCB69IdmJyr5qYIzFgSirw6Ja7g5ySYA= --spake2p_iterations 15000 \
@@ -397,7 +397,7 @@ python3 ./provision.py --channel 440144100 --vendor_id 0x1049 --product_id 0x800
397397

398398
Or, set up the device with imported key:
399399
```
400-
python3 ./provision.py --channel 440144100 --vendor_id 0x1049 --product_id 0x8005 \
400+
python3 ./provision.py --vendor_id 0x1049 --product_id 0x8005 \
401401
--certification ./samples/light/1/cd.bin --pai_cert ./samples/light/1/pai_cert.der --dac_cert ./samples/light/1/dac_cert.der -dk ./samples/light/1/dac_key.der \
402402
--spake2p_passcode 62034001 --spake2p_salt 95834coRGvFhCB69IdmJyr5qYIzFgSirw6Ja7g5ySYA= --spake2p_iterations 15000 \
403403
--discriminator 0xf01 --prod_fw ../out/lighting-app/BRD4187C/matter-silabs-lighting-example.s37
@@ -571,6 +571,6 @@ must match the contents of `cd.der`, `pai_cert.der`, and `dac.der`, respectively
571571
572572
Pre-compiled images of the Generator Firmware can be found under ./images. The source
573573
code of these images is found under ./support. A single image is provided for all EFR32MG12
574-
parts, and another one for the EFR32MG24 family. To copy with the different flash sizes, the
574+
parts, and another one for the EFR32MG24 family. To cope with the different flash sizes, the
575575
`provision.py` script reads the device information using `commander`, and send it to the GFW,
576576
which configures the NVM3 during the initialization step.

0 commit comments

Comments
 (0)