test_suite_block_cipher: add new data file for PSA/legacy dispatch test

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-12-12 15:34:25 +01:00
parent 10e9aa26c5
commit 1cf81c3c80
2 changed files with 73 additions and 0 deletions

View file

@ -92,3 +92,37 @@ exit:
mbedtls_block_cipher_free(&ctx);
}
/* END_CASE */
/* BEGIN_CASE */
void block_cipher_psa_dynamic_dispatch(int cipher_type, int pre_psa_ret, int post_psa_engine)
{
mbedtls_block_cipher_context_t ctx;
/* Intentionally no PSA init here! (Will be done later.) */
mbedtls_block_cipher_init(&ctx);
/* Before PSA crypto init */
TEST_EQUAL(pre_psa_ret, mbedtls_block_cipher_setup(&ctx, cipher_type));
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
TEST_EQUAL(ctx.engine, MBEDTLS_BLOCK_CIPHER_ENGINE_LEGACY);
#endif
mbedtls_block_cipher_free(&ctx);
/* Now initilize PSA Crypto */
BLOCK_CIPHER_PSA_INIT();
mbedtls_block_cipher_init(&ctx);
/* After PSA Crypto init */
TEST_EQUAL(0, mbedtls_block_cipher_setup(&ctx, cipher_type));
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
TEST_EQUAL(ctx.engine, post_psa_engine);
#endif
exit:
mbedtls_block_cipher_free(&ctx);
BLOCK_CIPHER_PSA_DONE();
}
/* END_CASE */

View file

@ -0,0 +1,39 @@
# These tests behave differently depending on the presence of
# drivers and/or built-in, so they're isolated here for the benefit of
# analyze_outcomes.py (driver vs reference comparison).
AES - legacy only
depends_on:MBEDTLS_BLOCK_CIPHER_AES_VIA_LEGACY:!MBEDTLS_BLOCK_CIPHER_AES_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_AES:0:MBEDTLS_BLOCK_CIPHER_ENGINE_LEGACY
AES - driver only
depends_on:!MBEDTLS_BLOCK_CIPHER_AES_VIA_LEGACY:MBEDTLS_BLOCK_CIPHER_AES_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_AES:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA:MBEDTLS_BLOCK_CIPHER_ENGINE_PSA
AES - legacy + driver
depends_on:MBEDTLS_BLOCK_CIPHER_AES_VIA_LEGACY:MBEDTLS_BLOCK_CIPHER_AES_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_AES:0:MBEDTLS_BLOCK_CIPHER_ENGINE_PSA
ARIA - legacy only
depends_on:MBEDTLS_BLOCK_CIPHER_ARIA_VIA_LEGACY:!MBEDTLS_BLOCK_CIPHER_ARIA_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_ARIA:0:MBEDTLS_BLOCK_CIPHER_ENGINE_LEGACY
ARIA - driver only
depends_on:!MBEDTLS_BLOCK_CIPHER_ARIA_VIA_LEGACY:MBEDTLS_BLOCK_CIPHER_ARIA_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_ARIA:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA:MBEDTLS_BLOCK_CIPHER_ENGINE_PSA
ARIA - legacy + driver
depends_on:MBEDTLS_BLOCK_CIPHER_ARIA_VIA_LEGACY:MBEDTLS_BLOCK_CIPHER_ARIA_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_ARIA:0:MBEDTLS_BLOCK_CIPHER_ENGINE_PSA
Camellia - legacy only
depends_on:MBEDTLS_BLOCK_CIPHER_CAMELLIA_VIA_LEGACY:!MBEDTLS_BLOCK_CIPHER_CAMELLIA_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_CAMELLIA:0:MBEDTLS_BLOCK_CIPHER_ENGINE_LEGACY
Camellia - driver only
depends_on:!MBEDTLS_BLOCK_CIPHER_CAMELLIA_VIA_LEGACY:MBEDTLS_BLOCK_CIPHER_CAMELLIA_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_CAMELLIA:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA:MBEDTLS_BLOCK_CIPHER_ENGINE_PSA
Camellia - legacy + driver
depends_on:MBEDTLS_BLOCK_CIPHER_CAMELLIA_VIA_LEGACY:MBEDTLS_BLOCK_CIPHER_CAMELLIA_VIA_PSA
block_cipher_psa_dynamic_dispatch:MBEDTLS_CIPHER_ID_CAMELLIA:0:MBEDTLS_BLOCK_CIPHER_ENGINE_PSA