mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
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:
@ -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 */
|
||||
|
Reference in New Issue
Block a user