Skip to content

Commit 2c5e12d

Browse files
committed
Workaround aliasing in Fp12[BLS12-377] inversion, fix #147
1 parent 83dcd98 commit 2c5e12d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

constantine.nimble

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
4848
("tests/t_finite_fields_double_width.nim", false),
4949
# Towers of extension fields
5050
# ----------------------------------------------------------
51-
# ("tests/t_fp2.nim", false),
51+
("tests/t_fp2.nim", false),
5252
("tests/t_fp2_sqrt.nim", false),
53-
# ("tests/t_fp6_bn254_snarks.nim", false),
54-
# ("tests/t_fp6_bls12_377.nim", false),
55-
# ("tests/t_fp6_bls12_381.nim", false),
53+
("tests/t_fp6_bn254_snarks.nim", false),
54+
("tests/t_fp6_bls12_377.nim", false),
55+
("tests/t_fp6_bls12_381.nim", false),
5656
("tests/t_fp6_bw6_761.nim", false),
5757
("tests/t_fp12_bn254_snarks.nim", false),
5858
("tests/t_fp12_bls12_377.nim", false),
5959
("tests/t_fp12_bls12_381.nim", false),
6060
("tests/t_fp12_exponentiation.nim", false),
6161
("tests/t_fp12_anti_regression.nim", false),
6262

63-
# ("tests/t_fp4_frobenius.nim", false),
64-
# ("tests/t_fp6_frobenius.nim", false),
63+
("tests/t_fp4_frobenius.nim", false),
64+
("tests/t_fp6_frobenius.nim", false),
6565
("tests/t_fp12_frobenius.nim", false),
6666
# Elliptic curve arithmetic G1
6767
# ----------------------------------------------------------

constantine/tower_field_extensions/cubic_extensions.nim

+2-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ func inv*(r: var CubicExt, a: CubicExt) =
183183
v3 += r.c1
184184
v3 += r.c2
185185

186-
v3.inv(v3)
186+
let t = v3 # TODO, support aliasing in all primitives
187+
v3.inv(t)
187188

188189
# (a0 + a1 v + a2 v²)^-1 = (A + B v + C v²) / F
189190
r.c0 *= v3

0 commit comments

Comments
 (0)