Move ops count to top-level context
When a restartable function calls another restartable function, the current
ops_count needs to be shared to avoid either doing too many operations or
returning IN_PROGRESS uselessly. So it needs to be in the top-level context
rather than a specific sub-context.
diff --git a/include/mbedtls/ecp.h b/include/mbedtls/ecp.h
index d9e62f0..9193b77 100644
--- a/include/mbedtls/ecp.h
+++ b/include/mbedtls/ecp.h
@@ -184,7 +184,8 @@
*/
typedef struct
{
- mbedtls_ecp_restart_mul_ctx *rsm; /*!< restart context for ecp_mul() */
+ unsigned ops_done; /*!< current ops count */
+ mbedtls_ecp_restart_mul_ctx *rsm; /*!< ecp_mul_comb() sub-context */
} mbedtls_ecp_restart_ctx;
#endif /* MBEDTLS_ECP_EARLY_RETURN */