Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/group.h
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a); | static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a); | ||||
/** Check whether a group element is the point at infinity. */ | /** Check whether a group element is the point at infinity. */ | ||||
static int secp256k1_gej_is_infinity(const secp256k1_gej *a); | static int secp256k1_gej_is_infinity(const secp256k1_gej *a); | ||||
/** Check whether a group element's y coordinate is a quadratic residue. */ | /** Check whether a group element's y coordinate is a quadratic residue. */ | ||||
static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a); | static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a); | ||||
/** Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). | /** Set r equal to the double of a, a cannot be infinity. Constant time. */ | ||||
* a may not be zero. Constant time. */ | static void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a); | ||||
static void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); | |||||
/** Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). */ | /** Set r equal to the double of a. If rzr is not-NULL this sets *rzr such that r->z == a->z * *rzr (where infinity means an implicit z = 0). */ | ||||
static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); | static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); | ||||
/** Set r equal to the sum of a and b. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case). */ | /** Set r equal to the sum of a and b. If rzr is non-NULL this sets *rzr such that r->z == a->z * *rzr (a cannot be infinity in that case). */ | ||||
static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr); | static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr); | ||||
/** Set r equal to the sum of a and b (with b given in affine coordinates, and not infinity). */ | /** Set r equal to the sum of a and b (with b given in affine coordinates, and not infinity). */ | ||||
static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b); | static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b); | ||||
/** Set r equal to the sum of a and b (with b given in affine coordinates). This is more efficient | /** Set r equal to the sum of a and b (with b given in affine coordinates). This is more efficient | ||||
than secp256k1_gej_add_var. It is identical to secp256k1_gej_add_ge but without constant-time | than secp256k1_gej_add_var. It is identical to secp256k1_gej_add_ge but without constant-time | ||||
guarantee, and b is allowed to be infinity. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case). */ | guarantee, and b is allowed to be infinity. If rzr is non-NULL this sets *rzr such that r->z == a->z * *rzr (a cannot be infinity in that case). */ | ||||
static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr); | static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr); | ||||
/** Set r equal to the sum of a and b (with the inverse of b's Z coordinate passed as bzinv). */ | /** Set r equal to the sum of a and b (with the inverse of b's Z coordinate passed as bzinv). */ | ||||
static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv); | static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv); | ||||
#ifdef USE_ENDOMORPHISM | #ifdef USE_ENDOMORPHISM | ||||
/** Set r to be equal to lambda times a, where lambda is chosen in a way such that this is very fast. */ | /** Set r to be equal to lambda times a, where lambda is chosen in a way such that this is very fast. */ | ||||
static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a); | static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a); | ||||
Show All 21 Lines |