Lines Matching defs:TB

1196     mbedtls_mpi TA, TB;
1200 mbedtls_mpi_init(&TB);
1206 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&TB, B)); B = &TB;
1244 mbedtls_mpi_free(&TB); mbedtls_mpi_free(&TA);
1730 mbedtls_mpi TA, TB;
1732 mbedtls_mpi_init(&TA); mbedtls_mpi_init(&TB);
1735 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&TB, B));
1738 lzt = mbedtls_mpi_lsb(&TB);
1744 if (lzt == 0 && mbedtls_mpi_get_bit(&TB, 0) == 0) {
1753 TA.s = TB.s = 1;
1759 * - The procedure in HAC assumes that 0 < TB <= TA.
1760 * - The condition TB <= TA is not actually necessary for correctness.
1761 * TA and TB have symmetric roles except for the loop termination
1763 * remove any significance from the ordering of TA vs TB before
1766 * correctly TB.
1767 * - The case TB = 0 was short-circuited above.
1776 * At the beginning, we have TA = |A| and TB = |B| so gcd(A,B) = gcd(TA,TB).
1778 * gcd(A,B) = 2^k * gcd(TA,TB) for some k (I)
1783 * value and the nonnegative integer bitlen(TA) + bitlen(TB) decreases
1785 * TA becomes 0 which ends the loop (TB cannot be 0 if it is right-shifted
1786 * since in that case TB is calculated from TB-TA with the condition TB>TA).
1791 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&TB, mbedtls_mpi_lsb(&TB)));
1793 /* Set either TA or TB to |TA-TB|/2. Since TA and TB are both odd,
1794 * TA-TB is even so the division by 2 has an integer result.
1795 * Invariant (I) is preserved since any odd divisor of both TA and TB
1796 * also divides |TA-TB|/2, and any odd divisor of both TA and |TA-TB|/2
1797 * also divides TB, and any odd divisor of both TB and |TA-TB|/2 also
1800 if (mbedtls_mpi_cmp_mpi(&TA, &TB) >= 0) {
1801 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs(&TA, &TA, &TB));
1804 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs(&TB, &TB, &TA));
1805 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&TB, 1));
1807 /* Note that one of TA or TB is still odd. */
1810 /* By invariant (I), gcd(A,B) = 2^k * gcd(TA,TB) for some k.
1811 * At the loop exit, TA = 0, so gcd(TA,TB) = TB.
1812 * - If there was at least one loop iteration, then one of TA or TB is odd,
1813 * and TA = 0, so TB is odd and gcd(TA,TB) = gcd(A',B'). In this case,
1814 * lz = min(a,b) so gcd(A,B) = 2^lz * TB.
1816 * In this case, lz = 0 and B = TB so gcd(A,B) = B = 2^lz * TB as well.
1819 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(&TB, lz));
1820 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(G, &TB));
1824 mbedtls_mpi_free(&TA); mbedtls_mpi_free(&TB);
1884 mbedtls_mpi G, TA, TU, U1, U2, TB, TV, V1, V2;
1891 mbedtls_mpi_init(&G); mbedtls_mpi_init(&TB); mbedtls_mpi_init(&TV);
1903 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&TB, N));
1916 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&U1, &U1, &TB));
1928 MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&V1, &V1, &TB));
1960 mbedtls_mpi_free(&G); mbedtls_mpi_free(&TB); mbedtls_mpi_free(&TV);