mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
Change to positive checks
1. Checge to check for `MBEDTLS_ECP_RESTARTABLE` for all definitions of `rs_ctx`. 2. Remove checks for `_ALT` when using `rs_ctx` as they cannot coexist with the Restartable configuration.
This commit is contained in:
parent
19779c4739
commit
b430d9f262
@ -212,7 +212,7 @@ int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
|
|||||||
if( ( ret = ecdh_gen_public_restartable( &ctx->grp, &ctx->d, &ctx->Q,
|
if( ( ret = ecdh_gen_public_restartable( &ctx->grp, &ctx->d, &ctx->Q,
|
||||||
f_rng, p_rng, rs_ctx ) ) != 0 )
|
f_rng, p_rng, rs_ctx ) ) != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
#endif /* MBEDTLS_ECDH_GEN_PUBLIC_ALT */
|
#endif /* !MBEDTLS_ECDH_GEN_PUBLIC_ALT */
|
||||||
|
|
||||||
if( ( ret = mbedtls_ecp_tls_write_group( &ctx->grp, &grp_len, buf, blen ) )
|
if( ( ret = mbedtls_ecp_tls_write_group( &ctx->grp, &grp_len, buf, blen ) )
|
||||||
!= 0 )
|
!= 0 )
|
||||||
@ -286,14 +286,14 @@ int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
|
|||||||
void *p_rng )
|
void *p_rng )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
#if !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
mbedtls_ecp_restart_ctx *rs_ctx = NULL;
|
mbedtls_ecp_restart_ctx *rs_ctx = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( ctx == NULL || ctx->grp.pbits == 0 )
|
if( ctx == NULL || ctx->grp.pbits == 0 )
|
||||||
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_RESTARTABLE) && !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
if( ctx->restart_enabled )
|
if( ctx->restart_enabled )
|
||||||
rs_ctx = &ctx->rs;
|
rs_ctx = &ctx->rs;
|
||||||
#endif
|
#endif
|
||||||
@ -342,14 +342,14 @@ int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
|
|||||||
void *p_rng )
|
void *p_rng )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
#if !defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
mbedtls_ecp_restart_ctx *rs_ctx = NULL;
|
mbedtls_ecp_restart_ctx *rs_ctx = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( ctx == NULL || ctx->grp.pbits == 0 )
|
if( ctx == NULL || ctx->grp.pbits == 0 )
|
||||||
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_RESTARTABLE) && !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
if( ctx->restart_enabled )
|
if( ctx->restart_enabled )
|
||||||
rs_ctx = &ctx->rs;
|
rs_ctx = &ctx->rs;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user