Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in test suite x509write config full no seedfile #6109

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/suites/test_suite_x509write.function
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ void x509_csr_check( char * key_file, char * cert_req_check_file, int md_type,

memset( &rnd_info, 0x2a, sizeof( mbedtls_test_rnd_pseudo_info ) );

mbedtls_x509write_csr_init( &req );

USE_PSA_INIT( );

mbedtls_pk_init( &key );
TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL,
mbedtls_test_rnd_std_rand, NULL ) == 0 );

mbedtls_x509write_csr_init( &req );
mbedtls_x509write_csr_set_md_alg( &req, md_type );
mbedtls_x509write_csr_set_key( &req, &key );
TEST_ASSERT( mbedtls_x509write_csr_set_subject_name( &req, subject_name ) == 0 );
Expand Down Expand Up @@ -183,9 +184,12 @@ void x509_csr_check_opaque( char *key_file, int md_type, int key_usage,
const char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1";
mbedtls_test_rnd_pseudo_info rnd_info;

PSA_INIT( );
memset( &rnd_info, 0x2a, sizeof( mbedtls_test_rnd_pseudo_info ) );

mbedtls_x509write_csr_init( &req );

USE_PSA_INIT( );

md_alg_psa = mbedtls_hash_info_psa_from_md( (mbedtls_md_type_t) md_type );
TEST_ASSERT( md_alg_psa != MBEDTLS_MD_NONE );

Expand All @@ -204,7 +208,6 @@ void x509_csr_check_opaque( char *key_file, int md_type, int key_usage,
PSA_KEY_USAGE_SIGN_HASH,
PSA_ALG_NONE ) == 0 );

mbedtls_x509write_csr_init( &req );
mbedtls_x509write_csr_set_md_alg( &req, md_type );
mbedtls_x509write_csr_set_key( &req, &key );
TEST_ASSERT( mbedtls_x509write_csr_set_subject_name( &req, subject_name ) == 0 );
Expand Down