2
0
Эх сурвалжийг харах

fixed bug of storing result in the wrong temp variable

Steffen Jaeckel 15 жил өмнө
parent
commit
8ec7d281d8

+ 2 - 2
src/pk/ecc/ltc_ecc_projective_dbl_point.c

@@ -60,12 +60,12 @@ int ltc_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulus, void
    /* T2 = 2T1 */
    if ((err = mp_add(t1, t1, t2)) != CRYPT_OK)                                    { goto done; }
    if (mp_cmp(t2, modulus) != LTC_MP_LT) {
-     if ((err = mp_sub(t2, modulus, t1)) != CRYPT_OK)                             { goto done; }
+     if ((err = mp_sub(t2, modulus, t2)) != CRYPT_OK)                             { goto done; }
    }
    /* T2 = T2 + T1 */
    if ((err = mp_add(t1, t2, t2)) != CRYPT_OK)                                    { goto done; }
    if (mp_cmp(t2, modulus) != LTC_MP_LT) {
-     if ((err = mp_sub(t2, modulus, t1)) != CRYPT_OK)                             { goto done; }
+     if ((err = mp_sub(t2, modulus, t2)) != CRYPT_OK)                             { goto done; }
    }
    if (mp_iszero(a)) {
       /* T1 = T2 */