Skip to content

Commit

Permalink
Removing non-used fp functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Jul 24, 2020
1 parent d4fc865 commit c72bdfa
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions math/fp448/fp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package fp448

import (
"crypto/subtle"
"errors"

"github.com/cloudflare/circl/internal/conv"
Expand All @@ -26,15 +25,6 @@ var p = Elt{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
}
var pMinusOneDivTwo = Elt{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
}

// P returns the prime modulus 2^448-2^224-1.
func P() Elt { return p }
Expand All @@ -58,23 +48,6 @@ func IsOne(x *Elt) bool { Modp(x); return *x == Elt{1} }
// Parity returns the last bit of x.
func Parity(x *Elt) int { Modp(x); return int(x[0] & 1) }

func isLEQ(x, y *Elt) int {
i := Size - 1
for i > 0 && x[i] == y[i] {
i--
}
return subtle.ConstantTimeLessOrEq(int(x[i]), int(y[i]))
}

// Abs returns |x| where |x| = x if 0 <= x <= (p-1)/2; otherwise |x|=-x mod p.
func Abs(x *Elt) {
var y Elt
Modp(x)
Neg(&y, x)
b := isLEQ(x, &pMinusOneDivTwo)
Cmov(x, &y, uint(1-b))
}

// SetOne assigns x=1.
func SetOne(x *Elt) { *x = Elt{1} }

Expand Down

0 comments on commit c72bdfa

Please sign in to comment.