Sub subtracts y from x, storing the result in z and returning that. Any or all of x, y, and z may be the same pointers.
(x, y *Point)
| 28 | // Sub subtracts y from x, storing the result in z and |
| 29 | // returning that. Any or all of x, y, and z may be the same pointers. |
| 30 | func (z *Point) Sub(x, y *Point) *Point { |
| 31 | var y2 edwards25519.CachedGroupElement |
| 32 | (*edwards25519.ExtendedGroupElement)(y).ToCached(&y2) |
| 33 | |
| 34 | var z2 edwards25519.CompletedGroupElement |
| 35 | edwards25519.GeSub(&z2, (*edwards25519.ExtendedGroupElement)(x), &y2) |
| 36 | |
| 37 | z2.ToExtended((*edwards25519.ExtendedGroupElement)(z)) |
| 38 | return z |
| 39 | } |
| 40 | |
| 41 | // ScMul multiplies the EC point x by the scalar y, placing the result |
| 42 | // in z and returning that. X and z may be the same pointer. |