Use mbedtls_ct_mpi_uint_mask() rather than rolling our own
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
818d992cc7
commit
2701deaa4b
1 changed files with 2 additions and 13 deletions
|
@ -300,19 +300,8 @@ mbedtls_mpi_uint mbedtls_mpi_core_add_if( mbedtls_mpi_uint *A,
|
||||||
{
|
{
|
||||||
mbedtls_mpi_uint c = 0;
|
mbedtls_mpi_uint c = 0;
|
||||||
|
|
||||||
/* MSVC has a warning about unary minus on unsigned integer types,
|
/* all-bits 0 if cond is 0, all-bits 1 if cond is non-0 */
|
||||||
* but this is well-defined and precisely what we want to do here. */
|
const mbedtls_mpi_uint mask = mbedtls_ct_mpi_uint_mask( cond );
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning( push )
|
|
||||||
#pragma warning( disable : 4146 )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* all-bits 1 if cond is 1, all-bits 0 if cond is 0 */
|
|
||||||
const mbedtls_mpi_uint mask = -(mbedtls_mpi_uint)cond;
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning( pop )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for( size_t i = 0; i < limbs; i++ )
|
for( size_t i = 0; i < limbs; i++ )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue