Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrypt causes UnsatisfiedLinkError #4

Closed
gurpreet- opened this issue May 23, 2018 · 1 comment
Closed

Scrypt causes UnsatisfiedLinkError #4

gurpreet- opened this issue May 23, 2018 · 1 comment
Assignees
Labels
bug You've found something that definitely should not happen, e.g a crash in a critical part of the lib resolved When the issue or problem was resolved successfully

Comments

@gurpreet-
Copy link
Contributor

The library throws an error:

java.lang.UnsatisfiedLinkError: Error looking up function 'crypto_pwhash_scryptsalsa208sha256_ll': undefined symbol: crypto_pwhash_scryptsalsa208sha256_ll
at com.sun.jna.Function.<init>(Function.java:245)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:566)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:542)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:528)
at com.sun.jna.Native.register(Native.java:1777)
at com.sun.jna.Native.register(Native.java:1648)
at com.goterl.lazycode.lazysodium.SodiumAndroid.<init>(SodiumAndroid.java:37)
at com.goterl.lazycode.lazysodium.SodiumAndroid.<init>(SodiumAndroid.java:17)
at com.goterl.lazycode.lazysodium.LoadTest.loads(LoadTest.java:21)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at android.support.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:101)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1962)

This error is caused by Scrypt. The Scrypt functions do not appear in the "minimal" version of Libsodium. The minimal version is targeted towards devices with low RAM and low storage requirements such as those running Android and iOS.

Indeed, Lazysodium for Android compiles against the minimal version of Libsodium.

Instead of removing the Scrypt related functions from both Java and Android, these functions will be removed from just the Android variant.

If you really, really want to use Scrypt, then you will have to:

  1. First recompile the native C Libsodium in non-minimal mode.
  2. Then extend SodiumAndroid and copy in the Scrypt related functions from Lazysodium for Java.
@gurpreet- gurpreet- added the bug You've found something that definitely should not happen, e.g a crash in a critical part of the lib label May 23, 2018
@gurpreet- gurpreet- self-assigned this May 23, 2018
gurpreet- added a commit to terl/lazysodium-java that referenced this issue May 23, 2018
gurpreet- added a commit that referenced this issue May 23, 2018
This is a direct result of #4
@gurpreet-
Copy link
Contributor Author

This has been fixed in the latest release: version 2.0.0 but also introduces some breaking changes.

@gurpreet- gurpreet- added the resolved When the issue or problem was resolved successfully label May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug You've found something that definitely should not happen, e.g a crash in a critical part of the lib resolved When the issue or problem was resolved successfully
Projects
None yet
Development

No branches or pull requests

1 participant