mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 15:55:37 +01:00
mbedtls_mpi_gcd: small optimization
Shifting TA and TB before the loop is not necessary. If A != 0, it will be done at the start of the loop iteration. If A == 0, then lz==0 and G is correctly set to B after 0 loop iterations. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
b5e56ec5fd
commit
c86acc5434
@ -2404,9 +2404,6 @@ int mbedtls_mpi_gcd( mbedtls_mpi *G, const mbedtls_mpi *A, const mbedtls_mpi *B
|
||||
if( lzt < lz )
|
||||
lz = lzt;
|
||||
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &TA, lz ) );
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &TB, lz ) );
|
||||
|
||||
TA.s = TB.s = 1;
|
||||
|
||||
while( mbedtls_mpi_cmp_int( &TA, 0 ) != 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user