Lines Matching refs:rs_ctx
247 mbedtls_ecp_restart_ctx *rs_ctx, in mbedtls_ecp_check_budget() argument
250 if (rs_ctx != NULL && ecp_max_ops != 0) { in mbedtls_ecp_check_budget()
263 if ((rs_ctx->ops_done != 0) && in mbedtls_ecp_check_budget()
264 (rs_ctx->ops_done > ecp_max_ops || in mbedtls_ecp_check_budget()
265 ops > ecp_max_ops - rs_ctx->ops_done)) { in mbedtls_ecp_check_budget()
270 rs_ctx->ops_done += ops; in mbedtls_ecp_check_budget()
279 if (rs_ctx != NULL && rs_ctx->depth++ == 0) \
280 rs_ctx->ops_done = 0; \
284 rs_ctx != NULL && rs_ctx->SUB == NULL) \
286 rs_ctx->SUB = mbedtls_calloc(1, sizeof(*rs_ctx->SUB)); \
287 if (rs_ctx->SUB == NULL) \
290 ecp_restart_## SUB ##_init(rs_ctx->SUB); \
297 if (rs_ctx != NULL && rs_ctx->SUB != NULL && \
300 ecp_restart_## SUB ##_free(rs_ctx->SUB); \
301 mbedtls_free(rs_ctx->SUB); \
302 rs_ctx->SUB = NULL; \
305 if (rs_ctx != NULL) \
306 rs_ctx->depth--; \
311 #define ECP_RS_ENTER(sub) (void) rs_ctx;
312 #define ECP_RS_LEAVE(sub) (void) rs_ctx;
1852 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_precompute_comb() argument
1865 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1866 if (rs_ctx->rsm->state == ecp_rsm_pre_dbl) { in ecp_precompute_comb()
1869 if (rs_ctx->rsm->state == ecp_rsm_pre_norm_dbl) { in ecp_precompute_comb()
1872 if (rs_ctx->rsm->state == ecp_rsm_pre_add) { in ecp_precompute_comb()
1875 if (rs_ctx->rsm->state == ecp_rsm_pre_norm_add) { in ecp_precompute_comb()
1880 (void) rs_ctx; in ecp_precompute_comb()
1884 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1885 rs_ctx->rsm->state = ecp_rsm_pre_dbl; in ecp_precompute_comb()
1888 rs_ctx->rsm->i = 0; in ecp_precompute_comb()
1900 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0) { in ecp_precompute_comb()
1901 j = rs_ctx->rsm->i; in ecp_precompute_comb()
1920 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1921 rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl; in ecp_precompute_comb()
1943 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1944 rs_ctx->rsm->state = ecp_rsm_pre_add; in ecp_precompute_comb()
1963 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1964 rs_ctx->rsm->state = ecp_rsm_pre_norm_add; in ecp_precompute_comb()
1996 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_precompute_comb()
1998 if (rs_ctx->rsm->state == ecp_rsm_pre_dbl) { in ecp_precompute_comb()
1999 rs_ctx->rsm->i = j; in ecp_precompute_comb()
2048 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb_core() argument
2059 (void) rs_ctx; in ecp_mul_comb_core()
2063 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2064 rs_ctx->rsm->state != ecp_rsm_comb_core) { in ecp_mul_comb_core()
2065 rs_ctx->rsm->i = 0; in ecp_mul_comb_core()
2066 rs_ctx->rsm->state = ecp_rsm_comb_core; in ecp_mul_comb_core()
2070 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0) { in ecp_mul_comb_core()
2072 i = rs_ctx->rsm->i; in ecp_mul_comb_core()
2099 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2101 rs_ctx->rsm->i = i; in ecp_mul_comb_core()
2173 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb_after_precomp() argument
2181 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2182 RR = &rs_ctx->rsm->R; in ecp_mul_comb_after_precomp()
2184 if (rs_ctx->rsm->state == ecp_rsm_final_norm) { in ecp_mul_comb_after_precomp()
2193 f_rng, p_rng, rs_ctx)); in ecp_mul_comb_after_precomp()
2197 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2198 rs_ctx->rsm->state = ecp_rsm_final_norm; in ecp_mul_comb_after_precomp()
2222 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2293 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb() argument
2324 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->T != NULL) { in ecp_mul_comb()
2326 T = rs_ctx->rsm->T; in ecp_mul_comb()
2327 rs_ctx->rsm->T = NULL; in ecp_mul_comb()
2328 rs_ctx->rsm->T_size = 0; in ecp_mul_comb()
2331 T_ok = rs_ctx->rsm->state >= ecp_rsm_comb_core; in ecp_mul_comb()
2351 MBEDTLS_MPI_CHK(ecp_precompute_comb(grp, T, P, w, d, rs_ctx)); in ecp_mul_comb()
2364 f_rng, p_rng, rs_ctx)); in ecp_mul_comb()
2375 if (rs_ctx != NULL && rs_ctx->rsm != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS && T != NULL) { in ecp_mul_comb()
2377 rs_ctx->rsm->T_size = T_size; in ecp_mul_comb()
2378 rs_ctx->rsm->T = T; in ecp_mul_comb()
2629 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_restartable_internal() argument
2638 if (rs_ctx != NULL && rs_ctx->depth++ == 0) { in ecp_mul_restartable_internal()
2639 rs_ctx->ops_done = 0; in ecp_mul_restartable_internal()
2642 (void) rs_ctx; in ecp_mul_restartable_internal()
2653 restarting = (rs_ctx != NULL && rs_ctx->rsm != NULL); in ecp_mul_restartable_internal()
2673 MBEDTLS_MPI_CHK(ecp_mul_comb(grp, R, m, P, f_rng, p_rng, rs_ctx)); in ecp_mul_restartable_internal()
2686 if (rs_ctx != NULL) { in ecp_mul_restartable_internal()
2687 rs_ctx->depth--; in ecp_mul_restartable_internal()
2700 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_mul_restartable() argument
2706 return ecp_mul_restartable_internal(grp, R, m, P, f_rng, p_rng, rs_ctx); in mbedtls_ecp_mul_restartable()
2769 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_mul_shortcuts() argument
2787 NULL, NULL, rs_ctx)); in mbedtls_ecp_mul_shortcuts()
2804 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_muladd_restartable() argument
2824 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2826 pmP = &rs_ctx->ma->mP; in mbedtls_ecp_muladd_restartable()
2827 pR = &rs_ctx->ma->R; in mbedtls_ecp_muladd_restartable()
2830 if (rs_ctx->ma->state == ecp_rsma_mul2) { in mbedtls_ecp_muladd_restartable()
2833 if (rs_ctx->ma->state == ecp_rsma_add) { in mbedtls_ecp_muladd_restartable()
2836 if (rs_ctx->ma->state == ecp_rsma_norm) { in mbedtls_ecp_muladd_restartable()
2842 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pmP, m, P, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2844 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2845 rs_ctx->ma->state = ecp_rsma_mul2; in mbedtls_ecp_muladd_restartable()
2850 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pR, n, Q, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2859 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2860 rs_ctx->ma->state = ecp_rsma_add; in mbedtls_ecp_muladd_restartable()
2868 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2869 rs_ctx->ma->state = ecp_rsma_norm; in mbedtls_ecp_muladd_restartable()
2878 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()