2023-08-16 22:45:23 -04:00
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
2023-05-11 02:50:27 -04:00
2023-05-11 08:34:48 -04:00
## Crypto peripherals test
2023-05-11 02:50:27 -04:00
2023-05-11 08:34:48 -04:00
This is a combined crypto peripherals verification application using mostly HAL APIs. This application is intentionally kept simple and does not use any higher layer constructs. This application can help in the early verification of the new SoC.
2023-05-11 02:50:27 -04:00
2023-05-11 08:34:48 -04:00
This contains tests for the following features of the crypto peripherals:
2023-05-11 02:50:27 -04:00
- MPI peripheral
- MPI Modular Multiplication
- MPI Multiplication
- MPI Modular Exponentiation
2023-05-11 05:58:02 -04:00
- ECC peripheral
- ECC Point multiplication for P192 and P256 curve
- ECC Point verification for P192 and P256 curve
- ECC Point verify and multiply for P192 and P256 curve
- ECC Inverse multiplication for P192 and P256
If the hardware supports extended work modes then it also tests:
- ECC Jacobian multiplication for P192 and P256 curve
- ECC Jacobian verification for P192 and P256 curve
- ECC Point verification and Jacobian multiplication for P192 and P256 curve
- ECC Point addition for P192 and P256 curve
- Mod addition
- Mod subtraction
- Mod multiplication
2023-05-11 07:01:00 -04:00
- HMAC periperhal
- HMAC 'downstream' JTAG Enable mode
- HMAC 'downstream' JTAG Disable
- HMAC 'upstream' MAC generation with zeroes
- HMAC 'upstream' MAC generation from data
2023-05-11 08:34:48 -04:00
- DS peripheral
- Digital Signature Parameter Encryption
- Digital Signature wrong HMAC key purpose
- Digital Signature Blocking wrong HMAC key purpose
- Digital Signature Operation
- Digital Signature Blocking Operation
- Digital Signature Invalid Data
2023-05-11 07:01:00 -04:00
2023-05-15 02:50:03 -04:00
- ECDSA peripheral
- ECDSA P192 signature generation
- ECDSA P256 signature generation
- ECDSA P192 signature verification
- ECDSA P256 signature verification
2023-08-28 06:14:47 -04:00
- AES peripheral
- Block Mode
- CBC AES-256
- CTR AES-256
- SHA peripheral
- Block Mode
- SHA-1
- SHA-224
- SHA-256
- SHA-384
- SHA-512
- SHA-512/224
- SHA-512/256
- SHA-512/t
2023-05-11 08:34:48 -04:00
> **_NOTE:_** The verification tests for the HMAC and Digital Signature peripherals would get exercised in only in an FPGA environment.
2023-05-11 07:01:00 -04:00
# Burning the HMAC key
The HMAC tests need an HMAC key to be burned in the `BLOCK_KEY3` and `BLOCK_KEY4` of the efuses. As this verification application is independent of the efuse component, the user needs to manually burn the keys and their key purposes using `espefuse.py` .
```bash
2023-05-26 08:45:48 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY3 main/hmac/hmac_key.bin HMAC_DOWN_JTAG
2023-05-11 07:01:00 -04:00
2023-05-26 08:45:48 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY4 main/hmac/hmac_key.bin HMAC_UP
2023-05-11 07:01:00 -04:00
```
2023-05-11 08:34:48 -04:00
# Burning the HMAC keys for Digital Signature tests
2023-08-28 07:21:36 -04:00
The tests needs some HMAC keys to be burned in the `BLOCK_KEY0` , `BLOCK_KEY1` and `BLOCK_KEY2` of the efuses. As this verification application is independent of the efuse component, the user needs to manually burn the keys and their key purposes using `espefuse.py` .
2023-05-11 08:34:48 -04:00
2023-08-02 04:40:24 -04:00
If SOC_DS_SIGNATURE_MAX_BIT_LEN == 3072:
2023-05-11 08:34:48 -04:00
```bash
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY0 main/ds/keys/3072/ds_key1.bin HMAC_DOWN_DIGITAL_SIGNATURE
2023-05-11 08:34:48 -04:00
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY1 main/ds/keys/3072/ds_key2.bin HMAC_DOWN_DIGITAL_SIGNATURE
2023-05-11 08:34:48 -04:00
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY2 main/ds/keys/3072/ds_key3.bin HMAC_DOWN_DIGITAL_SIGNATURE
2023-08-02 04:40:24 -04:00
```
If SOC_DS_SIGNATURE_MAX_BIT_LEN == 4096:
```bash
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY0 main/ds/keys/4096/ds_key1.bin HMAC_DOWN_DIGITAL_SIGNATURE
2023-08-02 04:40:24 -04:00
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY1 main/ds/keys/4096/ds_key2.bin HMAC_DOWN_DIGITAL_SIGNATURE
2023-08-02 04:40:24 -04:00
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY2 main/ds/keys/4096/ds_key3.bin HMAC_DOWN_DIGITAL_SIGNATURE
2023-05-11 08:34:48 -04:00
```
2023-05-15 02:50:03 -04:00
# Burning the ECDSA keys
2023-08-28 07:21:36 -04:00
By default, ECDSA tests are disabled. You can enable it after disabling HMAC tests using `idf.py menuconfig -> Test App Configuration -> Enable ECDSA Peripheral test cases`
The ECDSA tests need some ECDSA keys to be burned in the `BLOCK_KEY4` and `BLOCK_KEY5` of the efuses. As this verification application is independent of the efuse component, the user needs to manually burn the keys and their key purposes using `espefuse.py` .
2023-05-15 02:50:03 -04:00
```bash
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY4 main/ecdsa/ecdsa192_priv_key.pem ECDSA_KEY
2023-05-15 02:50:03 -04:00
2023-08-28 07:21:36 -04:00
espefuse.py -p $ESPPORT burn_key BLOCK_KEY5 main/ecdsa/ecdsa256_priv_key.pem ECDSA_KEY
2023-05-15 02:50:03 -04:00
```
2023-05-11 02:50:27 -04:00
# Building
```bash
idf.py set-target < TARGET >
idf.py build
```
# Running the app manually
```bash
idf.py flash monitor
```
Enter the test that you want to run locally
# Running tests
```bash
pytest --target < TARGET >
```