// GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2016 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2017 Sergey Matveev <stargrave@stargrave.org>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
}
func (c *Curve) Exp(degree, xS, yS *big.Int) (*big.Int, *big.Int, error) {
+ if degree.Cmp(zero) == 0 {
+ return nil, nil, errors.New("Bad degree value")
+ }
dg := big.NewInt(0).Sub(degree, bigInt1)
tx := big.NewInt(0).Set(xS)
ty := big.NewInt(0).Set(yS)
cx := big.NewInt(0).Set(xS)
cy := big.NewInt(0).Set(yS)
- if dg.Cmp(zero) == 0 {
- return nil, nil, errors.New("Bad degree value")
- }
for dg.Cmp(zero) != 0 {
if dg.Bit(0) == 1 {
c.add(tx, ty, cx, cy)