diff --git a/.patch/openssl/0002-wasm-support.patch b/.patch/openssl/0002-wasm-support.patch index ddf2498c08..4cf7204549 100644 --- a/.patch/openssl/0002-wasm-support.patch +++ b/.patch/openssl/0002-wasm-support.patch @@ -30,16 +30,18 @@ index e62721e..6fcea0d 100644 "uClinux-dist" => { inherit_from => [ "BASE_unix" ], diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c -index d9e8f02..0bd63b0 100644 +index d9e8f02..7faf347 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c -@@ -379,17 +379,25 @@ void RAND_add(const void *buf, int num, double randomness) +@@ -379,17 +379,27 @@ void RAND_add(const void *buf, int num, double randomness) #if !defined(OPENSSL_NO_DEPRECATED_1_1_0) int RAND_pseudo_bytes(unsigned char *buf, int num) { -+#ifdef __EMSCRIPTEN__ ++#if defined(__wasi__) + arc4random_buf(buf, num); + return 1; ++#elif defined(__EMSCRIPTEN__) ++ return 1; +#else const RAND_METHOD *meth = RAND_get_rand_method(); @@ -53,13 +55,13 @@ index d9e8f02..0bd63b0 100644 int RAND_status(void) { -+#ifdef __EMSCRIPTEN__ ++#if defined(__EMSCRIPTEN__) || defined(__wasi__) + return 1; +#else EVP_RAND_CTX *rand; #ifndef OPENSSL_NO_DEPRECATED_3_0 const RAND_METHOD *meth = RAND_get_rand_method(); -@@ -401,6 +409,7 @@ int RAND_status(void) +@@ -401,6 +411,7 @@ int RAND_status(void) if ((rand = RAND_get0_primary(NULL)) == NULL) return 0; return EVP_RAND_get_state(rand) == EVP_RAND_STATE_READY; @@ -67,18 +69,20 @@ index d9e8f02..0bd63b0 100644 } #else /* !FIPS_MODULE */ -@@ -420,6 +429,10 @@ const RAND_METHOD *RAND_get_rand_method(void) +@@ -420,6 +431,12 @@ const RAND_METHOD *RAND_get_rand_method(void) int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, unsigned int strength) { -+#ifdef __EMSCRIPTEN__ ++#if defined(__wasi__) + arc4random_buf(buf, num); + return 1; ++#elif defined(__EMSCRIPTEN__) ++ return 1; +#else RAND_GLOBAL *dgbl; EVP_RAND_CTX *rand; #if !defined(OPENSSL_NO_DEPRECATED_3_0) && !defined(FIPS_MODULE) -@@ -451,6 +464,7 @@ int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, +@@ -451,6 +468,7 @@ int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, return EVP_RAND_generate(rand, buf, num, strength, 0, NULL, 0); return 0;