Code Monkey home page Code Monkey logo

Comments (12)

madenmud avatar madenmud commented on July 17, 2024

build at node_modules manually.

mkdir sodium
cd sodium
git clone https://github.com/paixaop/node-sodium.git
mv node-sodium/* ./
vi deps/libsodium-0.4.5/src/libsodium/crypto_onetimeauth/poly1305/donna/portable-jane.h

-change deps/libsodium.gyp as below diff.

6c6,7
<                 'target_arch%': 'ia32'
---
>                 #'target_arch%': 'ia32'
>                 'target_arch%': 'arm'
15,16c16,17
<                     'HAVE_AMD64_ASM=1',
<                     'SODIUM_HAVE_AMD64_ASM',
---
>                     #'HAVE_AMD64_ASM=1',
>                     #'SODIUM_HAVE_AMD64_ASM',
38c39
<                     'HAVE_X86INTRIN_H=1',
---
>                     #'HAVE_X86INTRIN_H=1',
42,43c43,44
<                     'HAVE_AMD64_ASM=1',
<                     'HAVE_TI_MODE=1',
---
>                     #'HAVE_AMD64_ASM=1',
>                     #'HAVE_TI_MODE=1',
212c213
<                     'libsodium-<(naclversion)/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S',
---
>                     #'libsodium-<(naclversion)/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S',
238c239
< }
\ No newline at end of file
---
> }
  • then

node-gyp rebuild

from node-sodium.

paixaop avatar paixaop commented on July 17, 2024

just updated lib sodium to 1.0.0 and removed the ASM code. so if you update the arch in the lib sodium.gyp it should work now.
Please let me know.

from node-sodium.

madenmud avatar madenmud commented on July 17, 2024

It is working.

from node-sodium.

paixaop avatar paixaop commented on July 17, 2024

can you send me your gyp file so I can merge it?

from node-sodium.

Natim avatar Natim commented on July 17, 2024

FWIW I also reproduce this matter with i686 this means it works only on x86_64 apparently

from node-sodium.

Natim avatar Natim commented on July 17, 2024

Here is what I had to change to compile it:

diff --git a/deps/libsodium.gyp b/deps/libsodium.gyp
index f05456f..9ded9aa 100755
--- a/deps/libsodium.gyp
+++ b/deps/libsodium.gyp
@@ -53,7 +53,7 @@
                     'HAVE_FENV_H=1',
                     'NATIVE_LITTLE_ENDIAN=1',
                     #'HAVE_AMD64_ASM=1',
-                    'HAVE_TI_MODE=1',
+                    #'HAVE_TI_MODE=1',
                     'HAVE_CPUID=1',
                     'HAVE_LIBM=1'
             ],

Then node-gyp rebuild

from node-sodium.

Natim avatar Natim commented on July 17, 2024

I can confirm that this patch also works both on x86_64 and i686

from node-sodium.

Natim avatar Natim commented on July 17, 2024

See #30

from node-sodium.

r-arias avatar r-arias commented on July 17, 2024

@Natim Thanks, that fix enables me to compile master on 32bit. However, I get errors during make test:

Error: /home/emotest/node-sodium/build/Release/sodium.node: undefined symbol: crypto_scalarmult_curve25519
    at Error (native)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/emotest/node-sodium/test/test_auth.js:5:14)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at /home/emotest/node-sodium/node_modules/mocha/lib/mocha.js:184:27
    at Array.forEach (native)
    at Mocha.loadFiles (/home/emotest/node-sodium/node_modules/mocha/lib/mocha.js:181:14)
    at Mocha.run (/home/emotest/node-sodium/node_modules/mocha/lib/mocha.js:393:31)
    at Object.<anonymous> (/home/emotest/node-sodium/node_modules/mocha/bin/_mocha:380:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Function.Module.runMain (module.js:490:10)
    at startup (node.js:124:16)
    at node.js:807:3
make: *** [test-unit] Error 1

It might be important to note that I am also using @jonasfj's patches in order to compile vs. node 0.11.13. If I pull his fork directly and try to compile that on 32 bit, setting #'HAVE_TI_MODE=1',, I get the same error.
I discovered the following:

node-sodium$ nm build/Release/sodium.node | grep scalarmult
0002dc80 T crypto_scalarmult
0002dc70 T crypto_scalarmult_base
0002dc40 T crypto_scalarmult_bytes
         U crypto_scalarmult_curve25519
         U crypto_scalarmult_curve25519_base
0002dc60 T crypto_scalarmult_primitive
0002dc50 T crypto_scalarmult_scalarbytes
000340a0 T crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime
00035050 T crypto_sign_ed25519_ref10_ge_scalarmult_base
0001cdf0 T _Z22bind_crypto_scalarmultRKN2v820FunctionCallbackInfoINS_5ValueEEE
00017320 T _Z27bind_crypto_scalarmult_baseRKN2v820FunctionCallbackInfoINS_5ValueEEE

from node-sodium.

r-arias avatar r-arias commented on July 17, 2024

Does anyone have a hint for me how to fix this?

from node-sodium.

jonasfj avatar jonasfj commented on July 17, 2024

this sounds like a libsodium issue, not a node-sodium issue... Or maybe it part of how libsodium gets build...
Either way, I don't really have any good ideas. Perhaps start with getting libsodium to build...

Is this arm or i686 too? And any suggestions for how to reproduce, maybe supply a vagrant box...

from node-sodium.

paixaop avatar paixaop commented on July 17, 2024

can you try the develop branch?

from node-sodium.

Related Issues (20)

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.