Lines Matching refs:rs_ctx
433 mbedtls_ecp_restart_ctx *rs_ctx, in mbedtls_ecp_check_budget() argument
438 if( rs_ctx != NULL && ecp_max_ops != 0 ) in mbedtls_ecp_check_budget()
451 if( ( rs_ctx->ops_done != 0 ) && in mbedtls_ecp_check_budget()
452 ( rs_ctx->ops_done > ecp_max_ops || in mbedtls_ecp_check_budget()
453 ops > ecp_max_ops - rs_ctx->ops_done ) ) in mbedtls_ecp_check_budget()
459 rs_ctx->ops_done += ops; in mbedtls_ecp_check_budget()
468 if( rs_ctx != NULL && rs_ctx->depth++ == 0 ) \
469 rs_ctx->ops_done = 0; \
473 rs_ctx != NULL && rs_ctx->SUB == NULL ) \
475 rs_ctx->SUB = mbedtls_calloc( 1, sizeof( *rs_ctx->SUB ) ); \
476 if( rs_ctx->SUB == NULL ) \
479 ecp_restart_## SUB ##_init( rs_ctx->SUB ); \
486 if( rs_ctx != NULL && rs_ctx->SUB != NULL && \
489 ecp_restart_## SUB ##_free( rs_ctx->SUB ); \
490 mbedtls_free( rs_ctx->SUB ); \
491 rs_ctx->SUB = NULL; \
494 if( rs_ctx != NULL ) \
495 rs_ctx->depth--; \
500 #define ECP_RS_ENTER( sub ) (void) rs_ctx;
501 #define ECP_RS_LEAVE( sub ) (void) rs_ctx;
1861 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_precompute_comb() argument
1870 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1872 if( rs_ctx->rsm->state == ecp_rsm_pre_dbl ) in ecp_precompute_comb()
1874 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()
1878 if( rs_ctx->rsm->state == ecp_rsm_pre_norm_add ) in ecp_precompute_comb()
1882 (void) rs_ctx; in ecp_precompute_comb()
1886 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1888 rs_ctx->rsm->state = ecp_rsm_pre_dbl; in ecp_precompute_comb()
1891 rs_ctx->rsm->i = 0; in ecp_precompute_comb()
1903 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0 ) in ecp_precompute_comb()
1904 j = rs_ctx->rsm->i; in ecp_precompute_comb()
1923 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1924 rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl; in ecp_precompute_comb()
1941 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1942 rs_ctx->rsm->state = ecp_rsm_pre_add; in ecp_precompute_comb()
1960 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1961 rs_ctx->rsm->state = ecp_rsm_pre_norm_add; in ecp_precompute_comb()
1979 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_precompute_comb()
1982 if( rs_ctx->rsm->state == ecp_rsm_pre_dbl ) in ecp_precompute_comb()
1983 rs_ctx->rsm->i = j; in ecp_precompute_comb()
2030 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb_core() argument
2039 (void) rs_ctx; in ecp_mul_comb_core()
2043 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2044 rs_ctx->rsm->state != ecp_rsm_comb_core ) in ecp_mul_comb_core()
2046 rs_ctx->rsm->i = 0; in ecp_mul_comb_core()
2047 rs_ctx->rsm->state = ecp_rsm_comb_core; in ecp_mul_comb_core()
2051 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0 ) in ecp_mul_comb_core()
2054 i = rs_ctx->rsm->i; in ecp_mul_comb_core()
2084 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
2087 rs_ctx->rsm->i = i; in ecp_mul_comb_core()
2158 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb_after_precomp() argument
2166 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2168 RR = &rs_ctx->rsm->R; in ecp_mul_comb_after_precomp()
2170 if( rs_ctx->rsm->state == ecp_rsm_final_norm ) in ecp_mul_comb_after_precomp()
2178 f_rng, p_rng, rs_ctx ) ); in ecp_mul_comb_after_precomp()
2182 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2183 rs_ctx->rsm->state = ecp_rsm_final_norm; in ecp_mul_comb_after_precomp()
2207 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2269 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb() argument
2290 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb()
2291 p_rng = &rs_ctx->rsm->drbg_ctx; in ecp_mul_comb()
2298 if( rs_ctx == NULL || rs_ctx->rsm == NULL || in ecp_mul_comb()
2299 rs_ctx->rsm->drbg_seeded == 0 ) in ecp_mul_comb()
2306 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb()
2307 rs_ctx->rsm->drbg_seeded = 1; in ecp_mul_comb()
2335 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->T != NULL ) in ecp_mul_comb()
2338 T = rs_ctx->rsm->T; in ecp_mul_comb()
2339 rs_ctx->rsm->T = NULL; in ecp_mul_comb()
2340 rs_ctx->rsm->T_size = 0; in ecp_mul_comb()
2343 T_ok = rs_ctx->rsm->state >= ecp_rsm_comb_core; in ecp_mul_comb()
2365 MBEDTLS_MPI_CHK( ecp_precompute_comb( grp, T, P, w, d, rs_ctx ) ); in ecp_mul_comb()
2379 f_rng, p_rng, rs_ctx ) ); in ecp_mul_comb()
2393 if( rs_ctx != NULL && rs_ctx->rsm != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS && T != NULL ) in ecp_mul_comb()
2396 rs_ctx->rsm->T_size = T_size; in ecp_mul_comb()
2397 rs_ctx->rsm->T = T; in ecp_mul_comb()
2663 mbedtls_ecp_restart_ctx *rs_ctx ) in mbedtls_ecp_mul_restartable() argument
2676 if( rs_ctx != NULL && rs_ctx->depth++ == 0 ) in mbedtls_ecp_mul_restartable()
2677 rs_ctx->ops_done = 0; in mbedtls_ecp_mul_restartable()
2679 (void) rs_ctx; in mbedtls_ecp_mul_restartable()
2689 if( rs_ctx == NULL || rs_ctx->rsm == NULL ) in mbedtls_ecp_mul_restartable()
2707 MBEDTLS_MPI_CHK( ecp_mul_comb( grp, R, m, P, f_rng, p_rng, rs_ctx ) ); in mbedtls_ecp_mul_restartable()
2718 if( rs_ctx != NULL ) in mbedtls_ecp_mul_restartable()
2719 rs_ctx->depth--; in mbedtls_ecp_mul_restartable()
2798 mbedtls_ecp_restart_ctx *rs_ctx ) in mbedtls_ecp_mul_shortcuts() argument
2819 NULL, NULL, rs_ctx ) ); in mbedtls_ecp_mul_shortcuts()
2834 mbedtls_ecp_restart_ctx *rs_ctx ) in mbedtls_ecp_muladd_restartable() argument
2858 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2861 pmP = &rs_ctx->ma->mP; in mbedtls_ecp_muladd_restartable()
2862 pR = &rs_ctx->ma->R; in mbedtls_ecp_muladd_restartable()
2865 if( rs_ctx->ma->state == ecp_rsma_mul2 ) in mbedtls_ecp_muladd_restartable()
2867 if( rs_ctx->ma->state == ecp_rsma_add ) in mbedtls_ecp_muladd_restartable()
2869 if( rs_ctx->ma->state == ecp_rsma_norm ) in mbedtls_ecp_muladd_restartable()
2874 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pmP, m, P, rs_ctx ) ); in mbedtls_ecp_muladd_restartable()
2876 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2877 rs_ctx->ma->state = ecp_rsma_mul2; in mbedtls_ecp_muladd_restartable()
2881 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pR, n, Q, rs_ctx ) ); in mbedtls_ecp_muladd_restartable()
2889 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2890 rs_ctx->ma->state = ecp_rsma_add; in mbedtls_ecp_muladd_restartable()
2897 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()
2898 rs_ctx->ma->state = ecp_rsma_norm; in mbedtls_ecp_muladd_restartable()
2906 if( rs_ctx != NULL && rs_ctx->ma != NULL ) in mbedtls_ecp_muladd_restartable()