Skip to content

Commit

Permalink
gt: fix exponentiation by 1 and GT torus conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mratsim committed Oct 23, 2024
1 parent 054c292 commit 987080e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions constantine/math/io/io_extfields.nim
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func fromHex*(T: typedesc[Fp6],
## Convert 6 coordinates to an element of 𝔽p6
result.fromHex(c0, c1, c2, c3, c4, c5)

func fromHex*(dst: var Fp12,
func fromHex*(dst: var AnyFp12,
c0, c1, c2, c3: string,
c4, c5, c6, c7: string,
c8, c9, c10, c11: string) =
Expand All @@ -104,7 +104,7 @@ func fromHex*(dst: var Fp12,
dst.c1.fromHex(c4, c5, c6, c7)
dst.c2.fromHex(c8, c9, c10, c11)

func fromHex*(T: typedesc[Fp12],
func fromHex*(T: typedesc[AnyFp12],
c0, c1, c2, c3: string,
c4, c5, c6, c7: string,
c8, c9, c10, c11: string): T =
Expand Down
2 changes: 1 addition & 1 deletion constantine/math/pairings/gt_exponentiations_vartime.nim
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func gtExp_addchain_4bit_vartime[Gt: ExtensionField](r: var Gt, a: Gt, scalar: B
of 0:
r.setOne()
of 1:
discard
r = a
of 2:
r.cyclotomic_square(a)
of 3:
Expand Down
2 changes: 1 addition & 1 deletion constantine/math/pairings/gt_prj.nim
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ proc isNeutral*(a: T2Prj): SecretBool =

proc fromGT_vartime*[F](r: var T2Aff[F], a: QuadraticExt[F]) =
# Special case identity element
if bool a.isNeutral():
if bool a.isOne():
r.setNeutral()
return

Expand Down

0 comments on commit 987080e

Please sign in to comment.