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;
1856 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_precompute_comb() argument
1869 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1870 if (rs_ctx->rsm->state == ecp_rsm_pre_dbl) { in ecp_precompute_comb()
1873 if (rs_ctx->rsm->state == ecp_rsm_pre_norm_dbl) { in ecp_precompute_comb()
1876 if (rs_ctx->rsm->state == ecp_rsm_pre_add) { in ecp_precompute_comb()
1879 if (rs_ctx->rsm->state == ecp_rsm_pre_norm_add) { in ecp_precompute_comb()
1884 (void) rs_ctx; in ecp_precompute_comb()
1888 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1889 rs_ctx->rsm->state = ecp_rsm_pre_dbl; in ecp_precompute_comb()
1892 rs_ctx->rsm->i = 0; in ecp_precompute_comb()
1904 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0) { in ecp_precompute_comb()
1905 j = rs_ctx->rsm->i; in ecp_precompute_comb()
1924 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1925 rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl; in ecp_precompute_comb()
1947 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1948 rs_ctx->rsm->state = ecp_rsm_pre_add; in ecp_precompute_comb()
1967 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_precompute_comb()
1968 rs_ctx->rsm->state = ecp_rsm_pre_norm_add; in ecp_precompute_comb()
2000 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_precompute_comb()
2002 if (rs_ctx->rsm->state == ecp_rsm_pre_dbl) { in ecp_precompute_comb()
2003 rs_ctx->rsm->i = j; in ecp_precompute_comb()
2052 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb_core() argument
2063 (void) rs_ctx; in ecp_mul_comb_core()
2067 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2068 rs_ctx->rsm->state != ecp_rsm_comb_core) { in ecp_mul_comb_core()
2069 rs_ctx->rsm->i = 0; in ecp_mul_comb_core()
2070 rs_ctx->rsm->state = ecp_rsm_comb_core; in ecp_mul_comb_core()
2074 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0) { in ecp_mul_comb_core()
2076 i = rs_ctx->rsm->i; in ecp_mul_comb_core()
2103 if (rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2105 rs_ctx->rsm->i = i; in ecp_mul_comb_core()
2177 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb_after_precomp() argument
2185 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2186 RR = &rs_ctx->rsm->R; in ecp_mul_comb_after_precomp()
2188 if (rs_ctx->rsm->state == ecp_rsm_final_norm) { in ecp_mul_comb_after_precomp()
2197 f_rng, p_rng, rs_ctx)); in ecp_mul_comb_after_precomp()
2201 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2202 rs_ctx->rsm->state = ecp_rsm_final_norm; in ecp_mul_comb_after_precomp()
2226 if (rs_ctx != NULL && rs_ctx->rsm != NULL) { in ecp_mul_comb_after_precomp()
2297 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_comb() argument
2328 if (rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->T != NULL) { in ecp_mul_comb()
2330 T = rs_ctx->rsm->T; in ecp_mul_comb()
2331 rs_ctx->rsm->T = NULL; in ecp_mul_comb()
2332 rs_ctx->rsm->T_size = 0; in ecp_mul_comb()
2335 T_ok = rs_ctx->rsm->state >= ecp_rsm_comb_core; in ecp_mul_comb()
2355 MBEDTLS_MPI_CHK(ecp_precompute_comb(grp, T, P, w, d, rs_ctx)); in ecp_mul_comb()
2368 f_rng, p_rng, rs_ctx)); in ecp_mul_comb()
2379 if (rs_ctx != NULL && rs_ctx->rsm != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS && T != NULL) { in ecp_mul_comb()
2381 rs_ctx->rsm->T_size = T_size; in ecp_mul_comb()
2382 rs_ctx->rsm->T = T; in ecp_mul_comb()
2633 mbedtls_ecp_restart_ctx *rs_ctx) in ecp_mul_restartable_internal() argument
2642 if (rs_ctx != NULL && rs_ctx->depth++ == 0) { in ecp_mul_restartable_internal()
2643 rs_ctx->ops_done = 0; in ecp_mul_restartable_internal()
2646 (void) rs_ctx; in ecp_mul_restartable_internal()
2657 restarting = (rs_ctx != NULL && rs_ctx->rsm != NULL); in ecp_mul_restartable_internal()
2677 MBEDTLS_MPI_CHK(ecp_mul_comb(grp, R, m, P, f_rng, p_rng, rs_ctx)); in ecp_mul_restartable_internal()
2690 if (rs_ctx != NULL) { in ecp_mul_restartable_internal()
2691 rs_ctx->depth--; in ecp_mul_restartable_internal()
2704 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_mul_restartable() argument
2710 return ecp_mul_restartable_internal(grp, R, m, P, f_rng, p_rng, rs_ctx); in mbedtls_ecp_mul_restartable()
2773 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_mul_shortcuts() argument
2791 NULL, NULL, rs_ctx)); in mbedtls_ecp_mul_shortcuts()
2808 mbedtls_ecp_restart_ctx *rs_ctx) in mbedtls_ecp_muladd_restartable() argument
2828 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2830 pmP = &rs_ctx->ma->mP; in mbedtls_ecp_muladd_restartable()
2831 pR = &rs_ctx->ma->R; in mbedtls_ecp_muladd_restartable()
2834 if (rs_ctx->ma->state == ecp_rsma_mul2) { in mbedtls_ecp_muladd_restartable()
2837 if (rs_ctx->ma->state == ecp_rsma_add) { in mbedtls_ecp_muladd_restartable()
2840 if (rs_ctx->ma->state == ecp_rsma_norm) { in mbedtls_ecp_muladd_restartable()
2846 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pmP, m, P, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2848 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2849 rs_ctx->ma->state = ecp_rsma_mul2; in mbedtls_ecp_muladd_restartable()
2854 MBEDTLS_MPI_CHK(mbedtls_ecp_mul_shortcuts(grp, pR, n, Q, rs_ctx)); in mbedtls_ecp_muladd_restartable()
2863 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2864 rs_ctx->ma->state = ecp_rsma_add; in mbedtls_ecp_muladd_restartable()
2872 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()
2873 rs_ctx->ma->state = ecp_rsma_norm; in mbedtls_ecp_muladd_restartable()
2882 if (rs_ctx != NULL && rs_ctx->ma != NULL) { in mbedtls_ecp_muladd_restartable()