mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Add PSA initialization and teardown to tests using pkcs5
If PSA is defined and there is no MD - an initialization is required. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
a57267c758
commit
26909f348f
@ -14,12 +14,14 @@ void pbkdf2_hmac( int hash, data_t * pw_str, data_t * salt_str,
|
|||||||
{
|
{
|
||||||
unsigned char key[100];
|
unsigned char key[100];
|
||||||
|
|
||||||
|
PSA_INIT();
|
||||||
TEST_ASSERT( mbedtls_pkcs5_pbkdf2_hmac_ext( hash, pw_str->x, pw_str->len,
|
TEST_ASSERT( mbedtls_pkcs5_pbkdf2_hmac_ext( hash, pw_str->x, pw_str->len,
|
||||||
salt_str->x, salt_str->len,
|
salt_str->x, salt_str->len,
|
||||||
it_cnt, key_len, key ) == 0 );
|
it_cnt, key_len, key ) == 0 );
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x,
|
TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x,
|
||||||
key_len, result_key_string->len ) == 0 );
|
key_len, result_key_string->len ) == 0 );
|
||||||
|
PSA_DONE();
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
@ -31,6 +33,8 @@ void mbedtls_pkcs5_pbes2( int params_tag, data_t *params_hex, data_t *pw,
|
|||||||
mbedtls_asn1_buf params;
|
mbedtls_asn1_buf params;
|
||||||
unsigned char *my_out = NULL;
|
unsigned char *my_out = NULL;
|
||||||
|
|
||||||
|
PSA_INIT();
|
||||||
|
|
||||||
params.tag = params_tag;
|
params.tag = params_tag;
|
||||||
params.p = params_hex->x;
|
params.p = params_hex->x;
|
||||||
params.len = params_hex->len;
|
params.len = params_hex->len;
|
||||||
@ -46,6 +50,7 @@ void mbedtls_pkcs5_pbes2( int params_tag, data_t *params_hex, data_t *pw,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_free( my_out );
|
mbedtls_free( my_out );
|
||||||
|
PSA_DONE();
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ void pk_parse_keyfile_rsa( char * key_file, char * password, int result )
|
|||||||
int res;
|
int res;
|
||||||
char *pwd = password;
|
char *pwd = password;
|
||||||
|
|
||||||
|
PSA_INIT();
|
||||||
mbedtls_pk_init( &ctx );
|
mbedtls_pk_init( &ctx );
|
||||||
|
|
||||||
if( strcmp( pwd, "NULL" ) == 0 )
|
if( strcmp( pwd, "NULL" ) == 0 )
|
||||||
@ -37,6 +38,7 @@ void pk_parse_keyfile_rsa( char * key_file, char * password, int result )
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_pk_free( &ctx );
|
mbedtls_pk_free( &ctx );
|
||||||
|
PSA_DONE();
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ void pk_parse_public_keyfile_rsa( char * key_file, int result )
|
|||||||
mbedtls_pk_context ctx;
|
mbedtls_pk_context ctx;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
PSA_INIT();
|
||||||
mbedtls_pk_init( &ctx );
|
mbedtls_pk_init( &ctx );
|
||||||
|
|
||||||
res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
|
res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
|
||||||
@ -62,6 +65,7 @@ void pk_parse_public_keyfile_rsa( char * key_file, int result )
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_pk_free( &ctx );
|
mbedtls_pk_free( &ctx );
|
||||||
|
PSA_DONE();
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user