Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/scalar_impl.h
Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | #elif defined(USE_SCALAR_INV_NUM) | ||||
/* Verify that the inverse was computed correctly, without GMP code. */ | /* Verify that the inverse was computed correctly, without GMP code. */ | ||||
secp256k1_scalar_mul(&t, &t, r); | secp256k1_scalar_mul(&t, &t, r); | ||||
CHECK(secp256k1_scalar_is_one(&t)); | CHECK(secp256k1_scalar_is_one(&t)); | ||||
#else | #else | ||||
#error "Please select scalar inverse implementation" | #error "Please select scalar inverse implementation" | ||||
#endif | #endif | ||||
} | } | ||||
#ifdef USE_ENDOMORPHISM | |||||
/* These parameters are generated using sage/gen_exhaustive_groups.sage. */ | /* These parameters are generated using sage/gen_exhaustive_groups.sage. */ | ||||
#if defined(EXHAUSTIVE_TEST_ORDER) | #if defined(EXHAUSTIVE_TEST_ORDER) | ||||
# if EXHAUSTIVE_TEST_ORDER == 13 | # if EXHAUSTIVE_TEST_ORDER == 13 | ||||
# define EXHAUSTIVE_TEST_LAMBDA 9 | # define EXHAUSTIVE_TEST_LAMBDA 9 | ||||
# elif EXHAUSTIVE_TEST_ORDER == 199 | # elif EXHAUSTIVE_TEST_ORDER == 199 | ||||
# define EXHAUSTIVE_TEST_LAMBDA 92 | # define EXHAUSTIVE_TEST_LAMBDA 92 | ||||
# else | # else | ||||
# error No known lambda for the specified exhaustive test group order. | # error No known lambda for the specified exhaustive test group order. | ||||
▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k) { | ||||
secp256k1_scalar_negate(r1, r1); | secp256k1_scalar_negate(r1, r1); | ||||
secp256k1_scalar_add(r1, r1, k); | secp256k1_scalar_add(r1, r1, k); | ||||
#ifdef VERIFY | #ifdef VERIFY | ||||
secp256k1_scalar_split_lambda_verify(r1, r2, k); | secp256k1_scalar_split_lambda_verify(r1, r2, k); | ||||
#endif | #endif | ||||
} | } | ||||
#endif | #endif | ||||
#endif | |||||
#endif /* SECP256K1_SCALAR_IMPL_H */ | #endif /* SECP256K1_SCALAR_IMPL_H */ |