These functions are a little bit special, because unlike everything
else, they do dynamic memory allocations, and are more likely to fail.
Applications are expected to check the return code, and these functions
are tagged with ((warn_unused_result)) but applications may still
ignore these.
This is also an issue with JavaScript, when total memory hasn't been
properly configured.
To be safe, fill the buffer with non-deterministic bytes, that are
unlikely to ever verify later.
A compiler trying to be too smart could notice that we are shifting
ununitialized data (even though we then discard it), and apply
unwanted optimizations.
* Move `raise` code to be behind an autoconf check
This moves the call to `raise` behind a `HAVE_RAISE` autoconf check,
in addition to `__wasm__`. This is intended to help porting to
other platforms that don't support `raise` (e.g. modern game consoles).
* Add autoconf check for `sysconf`
Only try to invoke `sysconf` if the target platform supports it, and
don't warn about unknown page size if `PAGE_SIZE` was defined. Add an
include for `sys/param.h` to increase likelihood of finding `PAGE_SIZE`.
This is intended to help porting to other platforms that don't support
`sysconf` (e.g. modern game consoles) that have a fixed hardware page
size.
* Don't try to use raise & sysconf in a WASI environment
Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
There is a small typo in src/libsodium/include/sodium/crypto_hash.h, src/libsodium/include/sodium/crypto_hash_sha256.h, src/libsodium/include/sodium/crypto_hash_sha512.h.
Should read `interoperability` rather than `interoperatibility`.
Thanks to precomputation, the generic implementation is faster.
Don't even define a .mult_base placeholder for sandy2x
Avoid two indirections for fixed base multiplication until another
implementation possibly exists.