Lines Matching refs:rs_ctx

275                               mbedtls_ecp_restart_ctx *rs_ctx,  in mbedtls_ecp_check_budget()  argument
280 if( rs_ctx != NULL && ecp_max_ops != 0 ) in mbedtls_ecp_check_budget()
293 if( ( rs_ctx->ops_done != 0 ) && in mbedtls_ecp_check_budget()
294 ( rs_ctx->ops_done > ecp_max_ops || in mbedtls_ecp_check_budget()
295 ops > ecp_max_ops - rs_ctx->ops_done ) ) in mbedtls_ecp_check_budget()
301 rs_ctx->ops_done += ops; in mbedtls_ecp_check_budget()
310 if( rs_ctx != NULL && rs_ctx->depth++ == 0 ) \
311 rs_ctx->ops_done = 0; \
315 rs_ctx != NULL && rs_ctx->SUB == NULL ) \
317 rs_ctx->SUB = mbedtls_calloc( 1, sizeof( *rs_ctx->SUB ) ); \
318 if( rs_ctx->SUB == NULL ) \
321 ecp_restart_## SUB ##_init( rs_ctx->SUB ); \
328 if( rs_ctx != NULL && rs_ctx->SUB != NULL && \
331 ecp_restart_## SUB ##_free( rs_ctx->SUB ); \
332 mbedtls_free( rs_ctx->SUB ); \
333 rs_ctx->SUB = NULL; \
336 if( rs_ctx != NULL ) \
337 rs_ctx->depth--; \
342 #define ECP_RS_ENTER( sub ) (void) rs_ctx;
343 #define ECP_RS_LEAVE( sub ) (void) rs_ctx;
1613 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_precompute_comb() argument
1622 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1624 if( rs_ctx->rsm->state == ecp_rsm_pre_dbl ) in ecp_precompute_comb()
1626 if( rs_ctx->rsm->state == ecp_rsm_pre_norm_dbl ) in ecp_precompute_comb()
1628 if( rs_ctx->rsm->state == ecp_rsm_pre_add ) in ecp_precompute_comb()
1630 if( rs_ctx->rsm->state == ecp_rsm_pre_norm_add ) in ecp_precompute_comb()
1634 (void) rs_ctx; in ecp_precompute_comb()
1638 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1640 rs_ctx->rsm->state = ecp_rsm_pre_dbl; in ecp_precompute_comb()
1643 rs_ctx->rsm->i = 0; in ecp_precompute_comb()
1655 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0 ) in ecp_precompute_comb()
1656 j = rs_ctx->rsm->i; in ecp_precompute_comb()
1675 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1676 rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl; in ecp_precompute_comb()
1693 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1694 rs_ctx->rsm->state = ecp_rsm_pre_add; in ecp_precompute_comb()
1712 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_precompute_comb()
1713 rs_ctx->rsm->state = ecp_rsm_pre_norm_add; in ecp_precompute_comb()
1731 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_precompute_comb()
1734 if( rs_ctx->rsm->state == ecp_rsm_pre_dbl ) in ecp_precompute_comb()
1735 rs_ctx->rsm->i = j; in ecp_precompute_comb()
1782 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb_core() argument
1791 (void) rs_ctx; in ecp_mul_comb_core()
1795 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
1796 rs_ctx->rsm->state != ecp_rsm_comb_core ) in ecp_mul_comb_core()
1798 rs_ctx->rsm->i = 0; in ecp_mul_comb_core()
1799 rs_ctx->rsm->state = ecp_rsm_comb_core; in ecp_mul_comb_core()
1803 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->i != 0 ) in ecp_mul_comb_core()
1806 i = rs_ctx->rsm->i; in ecp_mul_comb_core()
1834 if( rs_ctx != NULL && rs_ctx->rsm != NULL && in ecp_mul_comb_core()
1837 rs_ctx->rsm->i = i; in ecp_mul_comb_core()
1908 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb_after_precomp() argument
1916 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
1918 RR = &rs_ctx->rsm->R; in ecp_mul_comb_after_precomp()
1920 if( rs_ctx->rsm->state == ecp_rsm_final_norm ) in ecp_mul_comb_after_precomp()
1928 f_rng, p_rng, rs_ctx ) ); in ecp_mul_comb_after_precomp()
1932 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
1933 rs_ctx->rsm->state = ecp_rsm_final_norm; in ecp_mul_comb_after_precomp()
1941 if( rs_ctx != NULL && rs_ctx->rsm != NULL ) in ecp_mul_comb_after_precomp()
2001 mbedtls_ecp_restart_ctx *rs_ctx ) in ecp_mul_comb() argument
2034 if( rs_ctx != NULL && rs_ctx->rsm != NULL && rs_ctx->rsm->T != NULL ) in ecp_mul_comb()
2037 T = rs_ctx->rsm->T; in ecp_mul_comb()
2038 rs_ctx->rsm->T = NULL; in ecp_mul_comb()
2039 rs_ctx->rsm->T_size = 0; in ecp_mul_comb()
2042 T_ok = rs_ctx->rsm->state >= ecp_rsm_comb_core; in ecp_mul_comb()
2064 MBEDTLS_MPI_CHK( ecp_precompute_comb( grp, T, P, w, d, rs_ctx ) ); in ecp_mul_comb()
2078 f_rng, p_rng, rs_ctx ) ); in ecp_mul_comb()
2088 if( rs_ctx != NULL && rs_ctx->rsm != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS && T != NULL ) in ecp_mul_comb()
2091 rs_ctx->rsm->T_size = T_size; in ecp_mul_comb()
2092 rs_ctx->rsm->T = T; in ecp_mul_comb()
2323 mbedtls_ecp_restart_ctx *rs_ctx )
2336 if( rs_ctx != NULL && rs_ctx->depth++ == 0 )
2337 rs_ctx->ops_done = 0;
2347 if( rs_ctx == NULL || rs_ctx->rsm == NULL )
2365 MBEDTLS_MPI_CHK( ecp_mul_comb( grp, R, m, P, f_rng, p_rng, rs_ctx ) );
2376 if( rs_ctx != NULL )
2377 rs_ctx->depth--;
2455 mbedtls_ecp_restart_ctx *rs_ctx )
2472 NULL, NULL, rs_ctx ) );
2487 mbedtls_ecp_restart_ctx *rs_ctx )
2511 if( rs_ctx != NULL && rs_ctx->ma != NULL )
2514 pmP = &rs_ctx->ma->mP;
2515 pR = &rs_ctx->ma->R;
2518 if( rs_ctx->ma->state == ecp_rsma_mul2 )
2520 if( rs_ctx->ma->state == ecp_rsma_add )
2522 if( rs_ctx->ma->state == ecp_rsma_norm )
2527 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pmP, m, P, rs_ctx ) );
2529 if( rs_ctx != NULL && rs_ctx->ma != NULL )
2530 rs_ctx->ma->state = ecp_rsma_mul2;
2534 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pR, n, Q, rs_ctx ) );
2542 if( rs_ctx != NULL && rs_ctx->ma != NULL )
2543 rs_ctx->ma->state = ecp_rsma_add;
2550 if( rs_ctx != NULL && rs_ctx->ma != NULL )
2551 rs_ctx->ma->state = ecp_rsma_norm;
2559 if( rs_ctx != NULL && rs_ctx->ma != NULL )