X-Git-Url: http://www.git.cypherpunks.ru/?p=gogost.git;a=blobdiff_plain;f=gost3410%2Fprivate.go;h=ac08df5be11f1ed383020186d41b57a337170532;hp=237a906cfacfbe3127cd21c79d14f37d0284f6fe;hb=220aa87670f1b7ed258374c7ec84a9d9463c7a94;hpb=08ecebce6c2e74baa6bbe37ec47fc81907059bc3 diff --git a/gost3410/private.go b/gost3410/private.go index 237a906..ac08df5 100644 --- a/gost3410/private.go +++ b/gost3410/private.go @@ -28,8 +28,8 @@ type PrivateKey struct { Key *big.Int } -func NewPrivateKey(curve *Curve, raw []byte) (*PrivateKey, error) { - pointSize := curve.PointSize() +func NewPrivateKey(c *Curve, raw []byte) (*PrivateKey, error) { + pointSize := c.PointSize() if len(raw) != pointSize { return nil, fmt.Errorf("gogost/gost3410: len(key) != %d", pointSize) } @@ -41,15 +41,15 @@ func NewPrivateKey(curve *Curve, raw []byte) (*PrivateKey, error) { if k.Cmp(zero) == 0 { return nil, errors.New("gogost/gost3410: zero private key") } - return &PrivateKey{curve, k.Mod(k, curve.Q)}, nil + return &PrivateKey{c, k.Mod(k, c.Q)}, nil } -func GenPrivateKey(curve *Curve, rand io.Reader) (*PrivateKey, error) { - raw := make([]byte, curve.PointSize()) +func GenPrivateKey(c *Curve, rand io.Reader) (*PrivateKey, error) { + raw := make([]byte, c.PointSize()) if _, err := io.ReadFull(rand, raw); err != nil { return nil, err } - return NewPrivateKey(curve, raw) + return NewPrivateKey(c, raw) } func (prv *PrivateKey) Raw() []byte {