Browse Source

Merge pull request #357 from ionux/master

Fix to check for zero s value in sign function
patch-2
Ryan X. Charles 11 years ago
parent
commit
b8986ed0e1
  1. 5
      lib/browser/Key.js

5
lib/browser/Key.js

@ -120,9 +120,8 @@ Key.prototype.signSync = function(hash) {
var G = ecparams.getG();
var Q = G.multiply(k);
var r = Q.getX().toBigInteger().mod(n);
} while (r.compareTo(BigInteger.ZERO) <= 0);
var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
} while (r.compareTo(BigInteger.ZERO) <= 0 || s.compareTo(BigInteger.ZERO) <= 0);
return serializeSig(r, s);
};

Loading…
Cancel
Save