Git Product home page Git Product logo

bcrypto's Introduction

bcrypto

Node.js

The missing crypto module for Node.js. Bcrypto provides you with a consistent interface across Node.js and the browser. It is implemented as a Node.js addon for C libraries libtorsion and libsecp256k1 with corresponding implementations in JavaScript.

Usage

const rng = require('bcrypto/lib/random');
const entropy = rng.randomBytes(32);

const Hash256 = require('bcrypto/lib/hash256');
const digest = Hash256.digest(Buffer.alloc(32, 0xaa));

API

See the ./lib directory for available modules and APIs.

Implementations

nodejs (linux) nodejs (macos) nodejs (win) browser
aead c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
aes c (libtorsion) c (libtorsion) c (libtorsion) js
bcrypt c (libtorsion) c (libtorsion) c (libtorsion) js
blake2b{160,256,384,512} c (libtorsion) c (libtorsion) c (libtorsion) js
blake2s{128,160,224,256} c (libtorsion) c (libtorsion) c (libtorsion) js
bn js w/ bigint js w/ bigint js w/ bigint js
chacha20 c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
cshake{128,256} c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
ctr-drbg c (libtorsion) c (libtorsion) c (libtorsion) js
dsa c (libtorsion) c (libtorsion) c (libtorsion) js
eb2k c (libtorsion) c (libtorsion) c (libtorsion) js
ecies c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
ed25519 c (libtorsion) c (libtorsion) c (libtorsion) js
ed448 c (libtorsion) c (libtorsion) c (libtorsion) js
gost94 c (libtorsion) c (libtorsion) c (libtorsion) js
hash160 c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
hash256 c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
hash-drbg c (libtorsion) c (libtorsion) c (libtorsion) js
hkdf c (libtorsion) c (libtorsion) c (libtorsion) js
hmac-drbg c (libtorsion) c (libtorsion) c (libtorsion) js
keccak/sha3{224,256,384,512} c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
kmac{128,256} c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
md{2,4,5} c (libtorsion) c (libtorsion) c (libtorsion) js
md5sha1 c (libtorsion) c (libtorsion) c (libtorsion) js
merkle js js js js
mrkl js js js js
murmur3 c (libtorsion) c (libtorsion) c (libtorsion) js
p{192,224,256,384,521} c (libtorsion) c (libtorsion) c (libtorsion) js
pbkdf2 c (libtorsion) c (libtorsion) c (libtorsion) js
pgp js js js js
poly1305 c (libtorsion) c (libtorsion) c (libtorsion) js
random c (openssl²) c (openssl²) c (openssl²) js³
rc4 c (libtorsion) c (libtorsion) c (libtorsion) js
ripemd160 c (libtorsion) c (libtorsion) c (libtorsion) js
rsa c (libtorsion) c (libtorsion) c (libtorsion) js
rsaies c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
salsa20 c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
schnorr c (libtorsion) c (libtorsion) c (libtorsion) js
scrypt c (libtorsion) c (libtorsion) c (libtorsion) js
secp256k1 c (libsecp256k1²) c (libsecp256k1²) c (libsecp256k1²) js
sha1 c (libtorsion) c (libtorsion) c (libtorsion) js
sha{224,256,384,512} c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
shake{128,256} c (libtorsion¹) c (libtorsion¹) c (libtorsion) js
siphash c (libtorsion) c (libtorsion) c (libtorsion) js
ssh js js js js
whirlpool c (libtorsion) c (libtorsion) c (libtorsion) js
x25519 c (libtorsion) c (libtorsion) c (libtorsion) js
x448 c (libtorsion) c (libtorsion) c (libtorsion) js

Footnotes

  1. with x86-64 assembly
  2. optionally with libtorsion
  3. using the webcrypto api

Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work. </legalese>

License

  • Copyright (c) 2017-2019, Christopher Jeffrey (MIT License).

See LICENSE for more info.

bcrypto's People

Contributors

braydonf avatar chjj avatar michalsmiarowski avatar nodech avatar pinheadmz avatar tuxcanfly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcrypto's Issues

schnorr signatures

It seems there's a bug in schnorr (probably javascript).

Source of the issue: bcoin-org/bcash#134

Reproduce:

const native = require('./lib/native/secp256k1');
const js = require('./lib/js/secp256k1');

const hash = Buffer.from(
  'cd3808fc5cbf9f2190d9b867b4498f234212984b8c879f296cf8e792b622a2f4',
  'hex'
);
const sig = Buffer.from(
  '0df4be7f5fe74b2855b92082720e889038e15d8d747334fa3f300ef4ab1db1eea56aa83d1d60809ff6703791736be87cfb6cbc5c4036aeed3b4ea4e6dab35090',
  'hex'
);
const key = Buffer.from(
  '0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
  'hex'
);

const nres = native.schnorrVerify(hash, sig, key);
const jres = js.schnorrVerify(hash, sig, key);

console.log('verify native:', nres);     // true
console.log('verify javascript:', jres); // false

Unfortunately don't have more details.

[Electron] TypeError: Cannot read property 'randomBytes' of undefined

We run into the following issue when using bcrypto 4.1.0 inside Electron:

    TypeError: Cannot read property 'randomBytes' of undefined

      42 |    */
      43 |   static getAddress (passphrase, pubKeyHash) {
    > 44 |     return Identities.Address.fromPassphrase(this.normalizePassphrase(passphrase), pubKeyHash)
         |                               ^
      45 |   }
      46 | 
      47 |   static getAddressFromPublicKey (publicKey, pubKeyHash) {

      at Object.randomBytes (node_modules/bcrypto/lib/native/random.js:20:18)
      at Function.randomBits (node_modules/bcrypto/lib/js/bn.js:3459:25)
      at Function.random (node_modules/bcrypto/lib/js/bn.js:3502:22)
      at ShortPoint._getBlinding (node_modules/bcrypto/lib/js/curves.js:785:24)
      at ShortPoint.precompute (node_modules/bcrypto/lib/js/curves.js:731:40)
      at SECP256K1.precompute (node_modules/bcrypto/lib/js/curves.js:160:12)
      at ECDSA.get curve [as curve] (node_modules/bcrypto/lib/js/ecdsa.js:52:19)
      at ECDSA.publicKeyCreate (node_modules/bcrypto/lib/js/ecdsa.js:228:20)
      at Function.fromPrivateKey (node_modules/@arkecosystem/crypto/src/identities/keys.ts:18:34)
console.log(process.versions)
 {
        node: '12.3.1',
        v8: '7.4.288.27-node.18',
        uv: '1.29.1',
        zlib: '1.2.11',
        brotli: '1.0.7',
        ares: '1.15.0',
        modules: '72',
        nghttp2: '1.38.0',
        napi: '4',
        llhttp: '1.1.3',
        http_parser: '2.8.0',
        openssl: '1.1.1b',
        cldr: '35.1',
        icu: '64.2',
        tz: '2019a',
        unicode: '12.1'
      }

From what I can tell loading the native module succeeds:
https://github.com/bcoin-org/bcrypto/blob/master/lib/random.js#L10

but calling randomBytes fails because crypto is missing. Manually forcing to ./node/random resolves it (can we get an environment variable for it? 😛 ).

I also tried a npm rebuild without success.

Many thanks in advance.

[security] randomBytes() falling back to Math.random()

https://github.com/bcoin-org/bcrypto/blob/master/lib/js/random.js#L157-L167

The fallback to using Math.random() is clearly noted to be used only for testing purposes, but its inclusion in the module itself instead of as a test stub/override within the test suite might make it unnecessarily a target for various script injection, XSS, malicious extensions, rogue dependencies, etc.

An attacker that manages to manipulate the global scope may be able to trick this into using Math.random(), which would lead to weak keys being generated.

Fully acknowledging that an attacker with script injection capabilities could very well do more damage than compromise the entropy source, I think moving this use of Math.random() out of a conditional path within the module itself into a test stub would be a good practice. Doing so would at least allow application developers to Object.freeze(window.crypto) and expect that tampering with global variables would lead to an exception instead of possible silent compromise of entropy source for keys.

🔑 ✨ 💕

bech32m is not replaced with bench32m-browser when using browser

lib/encoding/bech32m.js file is not properly replaced with lib/encoding/bech32m-browser.js when using the lib in the browser. I think it's because it's not included in package.json browser field.

Here is the pull request that add support for bech32m - #61. As you can see two new files are created - bech32m.js and bech32m-browser.js. They should be mapped in the browser field in package.json:

browser: {
  ...
  "./lib/encoding/bech32m": "./lib/encoding/bech32m-browser.js",
  ...
}

Consider switching to a nettle backend

I'm a huge fan of libnettle. It's really small, well-written, and easily auditable. We could vendor it and statically link to it. Switching would solve issues like #15. It would avoid the dangers of calling out to potentially many different openssl versions.

As an added bonus, it would allow us to compile bcrypto to web assembly (we could add a fourth wasm backend). Nettle compiled to wasm doesn't seem to be significantly faster than our JS backend. Furthermore, google has pretty much ruined any possibility of using web assembly in the browser due to their arbitrary 4kb limit for synchronous wasm module loading (once the mass migration to firefox begins, this will be less of an issue). That said, a wasm backend would compensate for the lack of constant-time functions in the JS backend (assuming v8's wasm vm is actually doing that stuff in constant-time -- who knows what it's actually doing behind the scenes).

I currently have a development branch utilizing nettle. It supports pretty much everything, including a custom implementation of bip-schnorr.

I believe nettle will include ed448 support within the next version or two, which would allow us to drop most of our custom C code.

The downsides:

  1. It's slower than openssl, especially for hashing. EC is also relatively slow (in nettle, nothing is done in variable time, even during verification).
  2. It doesn't support secp256k1 (we could still use libsecp256k1 for this, but it would be nice to support nettle's ecdsa backend as an option).
  3. The build becomes longer and more complex.

For #1, we could optionally allow for openssl support just for fast hashing.

As far as #2 goes, there's an unfinished patch for secp256k1 on the nettle mailing list, but it seems to be missing the most important parts (e.g. the reduction/modulo functions). We would have to write our own reduction functions for the order and prime (we might be able to re-use the libsecp256k1 scalar reduction function, but the prime reduction is probably useless to us since it uses a different word size than gmp limbs). Anyway, not super important right now.

No solution for #3.

"A dynamic link library (DLL) initialization routine failed" when run in Windows under Electron or PKG

Hi there,

When I run software under Electron or PKG that runs bcrypto with native bindings on Windows, I get a "DLL Initialization Routine Failed" error. The error looks like this:

Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\Matthew Slipper\IdeaProjects\hsd\node_modules\bcrypto\build\Release\bcrypto.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1186:18)
    at Module.load (internal/modules/cjs/loader.js:984:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1024:19)
    at Module.require (pkg/prelude/bootstrap.js:1225:31)
    at require (internal/modules/cjs/helpers.js:72:18)
    at bindings (C:\snapshot\hsd\node_modules\loady\lib\loady.js:98:17)
    at Object.<anonymous> (C:\snapshot\hsd\node_modules\bcrypto\lib\native\binding.js:14:33)
    at Module._compile (pkg/prelude/bootstrap.js:1320:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:10)

I've already verified that the Node ABI version in use is correct. After attaching WinDBG to the PKG-generated process, I see the following error:

ModLoad: 00007ffe`4a130000 00007ffe`4a23e000   \\?\C:\Users\Matthew Slipper\IdeaProjects\hsd\node_modules\bdb\build\Release\leveldown.node
ModLoad: 00007ffe`409d0000 00007ffe`40b1a000   \\?\C:\Users\Matthew Slipper\IdeaProjects\hsd\node_modules\bcrypto\build\Release\bcrypto.node
ModLoad: 00007ffe`8c4b0000 00007ffe`8c4c7000   C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll
ModLoad: 00007ff7`12a80000 00007ff7`1499f000   C:\Program Files\nodejs\node.exe
(436c.1a2c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.

(Note: The exception is not handled, since WinDBG goes into a loop after stepping over the exception.)

The error is the same when I debug Bob in the same way. Error code c0000005 isn't a missing DLL error, it implies a runtime bug within bcrypto itself that is triggering a memory access violation. Any chance you could take a look and see what is going on? Being able to bundle HSD via PKG would dramatically simplify Bob development, and allow people to make standalone HSD binaries in the future.

The issue is not present when HSD is run from my system Nodejs interpreter. The error disappears when I set process.env.NODE_BACKEND to js.

bip-schnorr (BTC) vs schnorr-legacy (BCH)

@chjj
Just wondering if / how we plan on integrating both Schnorr types into bcrypto. Will BTC bip-schnorr be maintained on a separate branch so we can pull in the latest secp256k1? Or will we try to merge the old and new libraries somehow?

Let me know if there's anything I can do, or look into - I'm working on Schnorr/Taproot integration in bcoin, the JS implementation for bip-schnorr is available but I'm wondering about the long term...

aead is non deterministic w/ certain parameters

I'm just wrapping my head around what is going on here, so I can provide some more details in the morning with a working gist, but here is what I understand so far.

There appears to be a function inside of AEAD that is static. If I create two separate instances of CipherState or Brontide from here: https://github.com/handshake-org/hsd/blob/master/lib/net/brontide.js I believe that the function that is causing this issue is here: https://github.com/bcoin-org/bcrypto/blob/master/src/aead/aead.c#L130-L141

What I have gathered is that if a "ad" or "plaintext/ciphertext" is passed to aead encrypt/decrypt that is not a multiple of 16, then this function is called. This function changes the result of the encryption and decryption function such that it is different on an odd/even basis.

I have tested this similar functionality in a Rust library, and it seems to keep its determinism (https://github.com/HandshakeAlliance/rust-brontide/blob/master/src/cipher_state.rs#L214) - that is, if I create two separate ciphers and call encrypt they will return the same tag. If I do the same thing with the Bcrypto library, they return different tags (provided that they have parameters that are not divisible by 16).

I have a few tests written to show this which I can upload tomorrow when I wake up, but I think the easiest way to replicate is to import CipherState into this test: https://github.com/handshake-org/hsd/blob/master/test/brontide-test.js and call a single cipher.encrypt with the constant Hello before the tests on line 109. This will cause the odd/even difference to occur and the iteration test on line 109 will fail.

I suspect this is the issue causing many bad tag issues being printed in hsd logs. If one peer gets onto the "odd" track, and another on the "even" then attempting to decrypt their messages will always return false.

sha512 calls with superfluous args

ch64_hi is declared as taking 5 args:

function ch64_hi(xh, xl, yh, yl, zh) {

but called with 6:

const c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);

maj64_hi is declared as taking 5 arguments:

function maj64_hi(xh, xl, yh, yl, zh) {

but called with 6:

c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);

New Format Keys are unsupported

OpenSSH has a new format. Its spec is here. It can encode any type of key openssh supports, but in

bcrypto/lib/ssh.js

Lines 520 to 522 in 934f5ea

case keyTypes.ED25519: {
block.type = 'OPENSSH PRIVATE KEY';
break;

and in

bcrypto/lib/ssh.js

Lines 610 to 612 in 934f5ea

case 'OPENSSH PRIVATE KEY': { // OpenSSH format
return this.decodeSSH(block.data, passwd);
}

which calls

bcrypto/lib/ssh.js

Lines 423 to 424 in 934f5ea

if (rawKey.type !== keyTypes.ED25519)
throw new Error('Invalid key.');

bcrypto is silently assuming that "OPENSSH PRIVATE KEY" <=> ED25519 key. And this isn't true. In fact, recent ssh-keygen now puts all keys in "OPENSSH PRIVATE KEY" format, regardless of the type of key. I've tested on Mac OS Mojave (OpenSSH_7.9p1, LibreSSL 2.7.3) and ArchLinux (OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018) and been bitten by this. On the other hand, Debian stable still uses OpenSSH_7.4p1 Debian-10+deb9u5, OpenSSL 1.0.2r 26 Feb 2019, and that defaults RSA keys to the old style, which is compatible with bcrypto.

"Error: Entropy source not available." running webpack build

I want to make a bundled js application that can generate secure random.randomBytes(32) WITHOUT requiring the user to compile the cpp bindings, etc. I am hoping this application will work similar to the browser mode of bcoin, which compiles and runs fine without this error! (last time I checked... 😬)

package.json

...
  "scripts": {
    "build": "webpack --mode production"
  }
...
  "dependencies": {
    "bcrypto": "^3.0.1",
...

webpack.config.js

const path = require('path');

module.exports = {
  target: 'node',
  node: {
    __dirname: false,
    __filename: false,
  },
  resolve: {
    modules: ['node_modules'],
    extensions: ['-compat.js', '-browser.js', '.js', '.json']
  },
  entry: './index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  }
};

Attempt build: npm run webpack
Attempt run: node dist/bundle.js

Error: Entropy source not available.

I've tried to include NODE_BACKEND=js before the webpack command, which seems to have no effect.

I otherwise am confident the js backends are bundling, because when I exclude the resolve statement I get the error:

TypeError: Cannot read property 'randomFill' of undefined

build falis with node v12

It seems v8 api changed and bcrypto no longer compiles:

../src/aead.cc: In static member function ‘static void BAEAD::Init(v8::Local<v8::Object>&)’:
../src/aead.cc:39:68: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
   target->Set(Nan::New("AEAD").ToLocalChecked(), ctor->GetFunction());
                                                                    ^
In file included from /home/nod/.node-gyp/12.1.0/include/node/node.h:63,
                 from ../src/common.h:3,
                 from ../src/aead.cc:1:
/home/nod/.node-gyp/12.1.0/include/node/v8.h:5947:46: note: candidate: ‘v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)’

Codebase is big to rewrite to NAPI, but probably worth it in the long run.

CI: add OSX/WIndows and node version to build matrix

Since we support multiple OSes it would be prudent to enable CI on a matrix of the OS and node versions supported. This would prevent OS and node version specific bugs which would be otherwise silently ignored.

Breaking changes from 3.x to 4.0 (WIP)

Some major backward-incompatible changes coming for the next version. Documenting them here.

AES

  • ./lib/aes has been removed. Use ./lib/cipher instead (maybe -- on the fence with this one).

Base32

  • Decoding is now much stricter and will throw properly on a malformed string (affects HNS consensus).
  • base32.test() now throws if a non-string is passed.

Base58

  • base58.test() now throws if a non-string is passed.

Bech32

  • bech32.decode() now returns an array of [hrp, version, hash].
  • bech32.test() now throws if a non-string is passed.

Bcrypt

  • bcrypt.hash192() has been modified to accurately replicate bsd bcrypt.

BN

  • BN#divmod(), BN#div(), and BN#mod() now perform euclidean division and modulo. Use BN#quorem(), BN#quo(), and BN#rem() for the truncated counterparts (go-style API).
  • BN#umod() has been removed. Use BN#mod() instead.
  • BN#bincn() has been removed.
  • BN#invm() and BN#redInvm() have been renamed to BN#invert() and BN#redInvert() respectively.
  • BN#finvm() and BN#redFinvm() have been renamed to BN#fermat() and BN#redFermat() respectively.
  • Subtle changes to BN#egcd() have been made to accurately replicate GMP behavior (only affects negative numbers).

cash32/cashaddr

  • cash32.decode() now returns an array of [prefix, type, hash].
  • cash32.test() now throws if a non-string is passed.

ccmp

  • ./lib/ccmp has been removed. Use ./lib/safe instead.

DRBG

  • ./lib/drbg has been removed. Use ./lib/hmac-drbg, ./lib/hash-drbg, or ./lib/ctr-drbg instead.

DSA

  • dsa.dh() has been removed. Use dsa.derive() instead.
  • dsa.derive() now zero pads the resulting secret to the prime length.

ECDSA

  • ec.generatePrivateKey() has been removed. Use ec.privateKeyGenerate() instead.
  • ec.toDER() and ec.fromDER() have been removed. Use ec.signatureExport() and ec.signatureImport() instead.
  • ec.ecdh() has been removed. Use ec.derive() instead.
  • ec.signRecoverable() and ec.signRecoverableDER() now return an array of [sig, param].
  • The recovery parameter is now mandatory for ec.recover() and ec.recoverDER().

ECIES/DSAIES/RSAIES

ECIES, DSAIES, and RSAIES have switched to using a variation of secretbox as a backend (xsalsa20poly1305). The legacy version will no longer be supported.

HKDF

  • bcrypto.hkdf has been renamed to bcrypto.HKDF.

Internal

We shouldn't have been using this, but here are the changes:

  • All trimming and padding functions have been moved to ./lib/encoding/util.
  • trimZeroes has been renamed to trimLeft.
  • leftPad has been renamed to padLeft.
  • ./lib/internal/base64 has been moved to ./lib/encoding/base64.
  • ./lib/internal/signature has changed significantly.

Random

  • random.randomBytesAsync() has been removed.
  • random.randomFillAsync() has been removed.

safe-equal

  • ./lib/safe-equal has been removed. Use ./lib/safe instead.

siphash

  • siphash.siphash256 has been removed. Use siphash.siphash instead.

I took a quick look through our ecosystem and here are the projects that are affected:

  • bledger - Usage of toDER() and fromDER().
  • bns - Usage of trimZeroes() and leftPad().
  • hs-airdrop - Usage of trimZeroes() and internal/base64.
  • bterm - Usage of signRecoverable().

Monorepo

Have you considered converting this to monorepo so each module could be published as separate npm package.
Couple of advantages I see with this approach:

  • allows users to only install crypto library they need
  • by installing only libraries we need, would reduce code bundle size on the web
  • by installing only libraries we need, we would reduce node-gyp compilation time when installing library

I would love to hear your opinion on this.

bcrypto 5.0.0 fails to install on Windows

Latest 5.0.0 build fails to compile on windows during npm install and blocks hsd from installing. Seems to be related to libtorsion.

`

node-gyp rebuild

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
aead.c
chacha20.c
drbg.c
dsa.c
ecc.c
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p192_32.h(14): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p192_32.h(15): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p521_32.h(14): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p521_32.h(15): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p448_32.h(14): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p448_32.h(15): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
..\src\torsion\src\ecc.c(9640): warning C4098: 'torsion_schnorr_scratch_destroy': 'void' function returning a value [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
..\src\torsion\src\ecc.c(9682): warning C4098: 'torsion_schnorr_privkey_generate': 'void' function returning a value [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\someuser\hsd\node_modules\bcrypto
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
`

AWS Lambda runtime error: version "GLIBC_2.28" not found

Hoping someone can help me with this issue. I'm uploading a Serverless project to a Lambda on AWS that has a dependency on bcrypto. When it's run, it cannot find libc.so.6 with the correct version of GLIBC_2.28.

I've attempted to build my project on an EC2 instance AWS provides of Linux 2 just to make sure it wasn't my build environment that was causing the issue, and I tried it on my own Ubuntu instance with a different, newer version also, both have the same error when run in the cloud.

Are there any settings or build parameters I can pass to include whatever libraries are necessary so the binary doesn't have to look for this file? I've never had this issue till now. I was told there was a "browser" feature for this that would allow this to be run independently but I'm having trouble finding the documentation.

More specifics:
Node 14.17.3
NPM: 7.24.0

The AWS EC2 machine I'm building from is currently running: 2.26, which is even stranger.

Any help would be greatly appreciated. Thanks.

documentation

Would autogenerating docs using jsdoc be a nice addition to this repo?

Or an updated README that specifies the different available modules?

I'd be interested in contributing this

v8/node deprecated APIs and how to handle them

Putting this here to document for my own sanity.

V8 removed a bunch of calls and the node.js devs have decided to maintain them for the time being, but have marked them as deprecated. We need to switch away from them.

Deprecated APIs:

  • Uint32Value()
  • Int32Value()
  • IntegerValue()
  • NumberValue()
  • BooleanValue()
  • ToString()

Example migration:

Originally:

int32_t arg = info[0]->Int32Value();

Now must be:

int32_t arg = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();

Or:

int32_t arg = info[0]->Int32Value(Nan::GetCurrentContext()).ToChecked();

Or:

int32_t arg = info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();

Int32Value returns Maybe<uint32_t>.

ToInt32 returns MaybeLocal<Int32>.

Note that ToChecked() is an alias for FromJust().

ToString() was also deprecated, but nan.h should be handling this. Not us, but for completeness, heres the migration.

From:

v8::Local<v8::String> str = info[0]->ToString();

To:

v8::Local<v8::String> str = info[0]->ToString(Nan::GetCurrentContext()).FromMaybe(v8::Local<v8::String>());

Note that anything that returns MaybeLocal instead of Maybe should have an IsEmpty() check.

Example (from the style guide below):

v8::MaybeLocal<v8::Value> maybe = fn->Call(...);

if (maybe.IsEmpty()) { // Exception occurs during function call
  // Do some clean up
  return; // Back to JavaScript and let it throw
}

v8::Local<v8::Value> result = maybe.ToLocalChecked();

References:

Timeline:

Style Guide (mentioning the changes):

I'm not sure how this will impact node versions prior to node v10. This maybe needs to be added as a part of nan? Not sure. Going to do more research.

Update:

Just discovered the magic of Nan::To (1, 2, 3).

We can do Nan::To<int32_t>(info[0]).FromJust().

Nan::To seems undocumented, but it seems to be the inverse of Nan::New.

Build error on 32 bit arm

Running into this problem trying to run a handshake node on my odroid-hc2
https://ameridroid.com/products/odroid-hc2

root@odroid:~/bcrypto# make all
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/root/bcrypto/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/10.15.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/10.15.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/10.15.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/root/bcrypto',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make[1]: Entering directory '/root/bcrypto/build'
  CC(target) Release/obj.target/bcrypto/src/aead/aead.o
  CC(target) Release/obj.target/bcrypto/src/aes/aes.o
  CC(target) Release/obj.target/bcrypto/src/blake2b/blake2b.o
  CC(target) Release/obj.target/bcrypto/src/blake2s/blake2s.o
  CC(target) Release/obj.target/bcrypto/src/chacha20/chacha20.o
  CC(target) Release/obj.target/bcrypto/src/dsa/dsa.o
  CC(target) Release/obj.target/bcrypto/src/ecdsa/ecdsa.o
  CC(target) Release/obj.target/bcrypto/src/ed25519/ed25519.o
  CC(target) Release/obj.target/bcrypto/src/ed448/arch_32/f_impl.o
  CC(target) Release/obj.target/bcrypto/src/ed448/curve448.o
  CC(target) Release/obj.target/bcrypto/src/ed448/curve448_tables.o
  CC(target) Release/obj.target/bcrypto/src/ed448/eddsa.o
  CC(target) Release/obj.target/bcrypto/src/ed448/f_generic.o
  CC(target) Release/obj.target/bcrypto/src/ed448/scalar.o
  CC(target) Release/obj.target/bcrypto/src/murmur3/murmur3.o
  CC(target) Release/obj.target/bcrypto/src/pbkdf2/pbkdf2.o
  CC(target) Release/obj.target/bcrypto/src/poly1305/poly1305.o
  CC(target) Release/obj.target/bcrypto/src/random/random.o
  CC(target) Release/obj.target/bcrypto/src/rsa/rsa.o
  CC(target) Release/obj.target/bcrypto/src/scrypt/insecure_memzero.o
  CC(target) Release/obj.target/bcrypto/src/scrypt/sha256.o
  CC(target) Release/obj.target/bcrypto/src/scrypt/scrypt.o
  CC(target) Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o
  CC(target) Release/obj.target/bcrypto/src/secp256k1/contrib/lax_der_parsing.o
  CC(target) Release/obj.target/bcrypto/src/secp256k1/contrib/lax_der_privatekey_parsing.o
  CC(target) Release/obj.target/bcrypto/src/siphash/siphash.o
../src/siphash/siphash.c:11:1: error: unable to emulate ‘TI’
 typedef unsigned uint128_t __attribute__((mode(TI)));
 ^~~~~~~
../src/siphash/siphash.c: In function ‘reduce64’:
../src/siphash/siphash.c:50:29: warning: right shift count >= width of type [-Wshift-count-overflow]
   return ((uint128_t)a * b) >> 64;
                             ^~
../src/siphash/siphash.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
cc1: warning: unrecognized command line option ‘-Wno-unknown-warning-option’
bcrypto.target.mk:223: recipe for target 'Release/obj.target/bcrypto/src/siphash/siphash.o' failed
make[1]: *** [Release/obj.target/bcrypto/src/siphash/siphash.o] Error 1
make[1]: Leaving directory '/root/bcrypto/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.14.87-153
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /root/bcrypto
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1
root@odroid:~/bcrypto# lscpu
Architecture:        armv7l
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           2
Vendor ID:           ARM
Model:               3
Model name:          Cortex-A7
Stepping:            r0p3
CPU max MHz:         2000.0000
CPU min MHz:         200.0000
BogoMIPS:            18.00
Flags:               half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae

BigInt function vs BigInt literals

Running into a problem with trying to package bcoin while uglifying it. The latest version of uglify-es still does not support BigInt literals, ie 21n. I think the the parser just hasn't been updated to support that syntax. GitHub also seems to act strangely with their parser, BigInts appear highlighted and red.

The BigInt function is the same as using a literal. It may be easier to be compatible with the wider JS ecosystem if the function syntax was used, as old parsers will not break on it. Then the BigInt functionality could be polyfilled if need be.

const a = BigInt(21);
const b = 21n;

Typescript support

Love the library already! I would love to have typescript support on it 👌

Pre-built binaries ?

Hi all,

Any chance to be able one day to download pre-built binaries of this project in order to avoid to build and rebuild again and again in our projects?

What would be the prerequisites?

Thanks

Cannot read property 'randomBytes' of undefined

Bcrypto panics when rebuilded by electron.
From my investigation it seems that electron replaces openssl with boressl and this causes some incompatibilities. It seems that requiring of native random passes and doesn't fallback to node version.
I've mitigated it with (ELECTRON env is set by user , not electron itself):

  if(process && process.env.ELECTRON) {
    return require("bcrypto/lib/node/random").randomBytes(length);
  } else {
    return require("bcrypto/lib/random").randomBytes(length);
  }

bcrypto 4.2.8

ecdsa: return recovery id

Bitcoin uses secp256k1 recovery id for signing and verifying messages. It would be useful if ecdsa.sign interface returns the recoveryid along with the signature.

libgmp - check library availability.

On CI builds I noticed that bcrypto build failed, so the problem is in library availibility check:
./utils/has_lib.sh checks if gmp is available that sets true for with_gmp in bindings, but that does not mean gmp.h will be available (no libgmp-dev), so it incorrectly tries to build with gmp.h.

Previously(3.1.2) there were two checks that should have passed gmp and gmpxx. CI Environment only has libgmp and does not have gmpxx so it returned false and "correctly" set with_gmp=false and used USE_NUM_NONE=1.

We could either fix has_lib to look for header files or
Include gmp.h in the project and link to libgmp.so.

Problems when using bcrypto with Electron

I'm using Ubuntu 18.04 with OpenSSL 1.1.1, and bcrypto works flawlessly on Node console, but when executing inside Electron some problems arise:

3.0.2

I can run the project, but, it fails when using RIPEMD160:
symbol lookup error: /home/desktop-wallet/node_modules/bcrypto/build/Release/bcrypto.node: undefined symbol: RIPEMD160_Init

3.1.5

In this case, this happens before display the Electron window:
symbol lookup error: /home/desktop-wallet/node_modules/bcrypto/build/Release/bcrypto.node: undefined symbol: RAND_status

Any idea about the root cause?

Error when I run `yarn add bcrypto`

System Spec
Mac OS Catalina 10.15.7
Node v15.3.0
Yarn 1.22.10

0 verbose cli [
0 verbose cli '/usr/local/Cellar/node/15.3.0/bin/node',
0 verbose cli '/usr/local/bin/npm',
0 verbose cli 'rebuild'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/Users/timitejumola/bcoin/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/Users/timitejumola/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 7ms
19 verbose npm-session f0ce0e8ff66702f4
20 timing npm:load Completed in 17ms
21 timing arborist:ctor Completed in 0ms
22 timing build:queue Completed in 2ms
23 timing build:link:node_modules/bmocha Completed in 2ms
24 timing build:link Completed in 2ms
25 info run [email protected] install node_modules/bcrypto node-gyp rebuild
26 info run [email protected] install node_modules/bdb node-gyp rebuild
27 info run [email protected] install { code: 0, signal: null }
28 timing build:run:install:node_modules/bdb Completed in 34103ms
29 info run [email protected] install { code: 1, signal: null }
30 timing command:rebuild Completed in 68875ms
31 verbose stack Error: command failed
31 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
31 verbose stack at ChildProcess.emit (node:events:376:20)
31 verbose stack at maybeClose (node:internal/child_process:1055:16)
31 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
32 verbose pkgid [email protected]
33 verbose cwd /Users/timitejumola/bcoin
34 verbose Darwin 19.6.0
35 verbose argv "/usr/local/Cellar/node/15.3.0/bin/node" "/usr/local/bin/npm" "rebuild"
36 verbose node v15.3.0
37 verbose npm v7.0.14
38 error code 1
39 error path /Users/timitejumola/bcoin/node_modules/bcrypto
40 error command failed
41 error command sh -c node-gyp rebuild
42 error CC(target) Release/obj.target/bcrypto/src/base58/base58.o
42 error CC(target) Release/obj.target/bcrypto/src/bech32/bech32.o
42 error CC(target) Release/obj.target/bcrypto/src/cash32/cash32.o
42 error CC(target) Release/obj.target/bcrypto/src/murmur3/murmur3.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/aead.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/chacha20.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/drbg.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/dsa.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/ecc.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/hash.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/kdf.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/poly1305.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/rsa.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/salsa20.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/siphash.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/util.o
42 error CXX(target) Release/obj.target/bcrypto/src/aead.o
42 error CXX(target) Release/obj.target/bcrypto/src/base58.o
42 error CXX(target) Release/obj.target/bcrypto/src/bech32.o
42 error CXX(target) Release/obj.target/bcrypto/src/bcrypto.o
42 error CXX(target) Release/obj.target/bcrypto/src/blake2b.o
42 error CXX(target) Release/obj.target/bcrypto/src/blake2s.o
42 error CXX(target) Release/obj.target/bcrypto/src/cash32.o
42 error CXX(target) Release/obj.target/bcrypto/src/chacha20.o
42 error CXX(target) Release/obj.target/bcrypto/src/dsa.o
42 error CXX(target) Release/obj.target/bcrypto/src/dsa_async.o
42 error CXX(target) Release/obj.target/bcrypto/src/ecdh.o
42 error CXX(target) Release/obj.target/bcrypto/src/ecdsa.o
42 error CXX(target) Release/obj.target/bcrypto/src/eddsa.o
42 error CXX(target) Release/obj.target/bcrypto/src/hash.o
42 error CXX(target) Release/obj.target/bcrypto/src/hmac.o
42 error CXX(target) Release/obj.target/bcrypto/src/keccak.o
42 error CXX(target) Release/obj.target/bcrypto/src/murmur3.o
42 error CXX(target) Release/obj.target/bcrypto/src/pbkdf2.o
42 error CXX(target) Release/obj.target/bcrypto/src/pbkdf2_async.o
42 error CXX(target) Release/obj.target/bcrypto/src/poly1305.o
42 error CXX(target) Release/obj.target/bcrypto/src/rsa.o
42 error CXX(target) Release/obj.target/bcrypto/src/rsa_async.o
42 error CXX(target) Release/obj.target/bcrypto/src/salsa20.o
42 error CXX(target) Release/obj.target/bcrypto/src/schnorr.o
42 error CXX(target) Release/obj.target/bcrypto/src/scrypt.o
42 error CXX(target) Release/obj.target/bcrypto/src/scrypt_async.o
42 error CXX(target) Release/obj.target/bcrypto/src/siphash.o
42 error CXX(target) Release/obj.target/bcrypto/src/util.o
42 error CC(target) Release/obj.target/bcrypto/src/torsion/src/mini-gmp.o
42 error CC(target) Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o
43 error gyp info it worked if it ends with ok
43 error gyp info using [email protected]
43 error gyp info using [email protected] | darwin | x64
43 error gyp info find Python using Python version 3.7.3 found at "/Users/timitejumola/.pyenv/versions/3.7.3/bin/python3"
43 error gyp info spawn /Users/timitejumola/.pyenv/versions/3.7.3/bin/python3
43 error gyp info spawn args [
43 error gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
43 error gyp info spawn args 'binding.gyp',
43 error gyp info spawn args '-f',
43 error gyp info spawn args 'make',
43 error gyp info spawn args '-I',
43 error gyp info spawn args '/Users/timitejumola/bcoin/node_modules/bcrypto/build/config.gypi',
43 error gyp info spawn args '-I',
43 error gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
43 error gyp info spawn args '-I',
43 error gyp info spawn args '/Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/common.gypi',
43 error gyp info spawn args '-Dlibrary=shared_library',
43 error gyp info spawn args '-Dvisibility=default',
43 error gyp info spawn args '-Dnode_root_dir=/Users/timitejumola/Library/Caches/node-gyp/15.3.0',
43 error gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
43 error gyp info spawn args '-Dnode_lib_file=/Users/timitejumola/Library/Caches/node-gyp/15.3.0/<(target_arch)/node.lib',
43 error gyp info spawn args '-Dmodule_root_dir=/Users/timitejumola/bcoin/node_modules/bcrypto',
43 error gyp info spawn args '-Dnode_engine=v8',
43 error gyp info spawn args '--depth=.',
43 error gyp info spawn args '--no-parallel',
43 error gyp info spawn args '--generator-output',
43 error gyp info spawn args 'build',
43 error gyp info spawn args '-Goutput_dir=.'
43 error gyp info spawn args ]
43 error gyp info spawn make
43 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
43 error In file included from ../src/torsion/src/dsa.c:34:
43 error In file included from ../src/torsion/src/asn1.h:13:
43 error In file included from ../src/torsion/src/mpz.h:20:
43 error ../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
43 error mpn_tdiv_qr(mp_limb_t *qp,
43 error ^
43 error ../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
43 error mpn_gcdext(mp_limb_t *gp,
43 error ^
43 error In file included from ../src/torsion/src/dsa.c:34:
43 error In file included from ../src/torsion/src/asn1.h:13:
43 error ../src/torsion/src/mpz.h:448:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
43 error mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
43 error ^
43 error ../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
43 error #define mpz_random_prime torsion_mpz_random_prime
43 error ^
43 error In file included from ../src/torsion/src/dsa.c:34:
43 error ../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
43 error asn1_read_int(unsigned char *out, size_t out_len,
43 error ^
43 error ../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
43 error asn1_size_int(const unsigned char *num, size_t len) {
43 error ^
43 error ../src/torsion/src/asn1.h:332:1: warning: unused function 'asn1_write_int' [-Wunused-function]
43 error asn1_write_int(unsigned char *data, size_t pos,
43 error ^
43 error 6 warnings generated.
43 error In file included from ../src/torsion/src/ecc.c:159:
43 error ../src/torsion/src/fields/p224.h:170:1: warning: unused function 'p224_fe_is_square' [-Wunused-function]
43 error p224_fe_is_square(const p224_fe_t in) {
43 error ^
43 error In file included from ../src/torsion/src/ecc.c:168:
43 error In file included from ../src/torsion/src/asn1.h:13:
43 error In file included from ../src/torsion/src/mpz.h:20:
43 error ../src/torsion/src/gmp-compat.h:103:1: warning: unused function 'mpz_powm_sec' [-Wunused-function]
43 error mpz_powm_sec(mpz_t rop, const mpz_t base, const mpz_t exp, const mpz_t mod) {
43 error ^
43 error In file included from ../src/torsion/src/ecc.c:168:
43 error In file included from ../src/torsion/src/asn1.h:13:
43 error ../src/torsion/src/mpz.h:42:1: warning: unused function 'torsion_mpz_roset' [-Wunused-function]
43 error mpz_roset(mpz_t r, const mpz_t x) {
43 error ^
43 error ../src/torsion/src/mpz.h:25:19: note: expanded from macro 'mpz_roset'
43 error #define mpz_roset torsion_mpz_roset
43 error ^
43 error ../src/torsion/src/mpz.h:80:1: warning: unused function 'torsion_mpz_export_pad' [-Wunused-function]
43 error mpz_export_pad(unsigned char *out, const mpz_t n, size_t size, int endian) {
43 error ^
43 error ../src/torsion/src/mpz.h:28:24: note: expanded from macro 'mpz_export_pad'
43 error #define mpz_export_pad torsion_mpz_export_pad
43 error ^
43 error ../src/torsion/src/mpz.h:448:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
43 error mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
43 error ^
43 error ../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
43 error #define mpz_random_prime torsion_mpz_random_prime
43 error ^
43 error In file included from ../src/torsion/src/ecc.c:168:
43 error ../src/torsion/src/asn1.h:204:1: warning: unused function 'asn1_read_version' [-Wunused-function]
43 error asn1_read_version(const unsigned char **data, size_t *len,
43 error ^
43 error ../src/torsion/src/asn1.h:235:1: warning: unused function 'asn1_read_dumb' [-Wunused-function]
43 error asn1_read_dumb(mpz_t n, const unsigned char **data, size_t *len) {
43 error ^
43 error ../src/torsion/src/asn1.h:286:1: warning: unused function 'asn1_size_mpz' [-Wunused-function]
43 error asn1_size_mpz(const mpz_t n) {
43 error ^
43 error ../src/torsion/src/asn1.h:301:1: warning: unused function 'asn1_size_version' [-Wunused-function]
43 error asn1_size_version(unsigned char version) {
43 error ^
43 error ../src/torsion/src/asn1.h:366:1: warning: unused function 'asn1_write_mpz' [-Wunused-function]
43 error asn1_write_mpz(unsigned char *data, size_t pos, const mpz_t n) {
43 error ^
43 error ../src/torsion/src/asn1.h:396:1: warning: unused function 'asn1_write_version' [-Wunused-function]
43 error asn1_write_version(unsigned char *data, size_t pos, unsigned char version) {
43 error ^
43 error ../src/torsion/src/asn1.h:404:1: warning: unused function 'asn1_write_dumb' [-Wunused-function]
43 error asn1_write_dumb(unsigned char *data, size_t pos, const mpz_t n) {
43 error ^
43 error ../src/torsion/src/ecc.c:719:1: warning: unused function 'sc_swap' [-Wunused-function]
43 error sc_swap(const scalar_field_t *sc, sc_t a, sc_t b, unsigned int flag) {
43 error ^
43 error ../src/torsion/src/ecc.c:852:1: warning: unused function 'sc_sub' [-Wunused-function]
43 error sc_sub(const scalar_field_t *sc, sc_t r, const sc_t a, const sc_t b) {
43 error ^
43 error ../src/torsion/src/ecc.c:1811:1: warning: unused function 'fe_random' [-Wunused-function]
43 error fe_random(const prime_field_t *fe, fe_t x, drbg_t *rng) {
43 error ^
43 error ../src/torsion/src/ecc.c:2049:1: warning: unused function 'wge_validate' [-Wunused-function]
43 error wge_validate(const wei_t *ec, const wge_t *p) {
43 error ^
43 error ../src/torsion/src/ecc.c:2202:1: warning: unused function 'wge_swap' [-Wunused-function]
43 error wge_swap(const wei_t *ec, wge_t *a, wge_t *b, unsigned int flag) {
43 error ^
43 error ../src/torsion/src/ecc.c:2242:1: warning: unused function 'wge_equal' [-Wunused-function]
43 error wge_equal(const wei_t *ec, const wge_t *a, const wge_t *b) {
43 error ^
43 error ../src/torsion/src/ecc.c:2271:1: warning: unused function 'wge_is_square_var' [-Wunused-function]
43 error wge_is_square_var(const wei_t *ec, const wge_t *p) {
43 error ^
43 error ../src/torsion/src/ecc.c:2284:1: warning: unused function 'wge_equal_x' [-Wunused-function]
43 error wge_equal_x(const wei_t *ec, const wge_t *p, const fe_t x) {
43 error ^
43 error ../src/torsion/src/ecc.c:2443:1: warning: unused function 'wge_dbl' [-Wunused-function]
43 error wge_dbl(const wei_t *ec, wge_t *r, const wge_t *p) {
43 error ^
43 error ../src/torsion/src/ecc.c:2580:1: warning: unused function 'jge_cleanse' [-Wunused-function]
43 error jge_cleanse(const wei_t *ec, jge_t *r) {
43 error ^
43 error ../src/torsion/src/ecc.c:2589:1: warning: unused function 'jge_swap' [-Wunused-function]
43 error jge_swap(const wei_t *ec, jge_t *a, jge_t *b, unsigned int flag) {
43 error ^
43 error ../src/torsion/src/ecc.c:2627:1: warning: unused function 'jge_equal' [-Wunused-function]
43 error jge_equal(const wei_t *ec, const jge_t *a, const jge_t *b) {
43 error ^
43 error ../src/torsion/src/ecc.c:2658:1: warning: unused function 'jge_is_square' [-Wunused-function]
43 error jge_is_square(const wei_t *ec, const jge_t *p) {
43 error ^
43 error ../src/torsion/src/ecc.c:2760:1: warning: unused function 'jge_neg_cond' [-Wunused-function]
43 error jge_neg_cond(const wei_t *ec, jge_t *r, const jge_t *a, unsigned int flag) {
43 error ^
43 error ../src/torsion/src/ecc.c:3294:1: warning: unused function 'jge_sub' [-Wunused-function]
43 error jge_sub(const wei_t *ec, jge_t *r, const jge_t *a, const jge_t *b) {
43 error ^
43 error ../src/torsion/src/ecc.c:3442:1: warning: unused function 'jge_mixed_sub' [-Wunused-function]
43 error jge_mixed_sub(const wei_t *ec, jge_t *r, const jge_t *a, const wge_t *b) {
43 error ^
43 error ../src/torsion/src/ecc.c:3508:1: warning: unused function 'jge_validate' [-Wunused-function]
43 error jge_validate(const wei_t *ec, const jge_t *p) {
43 error ^
43 error ../src/torsion/src/ecc.c:4216:1: warning: unused function 'wei_mul_multi_var' [-Wunused-function]
43 error wei_mul_multi_var(const wei_t *ec,
43 error ^
43 error ../src/torsion/src/ecc.c:4729:1: warning: unused function 'mge_zero' [-Wunused-function]
43 error mge_zero(const mont_t *ec, mge_t *r) {
43 error ^
43 error ../src/torsion/src/ecc.c:4765:1: warning: unused function 'mge_validate' [-Wunused-function]
43 error mge_validate(const mont_t *ec, const mge_t *p) {
43 error ^
43 error ../src/torsion/src/ecc.c:4797:1: warning: unused function 'mge_set_xy' [-Wunused-function]
43 error mge_set_xy(const mont_t *ec, mge_t *r, const fe_t x, const fe_t y) {
43 error ^
43 error ../src/torsion/src/ecc.c:4829:1: warning: unused function 'mge_swap' [-Wunused-function]
43 error mge_swap(const mont_t *ec, mge_t *a, mge_t *b, unsigned int flag) {
43 error ^
43 error ../src/torsion/src/ecc.c:4843:1: warning: unused function 'mge_set' [-Wunused-function]
43 error mge_set(const mont_t *ec, mge_t *r, const mge_t *a) {
43 error ^
43 error ../src/torsion/src/ecc.c:4852:1: warning: unused function 'mge_equal' [-Wunused-function]
43 error mge_equal(const mont_t *ec, const mge_t a, const mge_t b) {
43 error ^
43 error ../src/torsion/src/ecc.c:4870:1: warning: unused function 'mge_is_zero' [-Wunused-function]
43 error mge_is_zero(const mont_t ec, const mge_t a) {
43 error ^
43 error ../src/torsion/src/ecc.c:4885:1: warning: unused function 'mge_dbl' [-Wunused-function]
43 error mge_dbl(const mont_t ec, mge_t r, const mge_t p) {
43 error ^
43 error ../src/torsion/src/ecc.c:5100:1: warning: unused function 'pge_validate' [-Wunused-function]
43 error pge_validate(const mont_t ec, const pge_t p) {
43 error ^
43 error ../src/torsion/src/ecc.c:5192:1: warning: unused function 'pge_equal' [-Wunused-function]
43 error pge_equal(const mont_t ec, const pge_t a, const pge_t b) {
43 error ^
43 error ../src/torsion/src/ecc.c:5828:1: warning: unused function 'xge_validate' [-Wunused-function]
43 error xge_validate(const edwards_t ec, const xge_t p) {
43 error ^
43 error ../src/torsion/src/ecc.c:5977:1: warning: unused function 'xge_swap' [-Wunused-function]
43 error xge_swap(const edwards_t ec, xge_t a, xge_t b, unsigned int flag) {
43 error ^
43 error ../src/torsion/src/ecc.c:6050:1: warning: unused function 'xge_neg_cond' [-Wunused-function]
43 error xge_neg_cond(const edwards_t ec, xge_t r, const xge_t a, unsigned int flag) {
43 error ^
43 error 43 warnings generated.
43 error ../src/torsion/src/hash.c:68:1: warning: unused function 'read64be' [-Wunused-function]
43 error read64be(const void src) {
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/torsion/src/rsa.c:29:
43 error In file included from ../src/torsion/src/asn1.h:13:
43 error In file included from ../src/torsion/src/mpz.h:20:
43 error ../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
43 error mpn_tdiv_qr(mp_limb_t qp,
43 error ^
43 error ../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
43 error mpn_gcdext(mp_limb_t gp,
43 error ^
43 error In file included from ../src/torsion/src/rsa.c:29:
43 error ../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
43 error asn1_read_int(unsigned char out, size_t out_len,
43 error ^
43 error ../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
43 error asn1_size_int(const unsigned char num, size_t len) {
43 error ^
43 error ../src/torsion/src/asn1.h:332:1: warning: unused function 'asn1_write_int' [-Wunused-function]
43 error asn1_write_int(unsigned char data, size_t pos,
43 error ^
43 error ../src/torsion/src/rsa.c:1024:1: warning: unused function 'rsa_pub_set' [-Wunused-function]
43 error rsa_pub_set(rsa_pub_t r, const rsa_pub_t k) {
43 error ^
43 error 6 warnings generated.
43 error In file included from ../src/aead.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/base58.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/bech32.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/bcrypto.cc:7:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/blake2b.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/blake2s.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/cash32.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/chacha20.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/dsa.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/dsa_async.cc:3:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/ecdh.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/ecdsa.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/eddsa.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/hash.cc:3:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/hmac.cc:3:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/keccak.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/murmur3.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/pbkdf2.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/pbkdf2_async.cc:2:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/poly1305.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/rsa.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/rsa_async.cc:3:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/salsa20.cc:1:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/schnorr.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/scrypt.cc:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/scrypt_async.cc:2:
43 error In file included from ../src/common.h:4:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/siphash.cc:5:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error In file included from ../src/util.cc:3:
43 error In file included from ../../nan/nan.h:2884:
43 error ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
43 error data = static_cast<char
>(buffer->GetContents().Data()) + byte_offset;
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8.h:5317:3: note: 'GetContents' has been explicitly marked deprecated here
43 error V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
43 error ^
43 error /Users/timitejumola/Library/Caches/node-gyp/15.3.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
43 error # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
43 error ^
43 error 1 warning generated.
43 error ../src/torsion/src/mini-gmp.c:717:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_ctz (cnt, limb);
43 error ^~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:112:5: note: expanded from macro 'gmp_ctz'
43 error gmp_clz (__ctz_c, __ctz_x & - __ctz_x);
43 error ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:894:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_clz (shift, d);
43 error ^~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:907:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_clz (shift, d1);
43 error ^~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:937:7: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_clz (shift, d1);
43 error ^~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:1196:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_clz (shift, u);
43 error ^~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:1738:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_clz (m, l);
43 error ^~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:2635:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_ctz (shift, u | v);
43 error ^~~~~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:112:5: note: expanded from macro 'gmp_ctz'
43 error gmp_clz (__ctz_c, __ctz_x & - __ctz_x);
43 error ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:3350:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_ctz(c, a);
43 error ^~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:112:5: note: expanded from macro 'gmp_ctz'
43 error gmp_clz (__ctz_c, __ctz_x & - __ctz_x);
43 error ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:3370:7: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error gmp_ctz(c, a);
43 error ^~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:112:5: note: expanded from macro 'gmp_ctz'
43 error gmp_clz (__ctz_c, __ctz_x & - __ctz_x);
43 error ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:99:23: note: expanded from macro 'gmp_clz'
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error ../src/torsion/src/mini-gmp.c:3992:25: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
43 error if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
43 error ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
43 error 10 warnings generated.
43 error In file included from ../src/secp256k1/src/secp256k1.c:12:
43 error In file included from ../src/secp256k1/src/scalar_impl.h:20:
43 error ../src/secp256k1/src/scalar_4x64_impl.h:969:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
43 error memcpy((void *) seed32, (const void *) seed, 32);
43 error ^
43 error ../src/secp256k1/src/scalar_4x64_impl.h:969:5: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
43 error 1 error generated.
43 error make: *** [Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o] Error 1
43 error gyp ERR! build error
43 error gyp ERR! stack Error: make failed with exit code: 2
43 error gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
43 error gyp ERR! stack at ChildProcess.emit (node:events:376:20)
43 error gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
43 error gyp ERR! System Darwin 19.6.0
43 error gyp ERR! command "/usr/local/Cellar/node/15.3.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
43 error gyp ERR! cwd /Users/timitejumola/bcoin/node_modules/bcrypto
43 error gyp ERR! node -v v15.3.0
43 error gyp ERR! node-gyp -v v7.1.2
43 error gyp ERR! not ok
44 verbose exit 1

Symbol not found: _mpn_zero_p

environment:MacOS

dyld: Symbol not found: _mpn_zero_p
Referenced from: /xxxx/node_modules/bcrypto/build/Release/bcrypto.node
Expected in: flat namespace

Usage with browsers

Hey, currently trying to use this package in a browser when bundling with rollup and the issue seems to be that Buffer is undefined. Is the expectation that a Buffer polyfill will be used for bundlers like webpack and rollup? Wondering since the description mentions browser support.

Feature request: ESM support

As for many other GH projects, I'd love to use this package in the browser with tree-shaking possibility, so with ESM enable on it.
But currently, it uses Node-style CommonJS.

Would it be possible to support ESM through package.json fields?

ESM loading is also coming to Node.js.

I would be happy to open a pull request but wish to confirm interest from the maintainers first.

WARNING: Identifier directly after number

Get the following warning from building

WARNING in ./node_modules/bcrypto/lib/node/bn.js 51:17
    Module parse failed: Identifier directly after number (51:17)
    You may need an appropriate loader to handle this file type.
    |  */
    |
    > const U8_MAX = (1n << 8n) - 1n;
    | const U16_MAX = (1n << 16n) - 1n;

bcrypto fails to build on windows

Currently building bcrypto on Windows seems to fail, at least with GitHub Actions as I don't have a Windows machine at hand with a development environment to test it there.

2020-06-22T16:23:41.6430389Z ##[group]Run yarn install --frozen-lockfile
2020-06-22T16:26:34.4465741Z error D:\a\desktop-wallet\desktop-wallet\node_modules\@arkecosystem\platform-sdk-crypto\node_modules\bcrypto: Command failed.
2020-06-22T16:26:34.4466189Z Exit code: 1
2020-06-22T16:26:34.4466579Z info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2020-06-22T16:26:34.4467098Z Command: node-gyp rebuild
2020-06-22T16:26:34.4467349Z Arguments: 
2020-06-22T16:26:34.4467833Z Directory: D:\a\desktop-wallet\desktop-wallet\node_modules\@arkecosystem\platform-sdk-crypto\node_modules\bcrypto
2020-06-22T16:26:34.4468131Z Output:
2020-06-22T16:26:34.4468447Z gyp info it worked if it ends with ok
2020-06-22T16:26:34.4468803Z gyp info using [email protected]
2020-06-22T16:26:34.4469334Z gyp info using [email protected] | win32 | x64
2020-06-22T16:26:34.4469763Z gyp info find Python using Python version 3.7.7 found at "C:\hostedtoolcache\windows\Python\3.7.7\x64\python.exe"
2020-06-22T16:26:34.4470131Z gyp info find VS using VS2019 (16.6.30128.74) found at:
2020-06-22T16:26:34.4470512Z gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
2020-06-22T16:26:34.4470862Z gyp info find VS run with --verbose for detailed information
2020-06-22T16:26:34.4471224Z gyp info spawn C:\hostedtoolcache\windows\Python\3.7.7\x64\python.exe
2020-06-22T16:26:34.4471511Z gyp info spawn args [
2020-06-22T16:26:34.4472578Z gyp info spawn args   'C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\gyp\\gyp_main.py',
2020-06-22T16:26:34.4472950Z gyp info spawn args   'binding.gyp',
2020-06-22T16:26:34.4473293Z gyp info spawn args   '-f',
2020-06-22T16:26:34.4473580Z gyp info spawn args   'msvs',
2020-06-22T16:26:34.4473863Z gyp info spawn args   '-I',
2020-06-22T16:26:34.4474419Z gyp info spawn args   'D:\\a\\desktop-wallet\\desktop-wallet\\node_modules\\@arkecosystem\\platform-sdk-crypto\\node_modules\\bcrypto\\build\\config.gypi',
2020-06-22T16:26:34.4474746Z gyp info spawn args   '-I',
2020-06-22T16:26:34.4475181Z gyp info spawn args   'C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\addon.gypi',
2020-06-22T16:26:34.4475498Z gyp info spawn args   '-I',
2020-06-22T16:26:34.4476220Z gyp info spawn args   'C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\12.18.0\\include\\node\\common.gypi',
2020-06-22T16:26:34.4476647Z gyp info spawn args   '-Dlibrary=shared_library',
2020-06-22T16:26:34.4476970Z gyp info spawn args   '-Dvisibility=default',
2020-06-22T16:26:34.4477443Z gyp info spawn args   '-Dnode_root_dir=C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\12.18.0',
2020-06-22T16:26:34.4478048Z gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp',
2020-06-22T16:26:34.4478582Z gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\runneradmin\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\12.18.0\\\\<(target_arch)\\\\node.lib',
2020-06-22T16:26:34.4479112Z gyp info spawn args   '-Dmodule_root_dir=D:\\a\\desktop-wallet\\desktop-wallet\\node_modules\\@arkecosystem\\platform-sdk-crypto\\node_modules\\bcrypto',
2020-06-22T16:26:34.4479448Z gyp info spawn args   '-Dnode_engine=v8',
2020-06-22T16:26:34.4479744Z gyp info spawn args   '--depth=.',
2020-06-22T16:26:34.4480079Z gyp info spawn args   '--no-parallel',
2020-06-22T16:26:34.4480453Z gyp info spawn args   '--generator-output',
2020-06-22T16:26:34.4480938Z gyp info spawn args   'D:\\a\\desktop-wallet\\desktop-wallet\\node_modules\\@arkecosystem\\platform-sdk-crypto\\node_modules\\bcrypto\\build',
2020-06-22T16:26:34.4481271Z gyp info spawn args   '-Goutput_dir=.'
2020-06-22T16:26:34.4481552Z gyp info spawn args ]
2020-06-22T16:26:34.4481976Z gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe
2020-06-22T16:26:34.4482273Z gyp info spawn args [
2020-06-22T16:26:34.4482582Z gyp info spawn args   'build/binding.sln',
2020-06-22T16:26:34.4482903Z gyp info spawn args   '/clp:Verbosity=minimal',
2020-06-22T16:26:34.4483204Z gyp info spawn args   '/nologo',
2020-06-22T16:26:34.4483586Z gyp info spawn args   '/p:Configuration=Release;Platform=x64'
2020-06-22T16:26:34.4483869Z gyp info spawn args ]
2020-06-22T16:26:34.4484288Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2020-06-22T16:26:34.4484560Z   base58.c
2020-06-22T16:26:34.4484809Z   bech32.c
2020-06-22T16:26:34.4485056Z   cash32.c
2020-06-22T16:26:34.4485299Z   murmur3.c
2020-06-22T16:26:34.4485539Z   aead.c
2020-06-22T16:26:34.4485787Z   chacha20.c
2020-06-22T16:26:34.4486055Z   drbg.c
2020-06-22T16:26:34.4486296Z   dsa.c
2020-06-22T16:26:34.4486533Z   ecc.c
2020-06-22T16:26:34.4486768Z   hash.c
2020-06-22T16:26:34.4487136Z   kdf.c
2020-06-22T16:26:34.4487374Z   poly1305.c
2020-06-22T16:26:34.4487614Z   rsa.c
2020-06-22T16:26:34.4487855Z   salsa20.c
2020-06-22T16:26:34.4488097Z   siphash.c
2020-06-22T16:26:34.4488334Z   util.c
2020-06-22T16:26:34.4488621Z   bcrypto.cc
2020-06-22T16:26:34.4488867Z   mini-gmp.c
2020-06-22T16:26:34.4489120Z   secp256k1.c
2020-06-22T16:26:34.4489939Z D:\a\desktop-wallet\desktop-wallet\node_modules\@arkecosystem\platform-sdk-crypto\node_modules\bcrypto\src\secp256k1\src\secp256k1.c : fatal error C1083: Cannot open compiler generated file: '': Invalid argument [D:\a\desktop-wallet\desktop-wallet\node_modules\@arkecosystem\platform-sdk-crypto\node_modules\bcrypto\build\bcrypto.vcxproj]
2020-06-22T16:26:34.4490334Z gyp ERR! build error 
2020-06-22T16:26:34.4490818Z gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
2020-06-22T16:26:34.4491316Z gyp ERR! stack     at ChildProcess.onExit (C:\Users\runneradmin\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\build.js:194:23)
2020-06-22T16:26:34.4491686Z gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
2020-06-22T16:26:34.4492083Z gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2020-06-22T16:26:34.4492406Z gyp ERR! System Windows_NT 10.0.17763
2020-06-22T16:26:34.4493104Z gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\12.18.0\\x64\\node.exe" "C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
2020-06-22T16:26:34.4493644Z gyp ERR! cwd D:\a\desktop-wallet\desktop-wallet\node_modules\@arkecosystem\platform-sdk-crypto\node_modules\bcrypto
2020-06-22T16:26:34.4493967Z gyp ERR! node -v v12.18.0
2020-06-22T16:26:34.4494263Z gyp ERR! node-gyp -v v7.0.0
2020-06-22T16:26:34.4494536Z gyp ERR! not ok
2020-06-22T16:26:34.4958706Z ##[error]Process completed with exit code 1.
2020-06-22T16:26:34.5114891Z Post job cleanup.
2020-06-22T16:26:36.1251045Z [command]"C:\Program Files\Git\bin\git.exe" version
2020-06-22T16:26:36.1424143Z git version 2.27.0.windows.1
2020-06-22T16:26:36.1483570Z [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp core\.sshCommand
2020-06-22T16:26:36.1691417Z [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2020-06-22T16:26:36.6081676Z [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2020-06-22T16:26:36.6243909Z http.https://github.com/.extraheader
2020-06-22T16:26:36.6290119Z [command]"C:\Program Files\Git\bin\git.exe" config --local --unset-all http.https://github.com/.extraheader
2020-06-22T16:26:36.6505431Z [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2020-06-22T16:26:37.0882980Z Cleaning up orphan processes
2020-06-22T16:26:37.1117923Z Terminate orphan process: pid (6952) (vctip)

[SECURITY] Timing leaks in lib/native/bn.js

  • Branching timing leaks
  • powm leaks the value of e
    • bcrypto/lib/native/bn.js

      Lines 3869 to 3897 in b73dbc6

      function powm(x, e, m) {
      assert(m > 0n);
      if (e < 0n) {
      x = invert(x, m);
      e = -e;
      } else {
      x = mod(x, m);
      }
      if (e <= U32_MAX)
      return rtl(x, e, m);
      return slide(x, e, m);
      }
      function rtl(x, e, m) {
      let r = 1n;
      while (e > 0n) {
      if ((e & 1n) === 1n)
      r = (r * x) % m;
      x = (x * x) % m;
      e >>= 1n;
      }
      return r;
      }
    • bcrypto/lib/native/bn.js

      Lines 3889 to 3893 in b73dbc6

      if ((e & 1n) === 1n)
      r = (r * x) % m;
      x = (x * x) % m;
      e >>= 1n;
    • (This also breaks any modular inversion that relies on fermat())

I wrote a library that implements constant-time algorithms in TypeScript if you want to mitigate these risks.

Further reading: [1] [2]

Feature Request: Sparse Merkle Tree

I think its possible to create a wrapper over lib/mrkl.js to create a sparse merkle tree with an easy to use API. This could be used to add commitments to all previous blocks in the block header, allowing for a Flyclient like construction. Light clients will be able to run even lighter as they will not need to index all previous blocks and can just keep the latest block indexed.

Potential API:

  • Constructor with hashing algo, number of leaves
  • Set an item at an index
  • Delete an item at an index
  • Get an item at an index
  • Push an item to the next index, when the consumer doesn't want to manage the index and just wants to add items to a set
  • Get root
  • Get proof (inclusion/exclusion)
  • Clear cache

It would also be cool to allow for passing custom read/write functions, similar to how bcoin has a custom createSocket function, so that different storage backends can be used/tested.

Is this something that you would consider for bcrypto?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.