esp-idf/components/hal/test_apps/security
2023-05-22 15:19:34 +05:30
..
main hal: add hmac peripheral verification tests 2023-05-22 15:19:34 +05:30
CMakeLists.txt hal: combine security peripherals test applications 2023-05-22 15:19:34 +05:30
pytest_security.py hal: combine security peripherals test applications 2023-05-22 15:19:34 +05:30
README.md hal: add hmac peripheral verification tests 2023-05-22 15:19:34 +05:30
sdkconfig.defaults hal: combine security peripherals test applications 2023-05-22 15:19:34 +05:30

Supported Targets ESP32 ESP32-C2 ESP32-C3 ESP32-C6 ESP32-H2 ESP32-S2 ESP32-S3

Security peripherals test

This is a combined security 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.

This contains tests for the following features of the security peripherals:

  • MPI peripheral

    • MPI Modular Multiplication
    • MPI Multiplication
    • MPI Modular Exponentiation
  • 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
  • HMAC periperhal

    • HMAC 'downstream' JTAG Enable mode
    • HMAC 'downstream' JTAG Disable
    • HMAC 'upstream' MAC generation with zeroes
    • HMAC 'upstream' MAC generation from data

NOTE: The verification tests for the HMAC peripherals would get exercised in only in an FPGA environment.

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.

espefuse.py -p $ESPPORT burn_key BLOCK_KEY3 hmac_key.bin HMAC_DOWN_JTAG

espefuse.py -p $ESPPORT burn_key BLOCK_KEY4 hmac_key.bin HMAC_UP

Building

idf.py set-target <TARGET>
idf.py build

Running the app manually

idf.py flash monitor

Enter the test that you want to run locally

Running tests

pytest --target <TARGET>