Make use of copy-less CRT parsing API in ssl_client2/ssl_server2

This commit is contained in:
Hanno Becker 2019-09-19 16:58:57 +01:00 committed by Teppo Järvelin
parent 7d864c494a
commit c828432920
2 changed files with 9 additions and 3 deletions

View file

@ -1789,7 +1789,7 @@ int main( int argc, char *argv[] )
#endif /* MBEDTLS_PEM_PARSE_C */ #endif /* MBEDTLS_PEM_PARSE_C */
for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ ) for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ )
{ {
ret = mbedtls_x509_crt_parse_der( cacert, ret = mbedtls_x509_crt_parse_der_nocopy( cacert,
(const unsigned char *) mbedtls_test_cas_der[i], (const unsigned char *) mbedtls_test_cas_der[i],
mbedtls_test_cas_der_len[i] ); mbedtls_test_cas_der_len[i] );
if( ret != 0 ) if( ret != 0 )
@ -1828,9 +1828,15 @@ int main( int argc, char *argv[] )
else else
#endif #endif
#if defined(MBEDTLS_CERTS_C) #if defined(MBEDTLS_CERTS_C)
ret = mbedtls_x509_crt_parse( &clicert, #if defined(MBEDTLS_PEM_PARSE_C)
ret = mbedtls_x509_crt_parse( clicert,
(const unsigned char *) mbedtls_test_cli_crt, (const unsigned char *) mbedtls_test_cli_crt,
mbedtls_test_cli_crt_len ); mbedtls_test_cli_crt_len );
#else
ret = mbedtls_x509_crt_parse_der_nocopy( clicert,
(const unsigned char *) mbedtls_test_cli_crt,
mbedtls_test_cli_crt_len );
#endif
#else #else
{ {
ret = 1; ret = 1;

View file

@ -2545,7 +2545,7 @@ int main( int argc, char *argv[] )
#endif /* MBEDTLS_PEM_PARSE_C */ #endif /* MBEDTLS_PEM_PARSE_C */
for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ ) for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ )
{ {
ret = mbedtls_x509_crt_parse_der( cacert, ret = mbedtls_x509_crt_parse_der_nocopy( cacert,
(const unsigned char *) mbedtls_test_cas_der[i], (const unsigned char *) mbedtls_test_cas_der[i],
mbedtls_test_cas_der_len[i] ); mbedtls_test_cas_der_len[i] );
if( ret != 0 ) if( ret != 0 )