mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-08 14:49:59 -04:00
Merge pull request #6246 from superna9999/6100-crash-in-test-suite-x509write-backport
[Backport 2.28]Crash in test suite x509write config full no seedfile
This commit is contained in:
commit
1b36e1b4d7
@ -93,10 +93,11 @@ 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 );
|
||||
|
||||
mbedtls_pk_init( &key );
|
||||
TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, 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 );
|
||||
@ -156,9 +157,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_psa_translate_md( (mbedtls_md_type_t) md_type );
|
||||
TEST_ASSERT( md_alg_psa != MBEDTLS_MD_NONE );
|
||||
|
||||
@ -166,7 +170,6 @@ void x509_csr_check_opaque( char *key_file, int md_type, int key_usage,
|
||||
TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL ) == 0 );
|
||||
TEST_ASSERT( mbedtls_pk_wrap_as_opaque( &key, &key_id, md_alg_psa ) == 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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user