|
- package p751toolbox
-
- import (
- . "github.com/cloudflare/p751sidh/internal/utils"
- )
-
- type context struct {
- xPA, xQA, xRA ProjectivePoint
- xPB, xQB, xRB ProjectivePoint
- xR ProjectivePoint
- curve ProjectiveCurveParameters
- }
-
- func (c *context) LoadBasePoints() {
- // Load points for A
- c.xPA.FromAffine(&P751_affine_PA)
- c.xPA.Z.One()
- c.xQA.FromAffine(&P751_affine_QA)
- c.xQA.Z.One()
- c.xRA.FromAffine(&P751_affine_RA)
- c.xRA.Z.One()
-
- // Load points for B
- c.xRB.FromAffine(&P751_affine_RB)
- c.xRB.Z.One()
- c.xQB.FromAffine(&P751_affine_QB)
- c.xQB.Z.One()
- c.xPB.FromAffine(&P751_affine_PB)
- c.xPB.Z.One()
- }
-
- func (c *context) ScalarMul(scalar []byte, sz uint) {
- c.curve.A.Zero()
- c.curve.C.One()
- // OZAPTF: PA QA RA -> PB QB ... if used for B
- c.xR = RightToLeftLadder(&tmp, &c.xPA, &c.xQA, &c.xRA, sz, scalar)
- }
-
- func NewCtx() OperationContext {
- return new(context)
- }
|