Overview
========
The Trusted Firmware M (TF-M) regression test application provides testing of the TF-M core and its RoT services:
 - Secure Storage Service
 - Attestation Service
 - Crypto Service
 - TF-M Audit Log Service
 - Platform Service

Toolchain supported
===================
- GCC ARM Embedded  10.2.1
- Keil MDK  5.34
- IAR embedded Workbench  9.20.1
- MCUXpresso  11.4.1

Hardware requirements
=====================
- Mini/micro USB cable
- LPCXpresso55S36 board
- Personal Computer

Board settings
==============
No special settings are required.

Prepare the Demo
================
1.  Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J1) on the board
2.  Open a serial terminal with the following settings (See Appendix A in Getting started guide for description how to determine serial port number):
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control
3.  Use secure project to download the program to target board
    For IAR environment go to project options/Debugger/Images. Open file dialog for first extra image. Select file <application_name>_ns.out and click on open button. 
    Now you have absolute path in the path box. The flash loader requires absolute path to this file.
4.  Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo
================
The log below shows the output of the TFM regression tests in the terminal window:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Sec Thread] Secure image initializing!
Booting TFM v1.3.0
Non-Secure system starting...

#### Execute test suites for the Non-secure area ####
Running Test Suite PSA protected storage NS interface tests (TFM_PS_TEST_1XXX)...
> Executing 'TFM_PS_TEST_1001'
  Description: 'Set interface'
  TEST: TFM_PS_TEST_1001 - PASSED!
> Executing 'TFM_PS_TEST_1002'
  Description: 'Set interface with create flags'
  TEST: TFM_PS_TEST_1002 - PASSED!
> Executing 'TFM_PS_TEST_1003'
  Description: 'Set interface with NULL data pointer'
  TEST: TFM_PS_TEST_1003 - PASSED!
> Executing 'TFM_PS_TEST_1004'
  Description: 'Set interface with write once UID'
  TEST: TFM_PS_TEST_1004 - PASSED!
> Executing 'TFM_PS_TEST_1005'
  Description: 'Get interface with valid data'
  TEST: TFM_PS_TEST_1005 - PASSED!
> Executing 'TFM_PS_TEST_1006'
  Description: 'Get interface with zero data length'
  TEST: TFM_PS_TEST_1006 - PASSED!
> Executing 'TFM_PS_TEST_1007'
  Description: 'Get interface with invalid UIDs'
  TEST: TFM_PS_TEST_1007 - PASSED!
> Executing 'TFM_PS_TEST_1008'
  Description: 'Get interface with invalid data lengths and offsets'
  TEST: TFM_PS_TEST_1008 - PASSED!
> Executing 'TFM_PS_TEST_1009'
  Description: 'Get interface with NULL data pointer'
  TEST: TFM_PS_TEST_1009 - PASSED!
> Executing 'TFM_PS_TEST_1010'
  Description: 'Get info interface with write once UID'
  TEST: TFM_PS_TEST_1010 - PASSED!
> Executing 'TFM_PS_TEST_1011'
  Description: 'Get info interface with valid UID'
  TEST: TFM_PS_TEST_1011 - PASSED!
> Executing 'TFM_PS_TEST_1012'
  Description: 'Get info interface with invalid UIDs'
  TEST: TFM_PS_TEST_1012 - PASSED!
> Executing 'TFM_PS_TEST_1013'
  Description: 'Remove interface with valid UID'
  TEST: TFM_PS_TEST_1013 - PASSED!
> Executing 'TFM_PS_TEST_1014'
  Description: 'Remove interface with write once UID'
  TEST: TFM_PS_TEST_1014 - PASSED!
> Executing 'TFM_PS_TEST_1015'
  Description: 'Remove interface with invalid UID'
  TEST: TFM_PS_TEST_1015 - PASSED!
> Executing 'TFM_PS_TEST_1021'
  Description: 'Block compaction after remove'
  TEST: TFM_PS_TEST_1021 - PASSED!
> Executing 'TFM_PS_TEST_1022'
  Description: 'Multiple partial gets'
  TEST: TFM_PS_TEST_1022 - PASSED!
> Executing 'TFM_PS_TEST_1023'
  Description: 'Multiple sets to same UID from same thread'
  TEST: TFM_PS_TEST_1023 - PASSED!
> Executing 'TFM_PS_TEST_1024'
  Description: 'Get support interface'
  TEST: TFM_PS_TEST_1024 - PASSED!
> Executing 'TFM_PS_TEST_1025'
  Description: 'Set, get and remove interface with different asset sizes'
  TEST: TFM_PS_TEST_1025 - PASSED!
TESTSUITE PASSED!
Running Test Suite PSA internal trusted storage NS interface tests (TFM_ITS_TEST_1XXX)...
> Executing 'TFM_ITS_TEST_1001'
  Description: 'Set interface'
  TEST: TFM_ITS_TEST_1001 - PASSED!
> Executing 'TFM_ITS_TEST_1002'
  Description: 'Set interface with create flags'
  TEST: TFM_ITS_TEST_1002 - PASSED!
> Executing 'TFM_ITS_TEST_1003'
  Description: 'Set interface with NULL data pointer'
  TEST: TFM_ITS_TEST_1003 - PASSED!
> Executing 'TFM_ITS_TEST_1004'
  Description: 'Set interface with write once UID'
  TEST: TFM_ITS_TEST_1004 - PASSED!
> Executing 'TFM_ITS_TEST_1005'
  Description: 'Get interface with valid data'
  TEST: TFM_ITS_TEST_1005 - PASSED!
> Executing 'TFM_ITS_TEST_1006'
  Description: 'Get interface with zero data length'
  TEST: TFM_ITS_TEST_1006 - PASSED!
> Executing 'TFM_ITS_TEST_1007'
  Description: 'Get interface with invalid UIDs'
  TEST: TFM_ITS_TEST_1007 - PASSED!
> Executing 'TFM_ITS_TEST_1008'
  Description: 'Get interface with invalid data lengths and offsets'
  TEST: TFM_ITS_TEST_1008 - PASSED!
> Executing 'TFM_ITS_TEST_1009'
  Description: 'Get interface with NULL data pointer'
  TEST: TFM_ITS_TEST_1009 - PASSED!
> Executing 'TFM_ITS_TEST_1010'
  Description: 'Get info interface with write once UID'
  TEST: TFM_ITS_TEST_1010 - PASSED!
> Executing 'TFM_ITS_TEST_1011'
  Description: 'Get info interface with valid UID'
  TEST: TFM_ITS_TEST_1011 - PASSED!
> Executing 'TFM_ITS_TEST_1012'
  Description: 'Get info interface with invalid UIDs'
  TEST: TFM_ITS_TEST_1012 - PASSED!
> Executing 'TFM_ITS_TEST_1013'
  Description: 'Remove interface with valid UID'
  TEST: TFM_ITS_TEST_1013 - PASSED!
> Executing 'TFM_ITS_TEST_1014'
  Description: 'Remove interface with write once UID'
  TEST: TFM_ITS_TEST_1014 - PASSED!
> Executing 'TFM_ITS_TEST_1015'
  Description: 'Remove interface with invalid UID'
  TEST: TFM_ITS_TEST_1015 - PASSED!
> Executing 'TFM_ITS_TEST_1016'
  Description: 'Block compaction after remove'
  TEST: TFM_ITS_TEST_1016 - PASSED!
> Executing 'TFM_ITS_TEST_1017'
  Description: 'Multiple partial gets'
  TEST: TFM_ITS_TEST_1017 - PASSED!
> Executing 'TFM_ITS_TEST_1018'
  Description: 'Multiple sets to same UID from same thread'
  TEST: TFM_ITS_TEST_1018 - PASSED!
> Executing 'TFM_ITS_TEST_1019'
  Description: 'Set, get and remove interface with different asset sizes'
  TEST: TFM_ITS_TEST_1019 - PASSED!
TESTSUITE PASSED!
Running Test Suite Crypto non-secure interface test (TFM_CRYPTO_TEST_6XXX)...
> Executing 'TFM_CRYPTO_TEST_6001'
  Description: 'Non Secure Key management interface'
  TEST: TFM_CRYPTO_TEST_6001 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6002'
  Description: 'Non Secure Symmetric encryption (AES-128-CBC) interface'
  TEST: TFM_CRYPTO_TEST_6002 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6003'
  Description: 'Non Secure Symmetric encryption (AES-128-CFB) interface'
  TEST: TFM_CRYPTO_TEST_6003 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6005'
  Description: 'Non Secure Symmetric encryption (AES-128-CTR) interface'
  TEST: TFM_CRYPTO_TEST_6005 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6007'
  Description: 'Non Secure Symmetric encryption invalid cipher'
  TEST: TFM_CRYPTO_TEST_6007 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6008'
  Description: 'Non Secure Symmetric encryption invalid cipher (AES-152)'
  TEST: TFM_CRYPTO_TEST_6008 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6009'
  Description: 'Non Secure Symmetric encryption invalid cipher (HMAC-128-CFB)'
  TEST: TFM_CRYPTO_TEST_6009 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6010'
  Description: 'Non Secure Unsupported Hash (SHA-1) interface'
  TEST: TFM_CRYPTO_TEST_6010 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6012'
  Description: 'Non Secure Hash (SHA-256) interface'
  TEST: TFM_CRYPTO_TEST_6012 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6013'
  Description: 'Non Secure Hash (SHA-384) interface'
  TEST: TFM_CRYPTO_TEST_6013 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6014'
  Description: 'Non Secure Hash (SHA-512) interface'
  TEST: TFM_CRYPTO_TEST_6014 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6019'
  Description: 'Non Secure Unsupported HMAC (SHA-1) interface'
  TEST: TFM_CRYPTO_TEST_6019 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6020'
  Description: 'Non Secure HMAC (SHA-256) interface'
  TEST: TFM_CRYPTO_TEST_6020 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6021'
  Description: 'Non Secure HMAC (SHA-384) interface'
  TEST: TFM_CRYPTO_TEST_6021 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6022'
  Description: 'Non Secure HMAC (SHA-512) interface'
  TEST: TFM_CRYPTO_TEST_6022 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6030'
  Description: 'Non Secure AEAD (AES-128-CCM) interface'
  TEST: TFM_CRYPTO_TEST_6030 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6031'
  Description: 'Non Secure AEAD (AES-128-GCM) interface'
  TEST: TFM_CRYPTO_TEST_6031 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6032'
  Description: 'Non Secure key policy interface'
  TEST: TFM_CRYPTO_TEST_6032 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6033'
  Description: 'Non Secure key policy check permissions'
  TEST: TFM_CRYPTO_TEST_6033 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6034'
  Description: 'Non Secure persistent key interface'
  TEST: TFM_CRYPTO_TEST_6034 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6035'
  Description: 'Non Secure AEAD interface with truncated auth tag (AES-128-CCM-8)'
  TEST: TFM_CRYPTO_TEST_6035 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6036'
  Description: 'Non Secure TLS 1.2 PRF key derivation'
  TEST: TFM_CRYPTO_TEST_6036 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6037'
  Description: 'Non Secure TLS-1.2 PSK-to-MasterSecret key derivation'
  TEST: TFM_CRYPTO_TEST_6037 - PASSED!
> Executing 'TFM_CRYPTO_TEST_6038'
  Description: 'Non Secure HKDF key derivation'
  TEST: TFM_CRYPTO_TEST_6038 - PASSED!
TESTSUITE PASSED!
Running Test Suite Initial Attestation Service non-secure interface tests(TFM_ATTEST_TEST_2XXX)...
> Executing 'TFM_ATTEST_TEST_2004'
  Description: 'ECDSA signature test of attest token'
  TEST: TFM_ATTEST_TEST_2004 - PASSED!
> Executing 'TFM_ATTEST_TEST_2005'
  Description: 'Negative test cases for initial attestation service'
  TEST: TFM_ATTEST_TEST_2005 - PASSED!
TESTSUITE PASSED!

*** Non-secure test suites summary ***
Test suite 'PSA protected storage NS interface tests (TFM_PS_TEST_1XXX)' has  PASSED
Test suite 'PSA internal trusted storage NS interface tests (TFM_ITS_TEST_1XXX)' has  PASSED
Test suite 'Crypto non-secure interface test (TFM_CRYPTO_TEST_6XXX)' has  PASSED
Test suite 'Initial Attestation Service non-secure interface tests(TFM_ATTEST_TEST_2XXX)' has  PASSED

*** End of Non-secure test suites ***
                             
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

