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.
This commit is contained in:
Manuel Pégourié-Gonnard
2017-04-20 10:03:45 +02:00
parent 8467e6848d
commit 646393bb1e
2 changed files with 10 additions and 8 deletions

View File

@@ -184,7 +184,8 @@ typedef struct mbedtls_ecp_restart_mul mbedtls_ecp_restart_mul_ctx;
*/
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 */