* 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>
By default, lucetc generates code with explicit bound checking,
even though the runtime has guard pages.
Elision only happens with --reserved-size=4GiB
Justifications:
- crypto_(auth|hash|generichash|onetimeauth|shorthash)*:
it's legal to hash or HMAC a 0-length message
- crypto_box*: it's legal to encrypt a 0-length message
- crypto_sign*: it's legal to sign a 0-length message
- utils:
comparing two 0-length byte arrays is legal
memzero on a 0-length byte array is a no-op
converting an empty hex string to binary results in an empty binary string
converting an empty binary string to hex results in an empty hex string
converting an empty b64 string to binary results in an empty binary string
converting an empty binary string to b64 results in an empty b64 string
sodium_add / sodium_sub on zero-length arrays is a no-op
For the functions declared in utils.h, I moved the logic into private functions that
have the __attribute__ ((nonnull)) check, but they are only called when the
corresponding length argument is non-0. I didn't do this for the hash/box/sign
functions since it would have been a lot more work and quite a large refactor.
Only memset() may have issues with a zero length.
Fix tests, use guard page instead of NULL because of Wasm
Allows static builds to correctly inherit the pthread dependency when
used with pkg-config --static --libs libsodium
AC_SUBST doesn't require explicit values
Regen autoconf
Fixes#800
* master: (190 commits)
fileinput is not used any more
2019
local-dynamic is enough
Set tls-model only if TLS is supported
Enable -ftls-model=global-dynamic if available
Set nonce in randombytes_salsa20_random_stir() instead of random_init()
Bump .NET version examples
Add another test
Avoid memory leak and overflow in addition test
Avoid partial array initialization
Bump SODIUM_LIBRARY_VERSION_MINOR
More tests
More tests
Improve clarity
ALLOW_MEMORY_GROWTH is now enabled
AVX512 detection has been improved
Add a conditional to enable retpoline support
must -> should
Add comments, avoid implicit array initialization
Add comments
...