ce3cbf0857
This also removes nixcrpkgs and OSX cross compilation in favour of compiling on the target. x86_64/musl targets are still supported on Linux. All sources are now managed via niv (see nix/sources.json) and Haskell package sets are provided/organised via IOHK's haskell.nix. Some effort has been made to expose similar top-level attributes for development, but in some cases there have been changes. Please see the comments in the top-level default.nix and ci.nix files for usage. |
||
---|---|---|
.. | ||
.gitignore | ||
configure | ||
ent.c | ||
ent.h | ||
LICENSE | ||
Makefile | ||
README.md | ||
shell.nix | ||
test.c |
libent
libent
is a cross-platform wrapper around getentropy(2)
. It exports
one symbol, ent_getentropy
. If getentropy is available, then it's just
a shim around that. Otherwise, it uses getrandom(2)
(available since
kernel 3.17) on Linux, or /dev/urandom
on other *nix.
Building and Testing
./configure
make
make test
PREFIX=/usr/local make install
Why?
getentropy
is the wave of the future. It's the correct API for
generating small amounts of entropy to create cryptographic keys or seed
PRNGs. It's good and reasonable and true, it's on Linux, *BSD, and OS
X, and it only took us fifty years of UNIX to get here.
Sadly, it only just arrived, so nobody has it yet. It didn't land in Linux until glibc 2.25, which seems to only have made it into Debian 10.
Once getentropy
is everywhere you care about, you can just do a
s/ent_//g on all the call sites and discard this shim.
This project began because Urbit's entropy-generation function was bothering me. Then it got out of hand.