Lines Matching refs:rs_ctx

273                               mbedtls_ecp_restart_ctx *rs_ctx,  in mbedtls_ecp_check_budget()  argument
278 if( rs_ctx != NULL && ecp_max_ops != 0 ) in mbedtls_ecp_check_budget()
291 if( ( rs_ctx->ops_done != 0 ) && in mbedtls_ecp_check_budget()
292 ( rs_ctx->ops_done > ecp_max_ops || in mbedtls_ecp_check_budget()
293 ops > ecp_max_ops - rs_ctx->ops_done ) ) in mbedtls_ecp_check_budget()
299 rs_ctx->ops_done += ops; in mbedtls_ecp_check_budget()
308 if( rs_ctx != NULL && rs_ctx->depth++ == 0 ) \
309 rs_ctx->ops_done = 0; \
313 rs_ctx != NULL && rs_ctx->SUB == NULL ) \
315 rs_ctx->SUB = mbedtls_calloc( 1, sizeof( *rs_ctx->SUB ) ); \
316 if( rs_ctx->SUB == NULL ) \
319 ecp_restart_## SUB ##_init( rs_ctx->SUB ); \
326 if( rs_ctx != NULL && rs_ctx->SUB != NULL && \
329 ecp_restart_## SUB ##_free( rs_ctx->SUB ); \
330 mbedtls_free( rs_ctx->SUB ); \
331 rs_ctx->SUB = NULL; \
334 if( rs_ctx != NULL ) \
335 rs_ctx->depth--; \
340 #define ECP_RS_ENTER( sub ) (void) rs_ctx;
341 #define ECP_RS_LEAVE( sub ) (void) rs_ctx;
1709 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_precompute_comb() argument
1718 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1720 if( rs_ctx->rsm->state == ecp_rsm_pre_dbl ) in ecp_precompute_comb()
1722 if( rs_ctx->rsm->state == ecp_rsm_pre_norm_dbl ) in ecp_precompute_comb()
1724 if( rs_ctx->rsm->state == ecp_rsm_pre_add ) in ecp_precompute_comb()
1726 if( rs_ctx->rsm->state == ecp_rsm_pre_norm_add ) in ecp_precompute_comb()
1730 (void) rs_ctx; in ecp_precompute_comb()
1734 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1736 rs_ctx->rsm->state = ecp_rsm_pre_dbl; in ecp_precompute_comb()
1739 rs_ctx->rsm->i = 0; in ecp_precompute_comb()
1751 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0 ) in ecp_precompute_comb()
1752 j = rs_ctx->rsm->i; in ecp_precompute_comb()
1771 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1772 rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl; in ecp_precompute_comb()
1789 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1790 rs_ctx->rsm->state = ecp_rsm_pre_add; in ecp_precompute_comb()
1808 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1809 rs_ctx->rsm->state = ecp_rsm_pre_norm_add; in ecp_precompute_comb()
1827 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_precompute_comb()
1830 if( rs_ctx->rsm->state == ecp_rsm_pre_dbl ) in ecp_precompute_comb()
1831 rs_ctx->rsm->i = j; in ecp_precompute_comb()
1878 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb_core() argument
1887 (void) rs_ctx; in ecp_mul_comb_core()
1891 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
1892 rs_ctx->rsm->state != ecp_rsm_comb_core ) in ecp_mul_comb_core()
1894 rs_ctx->rsm->i = 0; in ecp_mul_comb_core()
1895 rs_ctx->rsm->state = ecp_rsm_comb_core; in ecp_mul_comb_core()
1899 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0 ) in ecp_mul_comb_core()
1902 i = rs_ctx->rsm->i; in ecp_mul_comb_core()
1930 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
1933 rs_ctx->rsm->i = i; in ecp_mul_comb_core()
2004 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb_after_precomp() argument
2012 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2014 RR = &rs_ctx->rsm->R; in ecp_mul_comb_after_precomp()
2016 if( rs_ctx->rsm->state == ecp_rsm_final_norm ) in ecp_mul_comb_after_precomp()
2024 f_rng, p_rng, rs_ctx ) ); in ecp_mul_comb_after_precomp()
2028 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2029 rs_ctx->rsm->state = ecp_rsm_final_norm; in ecp_mul_comb_after_precomp()
2051 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2118 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb() argument
2151 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->T != NULL ) in ecp_mul_comb()
2154 T = rs_ctx->rsm->T; in ecp_mul_comb()
2155 rs_ctx->rsm->T = NULL; in ecp_mul_comb()
2156 rs_ctx->rsm->T_size = 0; in ecp_mul_comb()
2159 T_ok = rs_ctx->rsm->state >= ecp_rsm_comb_core; in ecp_mul_comb()
2181 MBEDTLS_MPI_CHK( ecp_precompute_comb( grp, T, P, w, d, rs_ctx ) ); in ecp_mul_comb()
2195 f_rng, p_rng, rs_ctx ) ); in ecp_mul_comb()
2205 if( rs_ctx != NULL && rs_ctx->rsm != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS && T != NULL ) in ecp_mul_comb()
2208 rs_ctx->rsm->T_size = T_size; in ecp_mul_comb()
2209 rs_ctx->rsm->T = T; in ecp_mul_comb()
2455 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_restartable_internal() argument
2464 if( rs_ctx != NULL && rs_ctx->depth++ == 0 ) in ecp_mul_restartable_internal()
2465 rs_ctx->ops_done = 0; in ecp_mul_restartable_internal()
2467 (void) rs_ctx; in ecp_mul_restartable_internal()
2477 if( rs_ctx == NULL || rs_ctx->rsm == NULL ) in ecp_mul_restartable_internal()
2495 MBEDTLS_MPI_CHK( ecp_mul_comb( grp, R, m, P, f_rng, p_rng, rs_ctx ) ); in ecp_mul_restartable_internal()
2506 if( rs_ctx != NULL ) in ecp_mul_restartable_internal()
2507 rs_ctx->depth--; in ecp_mul_restartable_internal()
2519 mbedtls_ecp_restart_ctx *rs_ctx ) in mbedtls_ecp_mul_restartable() argument
2529 return( ecp_mul_restartable_internal( grp, R, m, P, f_rng, p_rng, rs_ctx ) ); in mbedtls_ecp_mul_restartable()
2605 mbedtls_ecp_restart_ctx *rs_ctx ) in mbedtls_ecp_mul_shortcuts() argument
2626 NULL, NULL, rs_ctx ) ); in mbedtls_ecp_mul_shortcuts()
2641 mbedtls_ecp_restart_ctx *rs_ctx ) in mbedtls_ecp_muladd_restartable() argument
2665 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2668 pmP = &rs_ctx->ma->mP; in mbedtls_ecp_muladd_restartable()
2669 pR = &rs_ctx->ma->R; in mbedtls_ecp_muladd_restartable()
2672 if( rs_ctx->ma->state == ecp_rsma_mul2 ) in mbedtls_ecp_muladd_restartable()
2674 if( rs_ctx->ma->state == ecp_rsma_add ) in mbedtls_ecp_muladd_restartable()
2676 if( rs_ctx->ma->state == ecp_rsma_norm ) in mbedtls_ecp_muladd_restartable()
2681 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pmP, m, P, rs_ctx ) ); in mbedtls_ecp_muladd_restartable()
2683 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2684 rs_ctx->ma->state = ecp_rsma_mul2; in mbedtls_ecp_muladd_restartable()
2688 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pR, n, Q, rs_ctx ) ); in mbedtls_ecp_muladd_restartable()
2696 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2697 rs_ctx->ma->state = ecp_rsma_add; in mbedtls_ecp_muladd_restartable()
2704 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2705 rs_ctx->ma->state = ecp_rsma_norm; in mbedtls_ecp_muladd_restartable()
2713 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()