Skip to content

Commit 515555e

Browse files
committed
Removed scripts for provisiongs from repository, made fixes per PR comments, adjusted Readme.md
1 parent 44401b5 commit 515555e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+121
-10860
lines changed

LICENSE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,3 @@ The Python modules used by Mbed tools are used under the following licenses:
5656
- [psutil](https://pypi.org/project/psutil/) - BSD
5757
- [click](https://pypi.org/project/click/) - BSD-3-Clause
5858
- [cryptography](https://pypi.org/project/cryptography/) - BSD, Apache-2.0
59-
- [jwcrypto](https://pypi.org/project/jwcrypto/) - LGPLv3+

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ wmi==1.4.9;platform_system=='Windows'
2828
psutil==5.6.2
2929
cryptography>=2.4.x,<2.5
3030
Click>=7.0,<7.1
31-
jwcrypto>=0.6,<0.7
3231
pathlib>=1.0.1

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CPROTO_064_SB/secure_image_parameters.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"priv_key_file": "keys/USERAPP_CM4_KEY_PRIV.pem",
1414
"aes_key_file": "keys/image-aes-128.key",
1515
"dev_pub_key_file": "keys/dev_pub_key.pem",
16-
"policy_file": "prepare/policy_single_stage_CM4.json"
16+
"policy_file": "policy/policy_single_stage_CM4.json"
1717
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
packet
1+
packet
Lines changed: 6 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,9 @@
11
#### Version of Python required is 3.7+
22

3-
This directory contains tools and scripts for generating keys, preparing provisioning packets and execution of provisioning.
4-
These files are relevant to CY8CPROTO_064_SB or CY8CPROTO_064_SB_M0_PSA, CY8CPROTO_064_SB_PSA targets.
3+
This directory contains scripts for adding signatures .
4+
These files are relevant to CY8CPROTO_064_SB target.
55

6-
**_NOTE_:** Detailed description about Secure Boot tools availabe on this link https://www.cypress.com/secureboot-sdk-user-guide
7-
8-
# DEVICE PROVISIONING
9-
10-
## 1. Generate new keys by executing the following commands from ./keys:
11-
12-
*Create keys for image signing:*
13-
14-
python keygen.py -k 8 --jwk USERAPP_CM4_KEY.json --pem-priv USERAPP_CM4_KEY_PRIV.pem
15-
16-
*Create key for image encryption:*
17-
18-
python keygen.py --aes aes.key
19-
20-
21-
**_NOTE_:** DO NOT COMMIT any new keys to repository.
22-
23-
## 2. Create provisioning packets:
24-
Use *provisioning_packet.py* from ./prepare folder.
25-
26-
Options:
27-
28-
--oem <filename> OEM key file.
29-
--hsm <filename> HSM key file.
30-
--cyboot <filename> Cypress Bootloader image certificate.
31-
--cyauth <filename> Provisioning authorization certificate.
32-
--policy <filename> Policy file.
33-
--out <directory_path> Output directory.
34-
--ckey <filename> Customer key that will be used for image signing. Use the option multiple times to specify multiple keys.
35-
--devcert <filename> Chain of trust certificate. Use the option multiple times to specify multiple certificates.
36-
37-
* To create packet for CY8CPROTO_064_SB target using single-stage policy (CM4 only):
38-
39-
python provisioning_packet.py --policy policy_single_stage_CM4.json --out ../packet --cyboot ../prebuild/CyBootloader_Release/CypressBootloader_CM0p.jwt --ckey ../keys/USERAPP_CM4_KEY.json --devcert example_cert.pem
40-
41-
* To use external memory (via SMIF) as staging(upgrade) area (slot_1) of NSPE (CM4) image use policy file with corresponding name:
42-
43-
python provisioning_packet.py --policy policy_single_stage_CM4_smif.json --out ../packet --cyboot ../prebuild/CyBootloader_Release/CypressBootloader_CM0p.jwt --ckey ../keys/USERAPP_CM4_KEY.json --devcert example_cert.pem
44-
45-
The certificate in above examples is signed with OEM key from ./prebuild folder.
46-
47-
Prebuild folder contains CyBootloader_WithLogs and CyBootloader_Release with corresponding *.hex and *.jwt files.
48-
* WithLogs prints execution results to terminal.
49-
* Release does not print to terminal and boots up silently.
50-
51-
**_NOTE:_** CypressBootloader_CM0p.jwt and CypressBootloader_CM0p.hex must be used in pair from the same directory in provisioning packet generation (.packets/prov_cmd.jwt) and provisioning procedure itself.
52-
53-
## 3. Run entrance exam
54-
55-
python entrance_exam_runner.py
56-
57-
## 4. Perform provisioning:
58-
**_ATTENTION:_** Proceed to **UPGRADE IMAGES** section first if UPGRADE image is needed.
59-
60-
Execute *provision_device_runner.py*.
61-
The script will run with the default arguments if no arguments specified.
62-
63-
Default arguments can be overridden with a custom:
64-
65-
--prov-jwt <filename> Path to provisioning JWT file (packet which contains all data necessary for provisioning, including policy, authorization packets and keys)
66-
--hex <filename> Path to Cypress Bootloader HEX binary file
67-
--pubkey-json <filename> File where to save public key in JSON format
68-
--pubkey-pem <filename> File where to save public key in PEM format
69-
70-
*Example:*
71-
72-
python provision_device_runner.py --prov-jwt packet/prov_cmd.jwt --hex prebuild/CyBootloader_Release/CypressBootloader_CM0p.hex --pubkey-json keys/dev_pub_key.json --pubkey-pem keys/dev_pub_key.pem
73-
74-
**_NOTE:_** PSoC6 supply voltage of 2.5V is required to perform provisioning.
6+
**_NOTE_:** Before starting work with Cypress Secure Boot enabled target please read User Guide https://www.cypress.com/secureboot-sdk-user-guide
757

768
## UPGRADE IMAGES
779

@@ -87,9 +19,9 @@ The upgrade images types are determined by the following policy setting (firmwar
8719
- **_"encrypt_key_id":_** 1, - should remain unchanged, means that Device Key will be used in ECDH/HKDF protocol
8820

8921
Requirements:
90-
- Policy with **_smif.json** from prepare/ folder should be used.
22+
- Policy with **_smif.json** from policy/ folder should be used.
9123
For encrypted image:
92-
- aes.key generated, as described in **DEVICE_PROVISIONING - 1**
24+
- aes.key generated, as described in user guide
9325
- dev_pub_key.pem must be placed in keys/ folder (this key is generated in provisioning procedure)
9426
- secure_image_parameters.json file in the target directory must contain valid keys' paths
9527

@@ -110,7 +42,7 @@ Encrypted UPGRADE image:
11042
"encrypt": true,
11143
"encrypt_key_id": 1,
11244

113-
Modified policy file should be used for provisioning the device, as described in paragraph 4.
45+
Modified policy file should be used for provisioning the device, as described in User Guide.
11446

11547
Now mbed-os application or test can be built as described in section **TESTS**. Images for UPGRADE are generated at build time, according to policy.
11648

@@ -140,11 +72,3 @@ The generic HEX file (for example one that is produced by mbed-os build system)
14072

14173
Run commands:
14274
mbed test --compile -m CY8CPROTO_064_SB -t GCC_ARM -n tests-mbed* -v
143-
144-
# TROUBLESHOOTING:
145-
146-
1. In case of messages like "unable to find device" execute "mbedls -m 1907:CY8CPROTO_064_SB", then check with "mbedls" if device is detected as CY8CPROTO_064_SB with code 1907.
147-
2. Keys, from ./keys folder is used for signing images by default, these keys should be used for provisioning.
148-
3. Consider using CyBootloader from CyBootloader_WithLogs folder. It produces logs, which are useful to understand whether CyBootloader works correctly.
149-
4. When running application with SMIF and _smif.json policy the field "smif_id" should be set to 1 for CY8CPROTO_064_SB.
150-
5. Low frequency quartz (32768 Hz) oscillator have to be soldered on CY8CPROTO_064_SB (not present in stock version of board).

targets/TARGET_Cypress/TARGET_PSOC6/sb-tools/entrance_exam_runner.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

targets/TARGET_Cypress/TARGET_PSOC6/sb-tools/execute/entrance_exam.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

targets/TARGET_Cypress/TARGET_PSOC6/sb-tools/execute/enums.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

targets/TARGET_Cypress/TARGET_PSOC6/sb-tools/execute/gen_data_from_json.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

targets/TARGET_Cypress/TARGET_PSOC6/sb-tools/execute/helper.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)