Comments (14)
Once again, no need to touch the compiler flags.
There's a function to change the RNG, and it's documented: https://doc.libsodium.org/advanced/custom_rng
You should call it before sodium_init()
.
And try calling sodium_init()
as soon as possible, before you fork()
, spawn threads or whatever.
from libsodium.
I was not able to replicate this, no one ever reported this, and this doesn't happen on CI either.
From a vanilla macOS installation with Homebrew, what are the required steps (installation, minimal test case, compilation commands) to replicate this?
from libsodium.
rm -rf autom4te.cache configure Makefile.in ./src/Makefile.in ./src/libsodium/Makefile.in ./src/libsodium/include/Makefile.in ./builds/Makefile.in
./autogen.sh -f -s -o
/opt/d/C/sodium/configure --enable-static --disable-shared --without-pthreads --enable-opt
build with flags -UHAVE_AVX512FINTRIN_H -DHAVE_COMMONCRYPTO_COMMONRANDOM_H=1 -DHAVE_GETENTROPY=1 -DHAVE_TMMINTRIN_H -DHAVE_WMMINTRIN_H -Wuninitialized -DSODIUM_STATIC -DDEV_MODE
master branch.
now I will try RANDOMBYTES_DEFAULT_IMPLEMENTATION
with &randombytes_internal_implementation
from libsodium.
recent I upgrade into clang 16. not sure this related.
from libsodium.
Error 35
is EAGAIN
, which can only be returned for files opened in non-blocking mode. libsodium
never opens files in non-blocking mode. There's just no code that could possibly do that.
Are you sure your application doesn't do something else with file descriptor 4
?
from libsodium.
It is a huge project, I am not sure other part not touch fd 4.
from libsodium.
Please don't mess with the compilation flags, that doesn't help.
And try with 1.0.18-stable release tarballs and just use ./configure
as documented.
from libsodium.
Did the test suite pass when you typed make check
before make install
? Because it heavily uses randombytes_buf
.
from libsodium.
when I make test, get some missing symbol error. I will try fix this and made the test.
from libsodium.
????
What symbols are missing?
Was clang
installed via Homebrew? Or is it zig cc
?
from libsodium.
-DRANDOMBYTES_DEFAULT_IMPLEMENTATION=&randombytes_internal_implementation
with this patch fix my problem.
diff --git a/src/libsodium/randombytes/randombytes.c b/src/libsodium/randombytes/randombytes.c
index 6741434b..ab2429cf 100644
--- a/src/libsodium/randombytes/randombytes.c
+++ b/src/libsodium/randombytes/randombytes.c
@@ -15,7 +15,7 @@
#include "randombytes.h"
#ifndef RANDOMBYTES_CUSTOM_IMPLEMENTATION
# ifdef RANDOMBYTES_DEFAULT_IMPLEMENTATION
-# include "randombytes_internal.h"
+# include "randombytes_internal_random.h"
# endif
# include "randombytes_sysrandom.h"
#endif
the make test error
lld: error: undefined symbol: crypto_aead_aegis128l_aesni_implementation
>>> referenced by aead_aegis128l.c:142 (src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c:142)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-aead_aegis128l.o):(symbol _crypto_aead_aegis128l_pick_best_implementation+0x22)
lld: error: undefined symbol: crypto_stream_chacha20_dolbeau_ssse3_implementation
>>> referenced by stream_chacha20.c:0 (src/libsodium/crypto_stream/chacha20/stream_chacha20.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-stream_chacha20.o):(symbol _crypto_stream_chacha20_pick_best_implementation+0x2d)
lld: error: undefined symbol: crypto_stream_chacha20_dolbeau_avx2_implementation
>>> referenced by stream_chacha20.c:0 (src/libsodium/crypto_stream/chacha20/stream_chacha20.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-stream_chacha20.o):(symbol _crypto_stream_chacha20_pick_best_implementation+0x1b)
lld: error: undefined symbol: crypto_aead_aegis256_aesni_implementation
>>> referenced by aead_aegis256.c:141 (src/libsodium/crypto_aead/aegis256/aead_aegis256.c:141)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-aead_aegis256.o):(symbol _crypto_aead_aegis256_pick_best_implementation+0x22)
lld: error: undefined symbol: _sodium_blake2b_compress_ssse3
>>> referenced by blake2b-ref.c:0 (src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-blake2b-ref.o):(symbol _sodium_blake2b_pick_best_implementation+0x3a)
lld: error: undefined symbol: _sodium_blake2b_compress_sse41
>>> referenced by blake2b-ref.c:0 (src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-blake2b-ref.o):(symbol _sodium_blake2b_pick_best_implementation+0x1f)
lld: error: undefined symbol: _sodium_blake2b_compress_avx2
>>> referenced by blake2b-ref.c:0 (src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-blake2b-ref.o):(symbol _sodium_blake2b_pick_best_implementation+0xd)
lld: error: undefined symbol: crypto_onetimeauth_poly1305_sse2_implementation
>>> referenced by onetimeauth_poly1305.c:86 (src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c:86)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-onetimeauth_poly1305.o):(symbol _crypto_onetimeauth_poly1305_pick_best_implementation+0x1b)
lld: error: undefined symbol: _sodium_argon2_fill_segment_ssse3
>>> referenced by argon2-core.c:0 (src/libsodium/crypto_pwhash/argon2/argon2-core.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-argon2-core.o):(symbol _crypto_pwhash_argon2_pick_best_implementation+0x28)
lld: error: undefined symbol: _sodium_argon2_fill_segment_avx2
>>> referenced by argon2-core.c:0 (src/libsodium/crypto_pwhash/argon2/argon2-core.c:0)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-argon2-core.o):(symbol _crypto_pwhash_argon2_pick_best_implementation+0xd)
lld: error: undefined symbol: crypto_stream_salsa20_xmm6int_avx2_implementation
>>> referenced by stream_salsa20.c:89 (src/libsodium/crypto_stream/salsa20/stream_salsa20.c:89)
>>> ../../src/libsodium/.libs/libsodium.a(libsodium_la-stream_salsa20.o):(symbol _crypto_stream_salsa20_pick_best_implementation+0x1b)
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
from libsodium.
If you invent your own way to compile it, you are on your own.
Please compile as documented.
Either just with ./configure && make check && make install
, or with zig build -Doptimize=ReleaseFast
.
from libsodium.
Also, start from a fresh clone of the repository, or type make distclean
before ./configure
to get rid of a previous failed compilation.
from libsodium.
I use ./configure && make check && make install, get this result.
# TOTAL: 82
# PASS: 82
I find for the default systemrandom, it work after start init process. late on a client request get this error. so could be some code change the fd. (is there a way to reopen it?)
and '-DRANDOMBYTES_DEFAULT_IMPLEMENTATION=&randombytes_internal_implementation' is safe to use for apple OSX, iOS ?
from libsodium.
Related Issues (20)
- Update OS used to build .NET package HOT 20
- sodium_malloc() does not check return value from sodium_mlock() HOT 2
- Compiling test codes successfully ,but the generated executable file does not run. HOT 1
- Linker command failed - android-armv7 script HOT 6
- AES-256 GCM crypto_stream - are there any plans to support it? HOT 3
- is the constant crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX wrong? HOT 4
- Where can I download Libsodium DLLs? HOT 1
- Not all bits of secret key are significant in crypto_box_open HOT 3
- [Some error I got when I am implementing commitment scheme based on lib sodium] HOT 1
- AEGIS-[128,256]X HOT 2
- Cross platform decrypting
- strict-aliasing violation in blkxor pwhash_scryptsalsa208sha256_nosse.c HOT 1
- Test failing during pip install as a dependency of pynacl==1.5.0 on arm64/apple m1 image building HOT 1
- Chacha/box tests segfault when compiling with LLVM Polly HOT 1
- support for veilid crypto HOT 4
- aarch64 build fails after updating from 1.0.18 to 1.0.19 HOT 2
- android-ndk-r26-rc1 build error for stable HOT 6
- Why soname change from 23 to 26 HOT 1
- [UB] memcpy could be called on null dst pointer in function escrypt_r HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsodium.