mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-09 12:40:57 +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];
|
||||
|
||||
PSA_INIT();
|
||||
TEST_ASSERT( mbedtls_pkcs5_pbkdf2_hmac_ext( hash, pw_str->x, pw_str->len,
|
||||
salt_str->x, salt_str->len,
|
||||
it_cnt, key_len, key ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x,
|
||||
key_len, result_key_string->len ) == 0 );
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
@ -31,6 +33,8 @@ void mbedtls_pkcs5_pbes2( int params_tag, data_t *params_hex, data_t *pw,
|
||||
mbedtls_asn1_buf params;
|
||||
unsigned char *my_out = NULL;
|
||||
|
||||
PSA_INIT();
|
||||
|
||||
params.tag = params_tag;
|
||||
params.p = params_hex->x;
|
||||
params.len = params_hex->len;
|
||||
@ -46,6 +50,7 @@ void mbedtls_pkcs5_pbes2( int params_tag, data_t *params_hex, data_t *pw,
|
||||
|
||||
exit:
|
||||
mbedtls_free( my_out );
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
@ -17,6 +17,7 @@ void pk_parse_keyfile_rsa( char * key_file, char * password, int result )
|
||||
int res;
|
||||
char *pwd = password;
|
||||
|
||||
PSA_INIT();
|
||||
mbedtls_pk_init( &ctx );
|
||||
|
||||
if( strcmp( pwd, "NULL" ) == 0 )
|
||||
@ -37,6 +38,7 @@ void pk_parse_keyfile_rsa( char * key_file, char * password, int result )
|
||||
|
||||
exit:
|
||||
mbedtls_pk_free( &ctx );
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
@ -46,6 +48,7 @@ void pk_parse_public_keyfile_rsa( char * key_file, int result )
|
||||
mbedtls_pk_context ctx;
|
||||
int res;
|
||||
|
||||
PSA_INIT();
|
||||
mbedtls_pk_init( &ctx );
|
||||
|
||||
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:
|
||||
mbedtls_pk_free( &ctx );
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user