1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-04-30 00:56:46 +03:00

Fix dependencies in tests

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-04-27 15:33:43 +02:00
parent bc3cfed43e
commit cd204992f2
3 changed files with 14 additions and 4 deletions

View File

@ -82,7 +82,7 @@ void oid_get_x509_extension( data_t *oid, int exp_type )
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE depends_on:MBEDTLS_MD_C */
void oid_get_md_alg_id( data_t *oid, int exp_md_id ) void oid_get_md_alg_id( data_t *oid, int exp_md_id )
{ {
mbedtls_asn1_buf md_oid = { 0, 0, NULL }; mbedtls_asn1_buf md_oid = { 0, 0, NULL };

View File

@ -170,6 +170,7 @@ static psa_status_t counter_allocate( psa_drv_se_context_t *context,
} }
/* Null import: do nothing, but pretend it worked. */ /* Null import: do nothing, but pretend it worked. */
#if defined(AT_LEAST_ONE_BUILTIN_KDF)
static psa_status_t null_import( psa_drv_se_context_t *context, static psa_status_t null_import( psa_drv_se_context_t *context,
psa_key_slot_number_t slot_number, psa_key_slot_number_t slot_number,
const psa_key_attributes_t *attributes, const psa_key_attributes_t *attributes,
@ -186,8 +187,10 @@ static psa_status_t null_import( psa_drv_se_context_t *context,
*bits = PSA_BYTES_TO_BITS( data_length ); *bits = PSA_BYTES_TO_BITS( data_length );
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }
#endif /* AT_LEAST_ONE_BUILTIN_KDF */
/* Null generate: do nothing, but pretend it worked. */ /* Null generate: do nothing, but pretend it worked. */
#if defined(AT_LEAST_ONE_BUILTIN_KDF)
static psa_status_t null_generate( psa_drv_se_context_t *context, static psa_status_t null_generate( psa_drv_se_context_t *context,
psa_key_slot_number_t slot_number, psa_key_slot_number_t slot_number,
const psa_key_attributes_t *attributes, const psa_key_attributes_t *attributes,
@ -208,6 +211,7 @@ static psa_status_t null_generate( psa_drv_se_context_t *context,
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }
#endif /* AT_LEAST_ONE_BUILTIN_KDF */
/* Null destroy: do nothing, but pretend it worked. */ /* Null destroy: do nothing, but pretend it worked. */
static psa_status_t null_destroy( psa_drv_se_context_t *context, static psa_status_t null_destroy( psa_drv_se_context_t *context,
@ -635,6 +639,7 @@ exit:
/* Check that a function's return status is "smoke-free", i.e. that /* Check that a function's return status is "smoke-free", i.e. that
* it's an acceptable error code when calling an API function that operates * it's an acceptable error code when calling an API function that operates
* on a key with potentially bogus parameters. */ * on a key with potentially bogus parameters. */
#if defined(AT_LEAST_ONE_BUILTIN_KDF)
static int is_status_smoke_free( psa_status_t status ) static int is_status_smoke_free( psa_status_t status )
{ {
switch( status ) switch( status )
@ -651,6 +656,8 @@ static int is_status_smoke_free( psa_status_t status )
return( 0 ); return( 0 );
} }
} }
#endif /* AT_LEAST_ONE_BUILTIN_KDF */
#define SMOKE_ASSERT( expr ) \ #define SMOKE_ASSERT( expr ) \
TEST_ASSERT( is_status_smoke_free( expr ) ) TEST_ASSERT( is_status_smoke_free( expr ) )
@ -658,6 +665,7 @@ static int is_status_smoke_free( psa_status_t status )
* mostly bogus parameters: the goal is to ensure that there is no memory * mostly bogus parameters: the goal is to ensure that there is no memory
* corruption or crash. This test function is most useful when run under * corruption or crash. This test function is most useful when run under
* an environment with sanity checks such as ASan or MSan. */ * an environment with sanity checks such as ASan or MSan. */
#if defined(AT_LEAST_ONE_BUILTIN_KDF)
static int smoke_test_key( mbedtls_svc_key_id_t key ) static int smoke_test_key( mbedtls_svc_key_id_t key )
{ {
int ok = 0; int ok = 0;
@ -766,6 +774,7 @@ exit:
return( ok ); return( ok );
} }
#endif /* AT_LEAST_ONE_BUILTIN_KDF */
static void psa_purge_storage( void ) static void psa_purge_storage( void )
{ {
@ -1073,7 +1082,7 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE depends_on:AT_LEAST_ONE_BUILTIN_KDF */
void import_key_smoke( int type_arg, int alg_arg, void import_key_smoke( int type_arg, int alg_arg,
data_t *key_material ) data_t *key_material )
{ {
@ -1186,7 +1195,7 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE depends_on:AT_LEAST_ONE_BUILTIN_KDF */
void generate_key_smoke( int type_arg, int bits_arg, int alg_arg ) void generate_key_smoke( int type_arg, int bits_arg, int alg_arg )
{ {
psa_key_type_t type = type_arg; psa_key_type_t type = type_arg;

View File

@ -87,7 +87,7 @@ int ca_callback_fail( void *data, mbedtls_x509_crt const *child, mbedtls_x509_cr
return -1; return -1;
} }
#if defined(MBEDTLS_X509_CRT_PARSE_C)
int ca_callback( void *data, mbedtls_x509_crt const *child, int ca_callback( void *data, mbedtls_x509_crt const *child,
mbedtls_x509_crt **candidates ) mbedtls_x509_crt **candidates )
{ {
@ -141,6 +141,7 @@ exit:
*candidates = first; *candidates = first;
return( ret ); return( ret );
} }
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */ #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
int verify_fatal( void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags ) int verify_fatal( void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags )