Use libent for getentropy

This commit is contained in:
Jōshin 2019-01-16 09:04:02 -08:00
parent 14a718d14d
commit 30b616dd8b
5 changed files with 8 additions and 12 deletions

3
.gitmodules vendored
View File

@ -7,6 +7,9 @@
[submodule "subprojects/h2o"]
path = subprojects/libh2o
url = https://github.com/urbit/h2o.git
[submodule "subprojects/libent"]
path = subprojects/libent
url = https://github.com/urbit/libent.git
[submodule "subprojects/libuv"]
path = subprojects/libuv
url = https://github.com/urbit/libuv.git

View File

@ -183,17 +183,6 @@
# define lseek64 lseek
# else
# error "port: timeconvert"
# endif
/* Entropy.
*/
# if defined(U3_OS_linux)
# define c3_getentropy(B, L) \
((L) == syscall(SYS_getrandom, B, L, 0) ? 0 : -1)
# elif defined(U3_OS_bsd) || defined(U3_OS_osx)
# define c3_getentropy getentropy
# else
# error "port: getentropy"
# endif
/* Static assertion.

View File

@ -320,6 +320,7 @@ endif
# For these libs we provide fallback bundle
argon2_dep = dependency('argon2', version: '>=1', fallback: ['argon2', 'argon2_dep'])
ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep'])
libent_dep = dependency('libent', version: '>=0.1.3', fallback: ['libent', 'libent_dep'])
libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'libh2o_dep'])
libscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_dep'])
libsni_dep = dependency('libsni', version: '>=0.5.0', fallback: ['libsni', 'libsni_dep'])
@ -332,6 +333,7 @@ deps = [argon2_dep,
curl_dep,
ed25519_dep,
gmp_dep,
libent_dep,
libh2o_dep,
libscrypt_dep,
libsni_dep,

1
subprojects/libent Submodule

@ -0,0 +1 @@
Subproject commit 7506fb31577fc5e185b31ed9f6ce6072e3f20637

View File

@ -1,6 +1,7 @@
/* vere/sist.c
**
*/
#include <ent.h>
#include <errno.h>
#include <fcntl.h>
#include <uv.h>
@ -406,7 +407,7 @@ _sist_bask(c3_c* pop_c, u3_noun may)
void
c3_rand(c3_w* rad_w)
{
if ( 0 != c3_getentropy(rad_w, 64) ) {
if ( 0 != ent_getentropy(rad_w, 64) ) {
uL(fprintf(uH, "c3_rand getentropy: %s\n", strerror(errno)));
u3_lo_bail();
}