Introduce SECP256K1_B macro for curve b coefficient
This commit is contained in:
parent
4934aa7995
commit
ce60785b26
|
@ -96,10 +96,7 @@ def output_generator(g, name):
|
||||||
print(")")
|
print(")")
|
||||||
|
|
||||||
def output_b(b):
|
def output_b(b):
|
||||||
print("static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(")
|
print(f"#define SECP256K1_B {int(b)}")
|
||||||
print(" 0x%08x, 0x%08x, 0x%08x, 0x%08x," % tuple((int(b) >> (32 * (7 - i))) & 0xffffffff for i in range(4)))
|
|
||||||
print(" 0x%08x, 0x%08x, 0x%08x, 0x%08x" % tuple((int(b) >> (32 * (7 - i))) & 0xffffffff for i in range(4, 8)))
|
|
||||||
print(");")
|
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print("To be put in src/group_impl.h:")
|
print("To be put in src/group_impl.h:")
|
||||||
|
@ -128,7 +125,6 @@ for f in sorted(solutions.keys()):
|
||||||
first = False
|
first = False
|
||||||
print()
|
print()
|
||||||
print(f"static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_{f};")
|
print(f"static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_{f};")
|
||||||
print("")
|
|
||||||
output_b(b)
|
output_b(b)
|
||||||
print()
|
print()
|
||||||
print("# else")
|
print("# else")
|
||||||
|
@ -137,7 +133,6 @@ print("# endif")
|
||||||
print("#else")
|
print("#else")
|
||||||
print()
|
print()
|
||||||
print("static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G;")
|
print("static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G;")
|
||||||
print("")
|
|
||||||
output_b(7)
|
output_b(7)
|
||||||
print()
|
print()
|
||||||
print("#endif")
|
print("#endif")
|
||||||
|
|
|
@ -49,29 +49,17 @@
|
||||||
# if EXHAUSTIVE_TEST_ORDER == 7
|
# if EXHAUSTIVE_TEST_ORDER == 7
|
||||||
|
|
||||||
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_7;
|
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_7;
|
||||||
|
#define SECP256K1_B 6
|
||||||
static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000006
|
|
||||||
);
|
|
||||||
|
|
||||||
# elif EXHAUSTIVE_TEST_ORDER == 13
|
# elif EXHAUSTIVE_TEST_ORDER == 13
|
||||||
|
|
||||||
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_13;
|
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_13;
|
||||||
|
#define SECP256K1_B 2
|
||||||
static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000002
|
|
||||||
);
|
|
||||||
|
|
||||||
# elif EXHAUSTIVE_TEST_ORDER == 199
|
# elif EXHAUSTIVE_TEST_ORDER == 199
|
||||||
|
|
||||||
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_199;
|
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_199;
|
||||||
|
#define SECP256K1_B 4
|
||||||
static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000004
|
|
||||||
);
|
|
||||||
|
|
||||||
# else
|
# else
|
||||||
# error No known generator for the specified exhaustive test group order.
|
# error No known generator for the specified exhaustive test group order.
|
||||||
|
@ -79,15 +67,13 @@ static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G;
|
static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G;
|
||||||
|
#define SECP256K1_B 7
|
||||||
static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000007
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* End of section generated by sage/gen_exhaustive_groups.sage. */
|
/* End of section generated by sage/gen_exhaustive_groups.sage. */
|
||||||
|
|
||||||
|
static const secp256k1_fe secp256k1_fe_const_b = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, SECP256K1_B);
|
||||||
|
|
||||||
static void secp256k1_ge_set_gej_zinv(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zi) {
|
static void secp256k1_ge_set_gej_zinv(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zi) {
|
||||||
secp256k1_fe zi2;
|
secp256k1_fe zi2;
|
||||||
secp256k1_fe zi3;
|
secp256k1_fe zi3;
|
||||||
|
|
Loading…
Reference in New Issue