bug fixes for secp256k1

This commit is contained in:
NIIBE Yutaka
2014-02-21 17:24:19 +09:00
parent 2accc339e2
commit ede98fbe7e
7 changed files with 26 additions and 3 deletions

View File

@@ -47,12 +47,20 @@ FUNC(jpc_double) (jpc *X, const jpc *A)
MFNC(sqr) (b, b);
MFNC(shift) (b, b, 3);
#if defined(COEFFICIENT_A_IS_MINUS_3)
MFNC(sqr) (tmp0, A->z);
MFNC(sub) (c, A->x, tmp0);
MFNC(add) (tmp0, tmp0, A->x);
MFNC(mul) (tmp0, tmp0, c);
MFNC(shift) (c, tmp0, 1);
MFNC(add) (c, c, tmp0);
#elif defined (COEFFICIENT_A_IS_ZERO)
MFNC(sqr) (tmp0, A->x);
MFNC(shift) (c, tmp0, 1);
MFNC(add) (c, c, tmp0);
#else
#error "not supported."
#endif
MFNC(sqr) (d, c);
MFNC(shift) (tmp0, a, 1);