example_test.py 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. from __future__ import print_function
  2. import ttfw_idf
  3. # To prepare a test runner for this example:
  4. # 1. Generate zero flash encryption key:
  5. # dd if=/dev/zero of=key.bin bs=1 count=32
  6. # 2.Burn Efuses:
  7. # espefuse.py --do-not-confirm -p $ESPPORT burn_efuse FLASH_CRYPT_CONFIG 0xf
  8. # espefuse.py --do-not-confirm -p $ESPPORT burn_efuse FLASH_CRYPT_CNT 0x1
  9. # espefuse.py --do-not-confirm -p $ESPPORT burn_key flash_encryption key.bin
  10. @ttfw_idf.idf_example_test(env_tag='Example_Flash_Encryption')
  11. def test_examples_security_flash_encryption(env, extra_data):
  12. dut = env.get_dut('flash_encryption', 'examples/security/flash_encryption', dut_class=ttfw_idf.ESP32DUT)
  13. # start test
  14. dut.start_app()
  15. lines = [
  16. 'FLASH_CRYPT_CNT eFuse value is 1',
  17. 'Flash encryption feature is enabled in DEVELOPMENT mode',
  18. 'with esp_partition_write',
  19. '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f',
  20. 'with esp_partition_read',
  21. '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f',
  22. 'with spi_flash_read',
  23. '29 68 2e 13 88 a0 5b 7f cc 6b 39 f9 d7 7b 32 2f'
  24. ]
  25. for line in lines:
  26. dut.expect(line, timeout=2)
  27. if __name__ == '__main__':
  28. test_examples_security_flash_encryption()