Lines Matching defs:TA
1196 mbedtls_mpi TA, TB;
1199 mbedtls_mpi_init(&TA);
1203 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&TA, A)); A = &TA;
1244 mbedtls_mpi_free(&TB); mbedtls_mpi_free(&TA);
1730 mbedtls_mpi TA, TB;
1732 mbedtls_mpi_init(&TA); mbedtls_mpi_init(&TB);
1734 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&TA, A));
1737 lz = mbedtls_mpi_lsb(&TA);
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
1765 * - If TA = 0, the loop goes through 0 iterations and the result is
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).
1788 while (mbedtls_mpi_cmp_int(&TA, 0) != 0) {
1790 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&TA, mbedtls_mpi_lsb(&TA)));
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
1798 * divides TA.
1800 if (mbedtls_mpi_cmp_mpi(&TA, &TB) >= 0) {
1801 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs(&TA, &TA, &TB));
1802 MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&TA, 1));
1804 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_abs(&TB, &TB, &TA));
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,
1824 mbedtls_mpi_free(&TA); mbedtls_mpi_free(&TB);
1884 mbedtls_mpi G, TA, TU, U1, U2, TB, TV, V1, V2;
1890 mbedtls_mpi_init(&TA); mbedtls_mpi_init(&TU); mbedtls_mpi_init(&U1); mbedtls_mpi_init(&U2);
1901 MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&TA, A, N));
1902 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&TU, &TA));
1917 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&U2, &U2, &TA));
1929 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&V2, &V2, &TA));
1959 mbedtls_mpi_free(&TA); mbedtls_mpi_free(&TU); mbedtls_mpi_free(&U1); mbedtls_mpi_free(&U2);