mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-10-23 01:52:40 +03:00
bignum: gcd: improve comments
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
@@ -1849,9 +1849,9 @@ int mbedtls_mpi_gcd(mbedtls_mpi *G, const mbedtls_mpi *A, const mbedtls_mpi *B)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Make boths inputs odd by putting powers of 2 on the side */
|
||||
const size_t za = mbedtls_mpi_lsb(&TA);
|
||||
const size_t zb = mbedtls_mpi_lsb(&TB);
|
||||
|
||||
MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&TA, za));
|
||||
MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&TB, zb));
|
||||
|
||||
@@ -1861,6 +1861,7 @@ int mbedtls_mpi_gcd(mbedtls_mpi *G, const mbedtls_mpi *A, const mbedtls_mpi *B)
|
||||
|
||||
MBEDTLS_MPI_CHK(mbedtls_mpi_gcd_modinv_odd(G, NULL, &TA, &TB));
|
||||
|
||||
/* Re-inject the power of 2 we had previously put aside */
|
||||
size_t zg = za > zb ? zb : za; // zg = min(za, zb)
|
||||
MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(G, zg));
|
||||
|
||||
|
Reference in New Issue
Block a user