Lines Matching refs:rs_ctx
254 mbedtls_ecp_restart_ctx *rs_ctx, in mbedtls_ecp_check_budget() argument
257 if (rs_ctx != NULL && ecp_max_ops != 0) { in mbedtls_ecp_check_budget()
270 if ((rs_ctx->ops_done != 0) && in mbedtls_ecp_check_budget()
271 (rs_ctx->ops_done > ecp_max_ops || in mbedtls_ecp_check_budget()
272 ops > ecp_max_ops - rs_ctx->ops_done)) { in mbedtls_ecp_check_budget()
277 rs_ctx->ops_done += ops; in mbedtls_ecp_check_budget()
286 if (rs_ctx != NULL && rs_ctx->depth++ == 0) \
287 rs_ctx->ops_done = 0; \
291 rs_ctx != NULL && rs_ctx->SUB == NULL) \
293 rs_ctx->SUB = mbedtls_calloc(1, sizeof(*rs_ctx->SUB)); \
294 if (rs_ctx->SUB == NULL) \
297 ecp_restart_## SUB ##_init(rs_ctx->SUB); \
304 if (rs_ctx != NULL && rs_ctx->SUB != NULL && \
307 ecp_restart_## SUB ##_free(rs_ctx->SUB); \
308 mbedtls_free(rs_ctx->SUB); \
309 rs_ctx->SUB = NULL; \
312 if (rs_ctx != NULL) \
313 rs_ctx->depth--; \
318 #define ECP_RS_ENTER(sub) (void) rs_ctx;
319 #define ECP_RS_LEAVE(sub) (void) rs_ctx;
1860 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_precompute_comb() argument
1873 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1874 if (rs_ctx->rsm->state == ecp_rsm_pre_dbl) { in ecp_precompute_comb()
1877 if (rs_ctx->rsm->state == ecp_rsm_pre_norm_dbl) { in ecp_precompute_comb()
1880 if (rs_ctx->rsm->state == ecp_rsm_pre_add) { in ecp_precompute_comb()
1883 if (rs_ctx->rsm->state == ecp_rsm_pre_norm_add) { in ecp_precompute_comb()
1888 (void) rs_ctx; in ecp_precompute_comb()
1892 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1893 rs_ctx->rsm->state = ecp_rsm_pre_dbl; in ecp_precompute_comb()
1896 rs_ctx->rsm->i = 0; in ecp_precompute_comb()
1908 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0) { in ecp_precompute_comb()
1909 j = rs_ctx->rsm->i; in ecp_precompute_comb()
1928 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1929 rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl; in ecp_precompute_comb()
1951 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1952 rs_ctx->rsm->state = ecp_rsm_pre_add; in ecp_precompute_comb()
1971 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1972 rs_ctx->rsm->state = ecp_rsm_pre_norm_add; in ecp_precompute_comb()
2004 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_precompute_comb()
2006 if (rs_ctx->rsm->state == ecp_rsm_pre_dbl) { in ecp_precompute_comb()
2007 rs_ctx->rsm->i = j; in ecp_precompute_comb()
2056 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb_core() argument
2067 (void) rs_ctx; in ecp_mul_comb_core()
2071 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2072 rs_ctx->rsm->state != ecp_rsm_comb_core) { in ecp_mul_comb_core()
2073 rs_ctx->rsm->i = 0; in ecp_mul_comb_core()
2074 rs_ctx->rsm->state = ecp_rsm_comb_core; in ecp_mul_comb_core()
2078 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0) { in ecp_mul_comb_core()
2080 i = rs_ctx->rsm->i; in ecp_mul_comb_core()
2107 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2109 rs_ctx->rsm->i = i; in ecp_mul_comb_core()
2181 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb_after_precomp() argument
2189 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2190 RR = &rs_ctx->rsm->R; in ecp_mul_comb_after_precomp()
2192 if (rs_ctx->rsm->state == ecp_rsm_final_norm) { in ecp_mul_comb_after_precomp()
2201 f_rng, p_rng, rs_ctx)); in ecp_mul_comb_after_precomp()
2205 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2206 rs_ctx->rsm->state = ecp_rsm_final_norm; in ecp_mul_comb_after_precomp()
2230 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2301 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb() argument
2332 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->T != NULL) { in ecp_mul_comb()
2334 T = rs_ctx->rsm->T; in ecp_mul_comb()
2335 rs_ctx->rsm->T = NULL; in ecp_mul_comb()
2336 rs_ctx->rsm->T_size = 0; in ecp_mul_comb()
2339 T_ok = rs_ctx->rsm->state >= ecp_rsm_comb_core; in ecp_mul_comb()
2359 MBEDTLS_MPI_CHK(ecp_precompute_comb(grp, T, P, w, d, rs_ctx)); in ecp_mul_comb()
2372 f_rng, p_rng, rs_ctx)); in ecp_mul_comb()
2383 if (rs_ctx != NULL && rs_ctx->rsm != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS && T != NULL) { in ecp_mul_comb()
2385 rs_ctx->rsm->T_size = T_size; in ecp_mul_comb()
2386 rs_ctx->rsm->T = T; in ecp_mul_comb()
2637 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_restartable_internal() argument
2646 if (rs_ctx != NULL && rs_ctx->depth++ == 0) { in ecp_mul_restartable_internal()
2647 rs_ctx->ops_done = 0; in ecp_mul_restartable_internal()
2650 (void) rs_ctx; in ecp_mul_restartable_internal()
2661 restarting = (rs_ctx != NULL && rs_ctx->rsm != NULL); in ecp_mul_restartable_internal()
2681 MBEDTLS_MPI_CHK(ecp_mul_comb(grp, R, m, P, f_rng, p_rng, rs_ctx)); in ecp_mul_restartable_internal()
2694 if (rs_ctx != NULL) { in ecp_mul_restartable_internal()
2695 rs_ctx->depth--; in ecp_mul_restartable_internal()
2708 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_mul_restartable() argument
2714 return ecp_mul_restartable_internal(grp, R, m, P, f_rng, p_rng, rs_ctx); in mbedtls_ecp_mul_restartable()
2775 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_mul_shortcuts() argument
2793 NULL, NULL, rs_ctx)); in mbedtls_ecp_mul_shortcuts()
2810 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_muladd_restartable() argument
2830 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2832 pmP = &rs_ctx->ma->mP; in mbedtls_ecp_muladd_restartable()
2833 pR = &rs_ctx->ma->R; in mbedtls_ecp_muladd_restartable()
2836 if (rs_ctx->ma->state == ecp_rsma_mul2) { in mbedtls_ecp_muladd_restartable()
2839 if (rs_ctx->ma->state == ecp_rsma_add) { in mbedtls_ecp_muladd_restartable()
2842 if (rs_ctx->ma->state == ecp_rsma_norm) { in mbedtls_ecp_muladd_restartable()
2848 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pmP, m, P, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2850 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2851 rs_ctx->ma->state = ecp_rsma_mul2; in mbedtls_ecp_muladd_restartable()
2856 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pR, n, Q, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2865 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2866 rs_ctx->ma->state = ecp_rsma_add; in mbedtls_ecp_muladd_restartable()
2874 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2875 rs_ctx->ma->state = ecp_rsma_norm; in mbedtls_ecp_muladd_restartable()
2884 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()