Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/scalar_4x64_impl.h
Show First 20 Lines • Show All 906 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { | static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { | ||||
uint64_t l[8]; | uint64_t l[8]; | ||||
secp256k1_scalar_sqr_512(l, a); | secp256k1_scalar_sqr_512(l, a); | ||||
secp256k1_scalar_reduce_512(r, l); | secp256k1_scalar_reduce_512(r, l); | ||||
} | } | ||||
#ifdef USE_ENDOMORPHISM | |||||
static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k) { | static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k) { | ||||
r1->d[0] = k->d[0]; | r1->d[0] = k->d[0]; | ||||
r1->d[1] = k->d[1]; | r1->d[1] = k->d[1]; | ||||
r1->d[2] = 0; | r1->d[2] = 0; | ||||
r1->d[3] = 0; | r1->d[3] = 0; | ||||
r2->d[0] = k->d[2]; | r2->d[0] = k->d[2]; | ||||
r2->d[1] = k->d[3]; | r2->d[1] = k->d[3]; | ||||
r2->d[2] = 0; | r2->d[2] = 0; | ||||
r2->d[3] = 0; | r2->d[3] = 0; | ||||
} | } | ||||
#endif | |||||
SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { | SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { | ||||
return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3])) == 0; | return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3])) == 0; | ||||
} | } | ||||
SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) { | SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) { | ||||
uint64_t l[8]; | uint64_t l[8]; | ||||
unsigned int shiftlimbs; | unsigned int shiftlimbs; | ||||
Show All 26 Lines |