add main functions to each compliance test

add main function to each compliance test , moving shared code to a common file
pull/10067/head
Nir Sonnenschein 2019-03-03 22:50:59 +02:00 committed by Cruz Monrreal II
parent 7a80553c91
commit 4a474cefcf
55 changed files with 612 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_a001(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_a001);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c001(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c001);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c002(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c002);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c003(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c003);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c004(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c004);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c005(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c005);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c006(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c006);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c007(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c007);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c008(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c008);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c009(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c009);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c010(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c010);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c011(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c011);
}

View File

@ -0,0 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "unity/unity.h"
void test_entry_c012(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c012);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c013(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c013);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c014(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c014);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c015(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c015);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c016(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c016);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c017(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c017);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c018(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c018);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c019(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c019);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c020(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c020);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c021(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c021);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c022(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c022);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c023(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c023);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c024(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c024);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c025(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c025);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c026(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c026);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c027(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c027);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c028(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c028);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c029(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c029);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c030(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c030);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c031(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c031);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c032(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c032);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c033(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c033);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c034(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c034);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c035(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c035);
}

View File

@ -0,0 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "unity/unity.h"
void test_entry_c036(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c036);
}

View File

@ -0,0 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "unity/unity.h"
void test_entry_c037(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c037);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c038(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c038);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c039(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c039);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c040(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c040);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c041(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c041);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c042(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c042);
}

View File

@ -0,0 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
void test_entry_c043(val_api_t *val_api, psa_api_t *psa_api);
int main(void)
{
test_start(test_entry_c043);
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s001(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p001(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s001);
#elif PS_TEST
test_start(test_entry_p001);
#endif
}

View File

@ -0,0 +1,18 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "lifecycle.h"
#ifdef ITS_TEST
void test_entry_s002(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p002(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s002);
#elif PS_TEST
test_start(test_entry_p002);
#endif
}

View File

@ -0,0 +1,20 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "lifecycle.h"
#ifdef ITS_TEST
void test_entry_s003(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
#error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout.
void test_entry_p003(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s003);
#elif PS_TEST
test_start(test_entry_p003);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s004(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p004(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s004);
#elif PS_TEST
test_start(test_entry_p004);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s005(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p005(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s005);
#elif PS_TEST
test_start(test_entry_p005);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s006(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p006(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s006);
#elif PS_TEST
test_start(test_entry_p006);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s007(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p007(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s007);
#elif PS_TEST
test_start(test_entry_p007);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s008(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p008(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s008);
#elif PS_TEST
test_start(test_entry_p008);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s009(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p009(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s009);
#elif PS_TEST
test_start(test_entry_p009);
#endif
}

View File

@ -0,0 +1,17 @@
#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#ifdef ITS_TEST
void test_entry_s010(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
void test_entry_p010(val_api_t *val_api, psa_api_t *psa_api);
#endif
int main(void)
{
#ifdef ITS_TEST
test_start(test_entry_s010);
#elif PS_TEST
test_start(test_entry_p010);
#endif
}

View File

@ -6,6 +6,8 @@
#include "psa/crypto.h"
#include "entropy_poll.h"
#include "psa_attest_inject_key.h"
#include "pal_mbed_os_crypto.h"
#include "lifecycle.h"
@ -19,6 +21,42 @@ extern "C" psa_status_t psa_ps_reset();
test_entry_f test_g = NULL;
static void psa_attestation_inject_key_for_test(void)
{
#ifndef PSA_ATTESTATION_DISABLED
const uint8_t private_key_data[] = {
0x49, 0xc9, 0xa8, 0xc1, 0x8c, 0x4b, 0x88, 0x56,
0x38, 0xc4, 0x31, 0xcf, 0x1d, 0xf1, 0xc9, 0x94,
0x13, 0x16, 0x09, 0xb5, 0x80, 0xd4, 0xfd, 0x43,
0xa0, 0xca, 0xb1, 0x7d, 0xb2, 0xf1, 0x3e, 0xee
};
const uint8_t public_key_data[] = {
0x04, 0x77, 0x72, 0x65, 0x6f, 0x81, 0x4b, 0x39,
0x92, 0x79, 0xd5, 0xe1, 0xf1, 0x78, 0x1f, 0xac,
0x6f, 0x09, 0x9a, 0x3c, 0x5c, 0xa1, 0xb0, 0xe3,
0x53, 0x51, 0x83, 0x4b, 0x08, 0xb6, 0x5e, 0x0b,
0x57, 0x25, 0x90, 0xcd, 0xaf, 0x8f, 0x76, 0x93,
0x61, 0xbc, 0xf3, 0x4a, 0xcf, 0xc1, 0x1e, 0x5e,
0x07, 0x4e, 0x84, 0x26, 0xbd, 0xde, 0x04, 0xbe,
0x6e, 0x65, 0x39, 0x45, 0x44, 0x96, 0x17, 0xde,
0x45
};
psa_status_t status = PSA_SUCCESS;
size_t exported_length;
uint8_t exported[sizeof(public_key_data)];
psa_crypto_init();
psa_attestation_inject_key(private_key_data,
sizeof(private_key_data),
PSA_KEY_TYPE_ECC_KEYPAIR(PSA_ECC_CURVE_SECP256R1),
exported,
sizeof(exported),
&exported_length);
#endif
}
#if defined(MBEDTLS_ENTROPY_NV_SEED) || defined(COMPONENT_PSA_SRV_IPC)
#if !defined(MAX)
@ -50,6 +88,7 @@ void main_wrapper(void)
#if defined(MBEDTLS_ENTROPY_NV_SEED) || defined(COMPONENT_PSA_SRV_IPC)
inject_entropy();
#endif /* defined(MBEDTLS_ENTROPY_NV_SEED) || defined(COMPONENT_PSA_SRV_IPC) */
psa_attestation_inject_key_for_test(); // inject key incase needed
test_g(&val_api, &psa_api);
#ifdef ITS_TEST