Skip to content

Commit

Permalink
Correct capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
K1li4nL committed Feb 20, 2024
1 parent 1b4e3c2 commit 5475365
Show file tree
Hide file tree
Showing 17 changed files with 447 additions and 447 deletions.
18 changes: 8 additions & 10 deletions group/curve25519/curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ func (c *curve) decodePoint(bb []byte, x, y *mod.Int) error {
//
// Returns true on success,
// false if there is no x-coordinate corresponding to the chosen y-coordinate.
//
func (c *curve) solveForX(x, y *mod.Int) bool {
var yy, t1, t2 mod.Int

Expand All @@ -254,7 +253,6 @@ func (c *curve) solveForX(x, y *mod.Int) bool {
// by checking the characteristic equation for Edwards curves:
//
// a*x^2 + y^2 = 1 + d*x^2*y^2
//
func (c *curve) onCurve(x, y *mod.Int) bool {
var xx, yy, l, r mod.Int

Expand All @@ -269,17 +267,17 @@ func (c *curve) onCurve(x, y *mod.Int) bool {

// Sanity-check a point to ensure that it is on the curve
// and within the appropriate subgroup.
func (c *curve) validPoint(P point) bool {
func (c *curve) validPoint(p point) bool {

// Check on-curve
x, y := P.getXY()
x, y := p.getXY()
if !c.onCurve(x, y) {
return false
}

// Check in-subgroup by multiplying by subgroup order
Q := c.self.Point()
Q.Mul(&c.order, P)
Q.Mul(&c.order, p)
if !Q.Equal(c.null) {
return false
}
Expand All @@ -297,7 +295,7 @@ func (c *curve) embedLen() int {

// Pick a [pseudo-]random curve point with optional embedded data,
// filling in the point's x,y coordinates
func (c *curve) embed(P point, data []byte, rand cipher.Stream) {
func (c *curve) embed(p point, data []byte, rand cipher.Stream) {

// How much data to embed?
dl := c.embedLen()
Expand Down Expand Up @@ -336,7 +334,7 @@ func (c *curve) embed(P point, data []byte, rand cipher.Stream) {
}

// Initialize the point
P.initXY(&x.V, &y.V, c.self)
p.initXY(&x.V, &y.V, c.self)
if c.full {
// If we're using the full group,
// we just need any point on the curve, so we're done.
Expand All @@ -349,8 +347,8 @@ func (c *curve) embed(P point, data []byte, rand cipher.Stream) {
// we can convert our point into one in the subgroup
// simply by multiplying it by the cofactor.
if data == nil {
P.Mul(&c.cofact, P) // multiply by cofactor
if P.Equal(c.null) {
p.Mul(&c.cofact, p) // multiply by cofactor
if p.Equal(c.null) {
continue // unlucky; try again
}
return
Expand All @@ -362,7 +360,7 @@ func (c *curve) embed(P point, data []byte, rand cipher.Stream) {
if Q == nil {
Q = c.self.Point()
}
Q.Mul(&c.order, P)
Q.Mul(&c.order, p)
if Q.Equal(c.null) {
return
}
Expand Down
Loading

0 comments on commit 5475365

Please sign in to comment.