Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/scalar.h
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
/** Get the order of the group as a number. */ | /** Get the order of the group as a number. */ | ||||
static void secp256k1_scalar_order_get_num(secp256k1_num *r); | static void secp256k1_scalar_order_get_num(secp256k1_num *r); | ||||
#endif | #endif | ||||
/** Compare two scalars. */ | /** Compare two scalars. */ | ||||
static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b); | static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b); | ||||
#ifdef USE_ENDOMORPHISM | #ifdef USE_ENDOMORPHISM | ||||
/** Find r1 and r2 such that r1+r2*2^128 = a. */ | /** Find r1 and r2 such that r1+r2*2^128 = k. */ | ||||
static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a); | static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k); | ||||
/** Find r1 and r2 such that r1+r2*lambda = a, and r1 and r2 are maximum 128 bits long (see secp256k1_gej_mul_lambda). */ | /** Find r1 and r2 such that r1+r2*lambda = k, | ||||
static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a); | * where r1 and r2 or their negations are maximum 128 bits long (see secp256k1_ge_mul_lambda). */ | ||||
static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k); | |||||
#endif | #endif | ||||
/** Multiply a and b (without taking the modulus!), divide by 2**shift, and round to the nearest integer. Shift must be at least 256. */ | /** Multiply a and b (without taking the modulus!), divide by 2**shift, and round to the nearest integer. Shift must be at least 256. */ | ||||
static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift); | static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift); | ||||
/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. Both *r and *a must be initialized.*/ | /** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. Both *r and *a must be initialized.*/ | ||||
static void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag); | static void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag); | ||||
#endif /* SECP256K1_SCALAR_H */ | #endif /* SECP256K1_SCALAR_H */ |