- Changed the behaviour of x509parse_parse_crt for permissive parsing. Now returns the number of 'failed certificates' instead of having a switch to enable it.
- As a consequence all error code that were positive were changed. A lot of MALLOC_FAILED and FILE_IO_ERROR error codes added for different modules.
- Programs and tests were adapted accordingly
diff --git a/tests/suites/test_suite_ctr_drbg.function b/tests/suites/test_suite_ctr_drbg.function
index 7349517..155bfc5 100644
--- a/tests/suites/test_suite_ctr_drbg.function
+++ b/tests/suites/test_suite_ctr_drbg.function
@@ -2,8 +2,9 @@
#include <polarssl/ctr_drbg.h>
int test_offset;
-int entropy_func( void *p, unsigned char *buf, size_t len )
+int entropy_func( void *data, unsigned char *buf, size_t len )
{
+ unsigned char *p = (unsigned char *) data;
memcpy( buf, p + test_offset, len );
test_offset += 32;
return( 0 );
diff --git a/tests/suites/test_suite_debug.function b/tests/suites/test_suite_debug.function
index 950c7ea..02381ca 100644
--- a/tests/suites/test_suite_debug.function
+++ b/tests/suites/test_suite_debug.function
@@ -35,7 +35,7 @@
ssl_set_dbg(&ssl, string_debug, &buffer);
- TEST_ASSERT( x509parse_crtfile( &crt, {crt_file}, X509_NON_PERMISSIVE ) == 0 );
+ TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 );
debug_print_crt( &ssl, 0, {file}, {line}, {prefix}, &crt);
TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 );
diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function
index deac249..18e1c41 100644
--- a/tests/suites/test_suite_x509parse.function
+++ b/tests/suites/test_suite_x509parse.function
@@ -38,7 +38,7 @@
memset( &crt, 0, sizeof( x509_cert ) );
memset( buf, 0, 2000 );
- TEST_ASSERT( x509parse_crtfile( &crt, {crt_file}, X509_NON_PERMISSIVE ) == 0 );
+ TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 );
res = x509parse_cert_info( buf, 2000, "", &crt );
TEST_ASSERT( res != -1 );
@@ -81,8 +81,8 @@
memset( &ca, 0, sizeof( x509_cert ) );
memset( &crl, 0, sizeof( x509_crl ) );
- TEST_ASSERT( x509parse_crtfile( &crt, {crt_file}, X509_NON_PERMISSIVE ) == 0 );
- TEST_ASSERT( x509parse_crtfile( &ca, {ca_file}, X509_NON_PERMISSIVE ) == 0 );
+ TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 );
+ TEST_ASSERT( x509parse_crtfile( &ca, {ca_file} ) == 0 );
TEST_ASSERT( x509parse_crlfile( &crl, {crl_file} ) == 0 );
res = x509parse_verify( &crt, &ca, &crl, {cn_name}, &flags, {verify_callback}, NULL );
@@ -102,7 +102,7 @@
memset( &crt, 0, sizeof( x509_cert ) );
memset( buf, 0, 2000 );
- TEST_ASSERT( x509parse_crtfile( &crt, {crt_file}, X509_NON_PERMISSIVE ) == 0 );
+ TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 );
res = x509parse_dn_gets( buf, 2000, &crt.{entity} );
TEST_ASSERT( res != -1 );
@@ -119,7 +119,7 @@
memset( &crt, 0, sizeof( x509_cert ) );
- TEST_ASSERT( x509parse_crtfile( &crt, {crt_file}, X509_NON_PERMISSIVE ) == 0 );
+ TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 );
TEST_ASSERT( x509parse_time_expired( &crt.{entity} ) == {result} );
}
END_CASE
@@ -176,7 +176,7 @@
data_len = unhexify( buf, {crt_data} );
- TEST_ASSERT( x509parse_crt( &crt, buf, data_len, X509_NON_PERMISSIVE ) == ( {result} ) );
+ TEST_ASSERT( x509parse_crt( &crt, buf, data_len ) == ( {result} ) );
if( ( {result} ) == 0 )
{
res = x509parse_cert_info( (char *) output, 2000, "", &crt );