Skip to content

Instantly share code, notes, and snippets.

@RafaelGSS
Created September 5, 2022 14:18
Show Gist options
  • Save RafaelGSS/bde210dddc7a3019e867ba52db037ade to your computer and use it in GitHub Desktop.
Save RafaelGSS/bde210dddc7a3019e867ba52db037ade to your computer and use it in GitHub Desktop.
M src/node.cc
@@ -1111,6 +1111,20 @@ InitializationResult InitializeOncePerProcess(
fprintf(stderr, "OpenSSL error when trying to enable FIPS:\n");
ERR_print_errors_fp(stderr);
return result;
+ }
+
+ // Seed V8's PRNG from OpenSSL's pool. This is recommended by V8 and a
+ // potentially better source of randomness than what V8 uses by default, but
+ // it does not guarantee that pseudo-random values produced by V8 will be
+ // cryptograhically secure.
+ V8::SetEntropySource(crypto::EntropySource);
+#endif // HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
+ }
+
+ if (!(flags & ProcessInitializationFlags::kNoInitializeNodeV8Platform)) {
+ per_process::v8_platform.Initialize(
+ static_cast<int>(per_process::cli_options->v8_thread_pool_size));
+ result->platform_ = per_process::v8_platform.Platform();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment