Skip to content

Commit

Permalink
6.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Nov 13, 2024
1 parent 04cb6f5 commit 9b77436
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
15 changes: 14 additions & 1 deletion dist/elliptic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2289,16 +2289,29 @@ EC.prototype.sign = function sign(msg, key, enc, options) {
if (!options)
options = {};

if (typeof msg !== 'string' && typeof msg !== 'number' && !BN.isBN(msg)) {
assert(typeof msg === 'object' && msg && typeof msg.length === 'number',
'Expected message to be an array-like, a hex string, or a BN instance');
assert((msg.length >>> 0) === msg.length); // non-negative 32-bit integer
for (var i = 0; i < msg.length; i++) assert((msg[i] & 255) === msg[i]);
}

key = this.keyFromPrivate(key, enc);
msg = this._truncateToN(msg, false, options.msgBitLength);

// Would fail further checks, but let's make the error message clear
assert(!msg.isNeg(), 'Can not sign a negative message');

// Zero-extend key to provide enough entropy
var bytes = this.n.byteLength();
var bkey = key.getPrivate().toArray('be', bytes);

// Zero-extend nonce to have the same byte size as N
var nonce = msg.toArray('be', bytes);

// Recheck nonce to be bijective to msg
assert((new BN(nonce)).eq(msg), 'Can not sign message');

// Instantiate Hmac_DRBG
var drbg = new HmacDRBG({
hash: this.hash,
Expand Down Expand Up @@ -8889,7 +8902,7 @@ utils.encode = function encode(arr, enc) {
},{}],35:[function(require,module,exports){
module.exports={
"name": "elliptic",
"version": "6.6.0",
"version": "6.6.1",
"description": "EC cryptography",
"main": "lib/elliptic.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion dist/elliptic.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elliptic",
"version": "6.6.0",
"version": "6.6.1",
"description": "EC cryptography",
"main": "lib/elliptic.js",
"files": [
Expand Down

0 comments on commit 9b77436

Please sign in to comment.