Implement current magnitude assumptions

Remove also the explicit magnitude restriction `a->x.magnitude <= 31`
in `secp256k1_gej_eq_x_var` (introduced in commit
07c0e8b82e), as this is implied by the
new limits.

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
This commit is contained in:
Peter Dettman
2021-12-05 16:27:56 +07:00
committed by Sebastian Falbesoner
parent 49afd2f5d8
commit 173e8d061a
2 changed files with 13 additions and 1 deletions

View File

@@ -44,6 +44,14 @@ typedef struct {
#define SECP256K1_GE_STORAGE_CONST_GET(t) SECP256K1_FE_STORAGE_CONST_GET(t.x), SECP256K1_FE_STORAGE_CONST_GET(t.y)
/** Maximum allowed magnitudes for group element coordinates
* in affine (x, y) and jacobian (x, y, z) representation. */
#define SECP256K1_GE_X_MAGNITUDE_MAX 8
#define SECP256K1_GE_Y_MAGNITUDE_MAX 8
#define SECP256K1_GEJ_X_MAGNITUDE_MAX 8
#define SECP256K1_GEJ_Y_MAGNITUDE_MAX 8
#define SECP256K1_GEJ_Z_MAGNITUDE_MAX 8
/** Set a group element equal to the point with given X and Y coordinates */
static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y);