This commit is contained in:
Fedor Indutny
2016-09-15 13:10:12 +02:00
parent f3edfe59c7
commit cbace4683a
3 changed files with 19 additions and 10 deletions
+14 -5
View File
@@ -56,8 +56,12 @@
}
BN.isBN = function isBN (num) {
if (num instanceof BN) {
return true;
}
return num !== null && typeof num === 'object' &&
num.constructor.name === 'BN' && Array.isArray(num.words);
num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
};
BN.max = function max (left, right) {
@@ -2098,6 +2102,10 @@
assert(this.negative === 0, 'imaskn works only with positive numbers');
if (this.length <= s) {
return this;
}
if (r !== 0) {
s++;
}
@@ -5797,12 +5805,13 @@ EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
else
r = this.curve.pointFromX(r, isYOdd);
var eNeg = n.sub(e);
var rInv = signature.r.invm(n);
var s1 = n.sub(e).mul(rInv).umod(n);
var s2 = s.mul(rInv).umod(n);
// 1.6.1 Compute Q = r^-1 (sR - eG)
// Q = r^-1 (sR + -eG)
var rInv = signature.r.invm(n);
return this.g.mulAdd(eNeg, r, s).mul(rInv);
return this.g.mulAdd(s1, r, s2);
};
EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
@@ -8646,7 +8655,7 @@ if (typeof Object.create === 'function') {
},{}],26:[function(require,module,exports){
module.exports={
"name": "elliptic",
"version": "6.3.1",
"version": "6.3.2",
"description": "EC cryptography",
"main": "lib/elliptic.js",
"files": [
+4 -4
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "elliptic",
"version": "6.3.1",
"version": "6.3.2",
"description": "EC cryptography",
"main": "lib/elliptic.js",
"files": [