Cypress secure tools for Python
Project description
This package contains security tools for creating keys, creating certificates, signing user applications, and provisioning Cypress MCUs.
Table of Contents
- Prerequisites
- Documentation
- Installing package
- Supported devices
- Interface and Usage
- Logging
- Installing libusb driver
- Known issues
- License and Contributions
Prerequisites
- General
- Python 3.6 or later
- For PSoC 64 devices
- In case of use PyOCD:
- Installed the libusb driver
- Ensure the KitProg3 programming mode is DAPLink
- In case of use OpenOCD:
- Installed Cypress OpenOCD
- Ensure the KitProg3 programming mode is CMSIS-DAP Bulk
- Ensure the power selection jumper is set to provide 2.5 V to the power supply pin related to eFuse power. This voltage level is required to blow eFuses
- In case of use PyOCD:
- For CYW20829 devices
- Installed Cypress OpenOCD
- Ensure the KitProg3 programming mode is CMSIS-DAP Bulk
- Ensure the power selection jumper is set to provide 2.5 V to the power supply pin related to eFuse power. This voltage level is required to blow eFuses
Documentation
Installing Package
Invoke pip install
from the command line:
$ pip install cysecuretools
Supported devices
Use device-list
command for output of the supported devices list.
$ cysecuretools device-list
Interface and Usage
PSoC 64
See README_PSOC64.md
CYW20829
Logging
Every time the tool is invoked, a new log file is created in the logs directory of the project. By default, the console output has INFO logging severity. The log file contains the DEBUG logging severity.
When using pyOCD as a debugger, the log files contain messages sent by both tools - CySecureTools and pyOCD. When using OpenOCD, the log files contain messages from the package only. For the OpenOCD messages, the additional files are created (e.g. openocd_1.log).
Installing libusb driver
Windows
- Download and unzip libusb-1.0.25.7z from https://github.com/libusb/libusb/releases/tag/v1.0.25.
- Run the following command to determine if a Python shell is executing in 32-bit or 64-bit mode on the OS:
python -c "import struct; print(struct.calcsize('P') * 8)"
- Copy libusb-1.0.dll file into the Python root folder (in same folder with python.exe). Use the 64-bit version of DLL for the 64-bit Python (MinGW64 directory) and the 32-bit version of DLL for the 32-bit Python (MinGW32 directory).
- Ensure the Python path is located at the beginning of the Path environment variable.
Mac OS
- Use homebrew to install the driver from the terminal:
homebrew install libusb
.
Linux
- Bundled with the system, no need for additional installation.
Known issues
- Using the policy from version 4.0.0 in projects created by version 4.1.0 causes the CY_FB_INVALID_IMG_JWT_SIGNATURE error during re-provisioning on PSoC64-2M devices:
...
ERROR : SFB status: CY_FB_INVALID_IMG_JWT_SIGNATURE: Invalid image certificate signature. Check the log for details
Workaround:
- Open the policy file.
- Navigate to section 1 of the
boot_upgrade/firmware
. - Set
boot_auth
andbootloader_keys
as follows:
"boot_auth": [
3
],
"bootloader_keys": [
{
"kid": 3,
"key": "../keys/cy_pub_key.json"
}
]
- During the installation of the package via pip on Mac OS Big Sur, the following exception is raised:
...
distutils.errors.DistutilsError: Setup script exited with error: SandboxViolation:
mkdir('/private/var/root/Library/Caches/com.apple.python/private/tmp/easy_install-y8c1npmz', 511) {}
The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.
This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
Solution: Upgrade the pip
package running the following command from the terminal: python3 -m pip install --upgrade pip
.
License and Contributions
The software is provided under the Apache-2.0 license. Contributions to this project are accepted under the same license. This project contains code from other projects. The original license text is included in those source files.
Changelog
All notable changes to this project will be documented in this file.
4.1.0
Added
- OpenOCD support for PSoC 64 devices
- Creating update package in the unsigned image (extend-image command)
Changed
- Fixed installation failure using pip 22.1
- CyBootloader 2.0.2.8102 for PSoC 64 2M:
- Improved performance of SWAP algorithm
- Image certificate signed with the Infineon key (id=3)
- Use Infineon key (id=3) for bootloader in the policy files
4.0.0
Added
- Support of CYW20829 devices
- Support Python 3.10
- Signing images with HSM
Changed
- Separated PSoC 64 and CYW20829 devices CLI
- Updated PSoC 64 CyBootloader for 512k and 2M:
- added "reset_after_failure" feature
- decreased boot time
- Protect PSA API from NSPE in PSoC 64 2M-S0 policy
- Prevent signing of already signed images
- Change MCUboot image header padding to erase value
- Use CyBootloader from the project directory if the project exists
- Updated dependencies packages to the latest versions
- Use pyocd 0.32.3
3.1.1
Changed
- Fixed installation failure on macOS Big Sur and Apple M1 chip
- Fixed installation failure in Python 3.9
3.1.0
Added
- SCRATCH with Status Partition swap mode
- Small image slots support in the external memory
3.0.0
Added
- Image SWAP using Status Partition
Changed
- CyBootloader 2.0
- Secure Flash Boot 4.0.2 support
2.1.0
Added
- Support PSoC64 1M
- New command to read device die ID
- Optionally add boot record to the signed image
- New policy validators (address overlaps between images and bootloader, slots address alignment with the SMPU address limits, DAP closure, monotonic counter)
- Log the device response JWT during the provisioning process
Changed
- Fixed issue with using group private key
- Use pyocd 0.27.3
2.0.0
Added
- Support PSoC64 2M, PSoC64 512K
- Command line interface
- Encrypted programming
- Single-image and multi-image policy
Changed
- Update provisioning according to new Secure Flash Boot functionality (update system calls, reprovisioning, encrypted image support)
- New CyBootloaders (CY8CKIT-064B0S2-4343W, CY8CKIT-064S0S2-4343W, CY8CPROTO-064B0S3)
- Use pyocd 0.27.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cysecuretools-4.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dfad86a21b050b97f0b4108f5be179a1ba92193337c3d8fc6ef128411e98770 |
|
MD5 | f9da5bea9908afe65a1fbd42218f3d26 |
|
BLAKE2b-256 | c11c65cc13e9e1619de6b3d6327fbdb361535aa686519a3dc5b0a67ea08ef854 |