Fix the build and the tests when MBEDTLS_BIGNUM_C is unset
When the asn1parse module is enabled but the bignum module is
disabled, the asn1parse test suite did not work. Fix this.
* Fix a syntax error in get_integer() (label immediately followed by a
closing brace).
* Fix an unused variable in get_integer().
* Fix `TEST_ASSERT( *p == q );` in nested_parse() failing because `*p`
was not set.
* Fix nested_parse() not outputting the length of what it parsed.
diff --git a/tests/suites/test_suite_asn1parse.function b/tests/suites/test_suite_asn1parse.function
index 3bfb1c7..0497631 100644
--- a/tests/suites/test_suite_asn1parse.function
+++ b/tests/suites/test_suite_asn1parse.function
@@ -59,6 +59,10 @@
*p = start;
ret = mbedtls_asn1_get_mpi( p, end, &mpi );
mbedtls_mpi_free( &mpi );
+#else
+ *p = start + 1;
+ ret = mbedtls_asn1_get_len( p, end, &len );
+ *p += len;
#endif
/* If we're sure that the number fits in an int, also
* call mbedtls_asn1_get_int(). */
@@ -254,10 +258,10 @@
#if defined(MBEDTLS_BIGNUM_C)
mbedtls_mpi expected_mpi;
mbedtls_mpi actual_mpi;
+ int expected_result_for_mpi = expected_result;
#endif
long expected_value;
int expected_result_for_int = expected_result;
- int expected_result_for_mpi = expected_result;
int val;
int ret;
@@ -310,6 +314,7 @@
mbedtls_mpi_free( &expected_mpi );
mbedtls_mpi_free( &actual_mpi );
#endif
+ /*empty cleanup in some configurations*/ ;
}
/* END_CASE */