jedisct1 / libsodium

A modern, portable, easy to use crypto library.
https://libsodium.org
Other
12.22k stars 1.74k forks source link

Portability improvements #1105

Closed jorgenpt closed 3 years ago

jorgenpt commented 3 years ago

Improve portability to aid in porting libsodium to modern game consoles:

angt commented 3 years ago

goodjob

jedisct1 commented 3 years ago

Thank you!

The check for __wasm__ instead of HAVE_RAISE was intentional. With your changes, compilation to WASI fails:

In file included from sodium/utils.c:13:
/opt/zig/lib/zig/libc/include/wasm-wasi-musl/signal.h:2:2:
#error "wasm lacks signal support; to enable minimal signal emulation

We need to check both :)

jorgenpt commented 3 years ago

@jedisct1, ah! I assumed the header didn't exist, thank you for addressing that. Is the __wasm__ still needed before the raise call? Does it actually provide an implementation for raise? :)

jedisct1 commented 3 years ago

It's actually optional, and requires an additional library to be linked in order to be emulated. But emulation is very limited.