Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Sep 10, 2024
1 parent e7ade5f commit d31d15e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion vlib/crypto/ed25519/internal/edwards25519/element.v
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ pub fn (mut v Element) pow_22523(x Element) Element {
for i := 1; i < 100; i++ { // 2^200 - 2^100
t2.square(t2)
}
t1.multiply(t2, &t1) // 2^200 - 1
t1.multiply(t2, t1) // 2^200 - 1
t1.square(t1) // 2^201 - 2
for i := 1; i < 50; i++ { // 2^250 - 2^50
t1.square(t1)
Expand Down
2 changes: 1 addition & 1 deletion vlib/crypto/ed25519/internal/edwards25519/extra.v
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn (mut v Point) bytes_montgomery_generic(mut buf [32]u8) []u8 {
mut u := Element{}

y.multiply(v.y, y.invert(v.z)) // y = Y / Z
recip.invert(recip.subtract(fe_one, &y)) // r = 1/(1 - y)
recip.invert(recip.subtract(fe_one, y)) // r = 1/(1 - y)
u.multiply(u.add(fe_one, y), recip) // u = (1 + y)*r

return copy_field_element(mut buf, mut u)
Expand Down
8 changes: 4 additions & 4 deletions vlib/crypto/ed25519/internal/edwards25519/point.v
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ fn (mut v ProjectiveP1) sub(p Point, q ProjectiveCached) ProjectiveP1 {
ypx.add(p.y, p.x)
ymx.subtract(p.y, p.x)

pp.multiply(&ypx, q.ymx) // flipped sign
mm.multiply(&ymx, q.ypx) // flipped sign
pp.multiply(ypx, q.ymx) // flipped sign
mm.multiply(ymx, q.ypx) // flipped sign
tt2d.multiply(p.t, q.t2d)
zz2.multiply(p.z, q.z)

Expand All @@ -378,8 +378,8 @@ fn (mut v ProjectiveP1) add_affine(p Point, q AffineCached) ProjectiveP1 {
ypx.add(p.y, p.x)
ymx.subtract(p.y, p.x)

pp.multiply(&ypx, q.ypx)
mm.multiply(&ymx, q.ymx)
pp.multiply(ypx, q.ypx)
mm.multiply(ymx, q.ymx)
tt2d.multiply(p.t, q.t2d)

z2.add(p.z, p.z)
Expand Down
2 changes: 1 addition & 1 deletion vlib/crypto/ed25519/internal/edwards25519/table.v
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn (mut v ProjLookupTable) select_into(mut dest ProjectiveCached, x i8) {
for j := 1; j <= 8; j++ {
// Set dest = j*Q if |x| = j
cond := subtle.constant_time_byte_eq(xabs, u8(j))
dest.selected(&v.points[j - 1], dest, cond)
dest.selected(v.points[j - 1], dest, cond)
}
// Now dest = |x|*Q, conditionally negate to get x*Q
dest.cond_neg(int(xmask & 1))
Expand Down

0 comments on commit d31d15e

Please sign in to comment.