Replace new Buffer() with Buffer.alloc() in lib/crypto - do it everywhere!
This commit is contained in:
parent
c10e2830f5
commit
573ed263bc
|
@ -104,15 +104,15 @@ var encrypted = exports.encrypted = {
|
|||
assert(buf.readUInt16BE(16, true) === SECP256K1_TYPE, "Bad curve type");
|
||||
assert(buf.readUInt16BE(18, true) === 32, "Bad Rx length");
|
||||
assert(buf.readUInt16BE(52, true) === 32, "Bad Ry length");
|
||||
var iv = new Buffer(16);
|
||||
var iv = Buffer.alloc(16);
|
||||
buf.copy(iv, 0, 0, 16);
|
||||
var ephemPublicKey = new Buffer(70);
|
||||
var ephemPublicKey = Buffer.alloc(70);
|
||||
buf.copy(ephemPublicKey, 0, 16, 86);
|
||||
// NOTE(Kagami): We do copy instead of slice to protect against
|
||||
// possible source buffer modification by user.
|
||||
var ciphertext = new Buffer(buf.length - 118);
|
||||
var ciphertext = Buffer.alloc(buf.length - 118);
|
||||
buf.copy(ciphertext, 0, 86, buf.length - 32);
|
||||
var mac = new Buffer(32);
|
||||
var mac = Buffer.alloc(32);
|
||||
buf.copy(mac, 0, buf.length - 32);
|
||||
return {
|
||||
iv: iv,
|
||||
|
|
Loading…
Reference in New Issue
Block a user