From a3236a596181b2fb174c34ecb9f0aacf2b9cb77e Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 31 May 2021 12:27:28 +0200 Subject: [PATCH] fix: add missing openssl/rand.h include Before https://github.com/nodejs/node/pull/35093 this include was explicitly there but it was remove in the refactor. Upstreamed at https://github.com/nodejs/node/pull/38864. --- ...ment_out_incompatible_crypto_modules.patch | 42 +++++-------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/patches/node/fix_comment_out_incompatible_crypto_modules.patch b/patches/node/fix_comment_out_incompatible_crypto_modules.patch index 3ed2193aaa397..d9c53bea09cd2 100644 --- a/patches/node/fix_comment_out_incompatible_crypto_modules.patch +++ b/patches/node/fix_comment_out_incompatible_crypto_modules.patch @@ -232,39 +232,19 @@ index 5fa91cce1a6ad2bc1167e20a4dadcfdfc2343440..d6db572ffac83b82eb3356a4d3258ae8 size_t out_len = 0; diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index fbe4c0f06c10df7c8a492711594381c27c6f81f7..1684a4242d160f5536c30ffef2a3acffa258cc4f 100644 +index fbe4c0f06c10df7c8a492711594381c27c6f81f7..76c8c037ffd3c8b67179d7d881ad6ea530b00686 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -61,6 +61,7 @@ int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) { - } - - void CheckEntropy() { -+#ifndef OPENSSL_IS_BORINGSSL - for (;;) { - int status = RAND_status(); - CHECK_GE(status, 0); // Cannot fail. -@@ -71,15 +72,20 @@ void CheckEntropy() { - if (RAND_poll() == 0) - break; - } -+#endif - } +@@ -20,6 +20,8 @@ + #endif + #endif - bool EntropySource(unsigned char* buffer, size_t length) { -+#ifndef OPENSSL_IS_BORINGSSL - // Ensure that OpenSSL's PRNG is properly seeded. - CheckEntropy(); - // RAND_bytes() can return 0 to indicate that the entropy data is not truly - // random. That's okay, it's still better than V8's stock source of entropy, - // which is /dev/urandom on UNIX platforms and the current time on Windows. - return RAND_bytes(buffer, length) != -1; -+#else -+ return false; -+#endif - } ++#include ++ + namespace node { - int PasswordCallback(char* buf, int size, int rwflag, void* u) { -@@ -118,7 +124,6 @@ void InitCryptoOnce() { + using v8::ArrayBuffer; +@@ -118,7 +120,6 @@ void InitCryptoOnce() { OPENSSL_init_ssl(0, settings); OPENSSL_INIT_free(settings); settings = nullptr; @@ -272,7 +252,7 @@ index fbe4c0f06c10df7c8a492711594381c27c6f81f7..1684a4242d160f5536c30ffef2a3acff #ifndef _WIN32 if (per_process::cli_options->secure_heap != 0) { -@@ -137,6 +142,7 @@ void InitCryptoOnce() { +@@ -137,6 +138,7 @@ void InitCryptoOnce() { break; } } @@ -280,7 +260,7 @@ index fbe4c0f06c10df7c8a492711594381c27c6f81f7..1684a4242d160f5536c30ffef2a3acff #endif /* Override FIPS settings in cnf file, if needed. */ -@@ -675,10 +681,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -675,10 +677,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) {