summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/nacl/nacl_listener.cc6
-rw-r--r--ppapi/native_client/src/trusted/plugin/module_ppapi.cc6
2 files changed, 12 insertions, 0 deletions
diff --git a/chrome/nacl/nacl_listener.cc b/chrome/nacl/nacl_listener.cc
index e2c2ed2..1f48ef5 100644
--- a/chrome/nacl/nacl_listener.cc
+++ b/chrome/nacl/nacl_listener.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
+#include "base/rand_util_c.h"
#include "chrome/common/nacl_messages.h"
#include "chrome/nacl/nacl_validation_db.h"
#include "chrome/nacl/nacl_validation_query.h"
@@ -191,6 +192,11 @@ void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) {
std::vector<nacl::FileDescriptor> handles = params.handles;
#if defined(OS_LINUX) || defined(OS_MACOSX)
+ args->urandom_fd = dup(GetUrandomFD());
+ if (args->urandom_fd < 0) {
+ LOG(ERROR) << "Failed to dup() the urandom FD";
+ return;
+ }
args->create_memory_object_func = CreateMemoryObject;
# if defined(OS_MACOSX)
CHECK(handles.size() >= 1);
diff --git a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
index 60c7625..f639e7a 100644
--- a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
+++ b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
@@ -48,8 +48,14 @@ class ModulePpapi : public pp::Module {
launch_nacl_process = reinterpret_cast<LaunchNaClProcessFunc>(
private_interface_->LaunchSelLdr);
+ // TODO(mseaborn): Remove this get_urandom_fd global variable once
+ // the NaCl side no longer depends on it.
get_urandom_fd = private_interface_->UrandomFD;
+#if NACL_LINUX || NACL_OSX
+ NaClSecureRngModuleSetUrandomFd(dup(private_interface_->UrandomFD()));
+#endif
+
// In the plugin, we don't need high resolution time of day.
NaClAllowLowResolutionTimeOfDay();
NaClNrdAllModulesInit();