Add check for changing arguments
In case of argument change, freeing everything is not the most efficient
(wastes one free()+calloc()) but makes the code simpler, which is probably
more important here
diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function
index 74e2387..caf983e 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -121,6 +121,13 @@
}
while( ret != 0 );
+ /* Ok, now start an operation with some arguments, and drop it.
+ * We'll see if the result of the next operation, with different args,
+ * are correct regardless (do we discard old context on new args?).
+ * This also tests that we don't write to R prematurely */
+ ret = mbedtls_ecp_mul( &grp, &R, &dA, &grp.G, NULL, NULL );
+ TEST_ASSERT( ret == 0 || ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+
/* Non-base point case */
cnt_restarts = 0;
do {