TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
attest_token_test.h File Reference

Entry points for attestation token tests. More...

#include <stdint.h>
Include dependency graph for attest_token_test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int_fast16_t minimal_test (void)
 Minimal token creation test using a short-circuit signature. More...
 
int_fast16_t minimal_get_size_test (void)
 Test token size calculation. More...
 
int_fast16_t buffer_too_small_test (void)
 Pass too small a buffer and confirm correct error result. More...
 
int_fast16_t decode_test_normal_sig (void)
 Test by checking signed values of claims. More...
 
int_fast16_t decode_test_short_circuit_sig (void)
 Test by checking short-circuit signed values of claims. More...
 

Detailed Description

Entry points for attestation token tests.

Errors codes are in the range of [-32767,32767] so int_fast16_t is used so they will work nice even on 16-bit machines. Plain old int could also be used, but many compilers make it 32-bits for backwards compatibility with SW that assume it is always 32 bits and it isn't efficient. (This code has probably not yet been tested on a 16-bit machines).

https://stackoverflow.com/questions/30942107/ whats-the-difference-between-int-and-int-fast16-t

Definition in file attest_token_test.h.

Function Documentation

int_fast16_t buffer_too_small_test ( void  )

Pass too small a buffer and confirm correct error result.

Returns
non-zero on failure.
int_fast16_t decode_test_normal_sig ( void  )

Test by checking signed values of claims.

Returns
non-zero on failure.

This is an extensive test that can compare the values in the token to expected valued compiled into the test app from token_test_values.h. All the values represented in attest_token_iat_simple_t and in attest_token_sw_component_t are checked.

This uses real ECDSA keys for both signing and verificaiton. It requires that the t_cose crypto porting layer operates correctly and that all keys are present. See also decode_test_short_circuit_sig().

Definition at line 1007 of file attest_token_test.c.

int_fast16_t decode_test_short_circuit_sig ( void  )

Test by checking short-circuit signed values of claims.

Returns
non-zero on failure.

This is an extensive test that can compare the values in the token to expected valued compiled into the test app from token_test_values.h. All the values represented in attest_token_iat_simple_t and in attest_token_sw_component_t are checked.

This uses a short-circuit signature rather than real ECDSA keys. This tests everything in the implementation except the final signing of the final hash with ECDSA and the converse verification. It is thorough test of everything by ECDSA integration. It can work even without ECDSA integration and without any keys configured.

Definition at line 998 of file attest_token_test.c.

int_fast16_t minimal_get_size_test ( void  )

Test token size calculation.

Returns
non-zero on failure.
int_fast16_t minimal_test ( void  )

Minimal token creation test using a short-circuit signature.

Returns
non-zero on failure.