File tree Expand file tree Collapse file tree
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626
2727// On Linux, prefer to use getrandom, though it isn't available in
2828// GLIBC before 2.25.
29- #if (defined(__linux__ ) || defined(ESP_PLATFORM ) || defined(__COSMOPOLITAN__ )) \
30- && (!defined(__GLIBC__ ) || __GLIBC__ > 2 \
31- || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25 ))
29+ //
30+ // NuttX has arc4random_buf, getrandom, and /dev/urandom.
31+ // We prefer getrandom here because it has the best chance to be usable.
32+ // - Our /dev/urandom usage (keep the open descriptor in a global variable)
33+ // is not compatible with NuttX flat memory model.
34+ // - arc4random_buf is only available with CONFIG_CRYPTO_RANDOM_POOL=y.
35+ #if defined(__NuttX__ ) \
36+ || ((defined(__linux__ ) || defined(ESP_PLATFORM ) \
37+ || defined(__COSMOPOLITAN__ )) \
38+ && (!defined(__GLIBC__ ) || __GLIBC__ > 2 \
39+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25 )))
3240#define CONFIG_HAS_GETRANDOM 1
3341#else
3442#define CONFIG_HAS_GETRANDOM 0
You can’t perform that action at this time.
0 commit comments