Workaround aliasing in Fp12[BLS12-377] inversion, fix #147

This commit is contained in:
Mamy André-Ratsimbazafy 2021-02-02 12:53:36 +01:00
parent 83dcd988b3
commit 2c5e12d5f8
No known key found for this signature in database
GPG Key ID: 7B88AD1FE79492E1
2 changed files with 8 additions and 7 deletions

View File

@ -48,11 +48,11 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
("tests/t_finite_fields_double_width.nim", false),
# Towers of extension fields
# ----------------------------------------------------------
# ("tests/t_fp2.nim", false),
("tests/t_fp2.nim", false),
("tests/t_fp2_sqrt.nim", false),
# ("tests/t_fp6_bn254_snarks.nim", false),
# ("tests/t_fp6_bls12_377.nim", false),
# ("tests/t_fp6_bls12_381.nim", false),
("tests/t_fp6_bn254_snarks.nim", false),
("tests/t_fp6_bls12_377.nim", false),
("tests/t_fp6_bls12_381.nim", false),
("tests/t_fp6_bw6_761.nim", false),
("tests/t_fp12_bn254_snarks.nim", false),
("tests/t_fp12_bls12_377.nim", false),
@ -60,8 +60,8 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
("tests/t_fp12_exponentiation.nim", false),
("tests/t_fp12_anti_regression.nim", false),
# ("tests/t_fp4_frobenius.nim", false),
# ("tests/t_fp6_frobenius.nim", false),
("tests/t_fp4_frobenius.nim", false),
("tests/t_fp6_frobenius.nim", false),
("tests/t_fp12_frobenius.nim", false),
# Elliptic curve arithmetic G1
# ----------------------------------------------------------

View File

@ -183,7 +183,8 @@ func inv*(r: var CubicExt, a: CubicExt) =
v3 += r.c1
v3 += r.c2
v3.inv(v3)
let t = v3 # TODO, support aliasing in all primitives
v3.inv(t)
# (a0 + a1 v + a2 v²)^-1 = (A + B v + C v²) / F
r.c0 *= v3