diff --git a/library/bignum.c b/library/bignum.c index e8d91631eb..30a30dd925 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -130,7 +130,7 @@ int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X, mbedtls_ct_condition_t do_assign = mbedtls_ct_bool(assign); - X->s = (int) mbedtls_ct_uint_if_new(do_assign, Y->s, X->s); + X->s = (int) mbedtls_ct_uint_if(do_assign, Y->s, X->s); mbedtls_mpi_core_cond_assign(X->p, Y->p, Y->n, do_assign); @@ -168,8 +168,8 @@ int mbedtls_mpi_safe_cond_swap(mbedtls_mpi *X, MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Y, X->n)); s = X->s; - X->s = (int) mbedtls_ct_uint_if_new(do_swap, Y->s, X->s); - Y->s = (int) mbedtls_ct_uint_if_new(do_swap, s, Y->s); + X->s = (int) mbedtls_ct_uint_if(do_swap, Y->s, X->s); + Y->s = (int) mbedtls_ct_uint_if(do_swap, s, Y->s); mbedtls_mpi_core_cond_swap(X->p, Y->p, X->n, do_swap); diff --git a/library/constant_time.c b/library/constant_time.c index c86316b008..e11d88e6b8 100644 --- a/library/constant_time.c +++ b/library/constant_time.c @@ -126,7 +126,7 @@ void mbedtls_ct_memmove_left(void *start, size_t total, size_t offset) for (size_t n = 0; n < total - 1; n++) { unsigned char current = buf[n]; unsigned char next = buf[n+1]; - buf[n] = mbedtls_ct_uint_if_new(no_op, current, next); + buf[n] = mbedtls_ct_uint_if(no_op, current, next); } buf[total-1] = mbedtls_ct_uint_if0(no_op, buf[total-1]); } diff --git a/library/constant_time_impl.h b/library/constant_time_impl.h index 149cf75068..b73f92ee92 100644 --- a/library/constant_time_impl.h +++ b/library/constant_time_impl.h @@ -191,7 +191,7 @@ static inline size_t mbedtls_ct_size_if(mbedtls_ct_condition_t condition, return (size_t) mbedtls_ct_if(condition, (mbedtls_ct_uint_t) if1, (mbedtls_ct_uint_t) if0); } -static inline unsigned mbedtls_ct_uint_if_new(mbedtls_ct_condition_t condition, +static inline unsigned mbedtls_ct_uint_if(mbedtls_ct_condition_t condition, unsigned if1, unsigned if0) { diff --git a/library/constant_time_internal.h b/library/constant_time_internal.h index 362b822a41..09de92f173 100644 --- a/library/constant_time_internal.h +++ b/library/constant_time_internal.h @@ -285,7 +285,7 @@ static inline size_t mbedtls_ct_size_if(mbedtls_ct_condition_t condition, * * \return \c if1 if \p condition == MBEDTLS_CT_TRUE, otherwise \c if0. */ -static inline unsigned mbedtls_ct_uint_if_new(mbedtls_ct_condition_t condition, +static inline unsigned mbedtls_ct_uint_if(mbedtls_ct_condition_t condition, unsigned if1, unsigned if0); diff --git a/library/rsa.c b/library/rsa.c index 9d67ef7d94..44ff3d2c0a 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -144,7 +144,7 @@ static int mbedtls_ct_rsaes_pkcs1_v15_unpadding(unsigned char *input, * buffer. Do it without branches to avoid leaking the padding * validity through timing. RSA keys are small enough that all the * size_t values involved fit in unsigned int. */ - plaintext_size = mbedtls_ct_uint_if_new( + plaintext_size = mbedtls_ct_uint_if( bad, (unsigned) plaintext_max_size, (unsigned) (ilen - pad_count - 3)); @@ -158,7 +158,7 @@ static int mbedtls_ct_rsaes_pkcs1_v15_unpadding(unsigned char *input, * - OUTPUT_TOO_LARGE if the padding is good but the decrypted * plaintext does not fit in the output buffer. * - 0 if the padding is correct. */ - ret = -(int) mbedtls_ct_uint_if_new( + ret = -(int) mbedtls_ct_uint_if( bad, (unsigned) (-(MBEDTLS_ERR_RSA_INVALID_PADDING)), mbedtls_ct_uint_if0( @@ -178,7 +178,7 @@ static int mbedtls_ct_rsaes_pkcs1_v15_unpadding(unsigned char *input, * Copy anyway to avoid revealing the length through timing, because * revealing the length is as bad as revealing the padding validity * for a Bleichenbacher attack. */ - plaintext_size = mbedtls_ct_uint_if_new(output_too_large, + plaintext_size = mbedtls_ct_uint_if(output_too_large, (unsigned) plaintext_max_size, (unsigned) plaintext_size);