aboutsummaryrefslogtreecommitdiff
path: root/veto/veto.go
diff options
context:
space:
mode:
Diffstat (limited to 'veto/veto.go')
-rw-r--r--veto/veto.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/veto/veto.go b/veto/veto.go
index 6a64c82..2b164bc 100644
--- a/veto/veto.go
+++ b/veto/veto.go
@@ -83,7 +83,7 @@ func proof(x *Scalar, id *Point) (pr *Proof, e error) {
}
// Calculate r := v - x*h
- xh := x.Mult(h)
+ xh := x.Mul(h)
r := v.Sub(xh)
pr.Sr = r
@@ -130,7 +130,7 @@ func verifyProof(V *Point, Gx *Point, r *Scalar, id *Point) (ok bool) {
gr := Curve.Exp(r)
// Calculate g^r*g^(x*h)
- grgxh := gr.Mult(gxh)
+ grgxh := gr.Mul(gxh)
// Return true if g^v == g^r*g^(x*h)
return V.Equal(grgxh)
@@ -150,11 +150,16 @@ func newVoteWithRand(veto bool, rand io.Reader) (v *Vote, e error) {
veto: veto,
}
- v.private.id = Curve.RandomScalar()
- v.private.x = Curve.RandomScalar()
- v.private.r = Curve.RandomScalar()
+ var e1, e2, e3 error
- var e1, e2 error
+ v.private.id, e1 = Curve.ScalarFromReader(rand)
+ v.private.x, e2 = Curve.ScalarFromReader(rand)
+ v.private.r, e3 = Curve.ScalarFromReader(rand)
+
+ e = combineErr(e1, e2, e3)
+ if e != nil {
+ return nil, e
+ }
c := new(Commitment)
v.com = c
@@ -194,7 +199,7 @@ type coms []*Commitment
func (coms coms) prod() (product *Point) {
product = Curve.Identity()
for _, com := range coms {
- product = product.Mult(com.Points.X)
+ product = product.Mul(com.Points.X)
}
return product
}
@@ -204,7 +209,7 @@ func (coms coms) prod() (product *Point) {
func (coms coms) computeGy(index int) *Point {
gy1 := coms[:index].prod()
gy2 := coms[index+1:].prod().Inv()
- return gy1.Mult(gy2)
+ return gy1.Mul(gy2)
}
// Round2 implements the round 2 of the AV-Net protocol, where a participant
@@ -249,4 +254,4 @@ func (pts points) IsVetoed() bool {
product := Curve.Product(pts)
one := Curve.Identity()
return !one.Equal(product)
-} \ No newline at end of file
+}