Index: mojo/edk/embedder/embedder.cc |
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc |
index 5d7e3455e11ed76862f4448947056a18c37c475d..235a7a4a78d5110e9f9907000fb91ba343023199 100644 |
--- a/mojo/edk/embedder/embedder.cc |
+++ b/mojo/edk/embedder/embedder.cc |
@@ -10,15 +10,19 @@ |
#include "base/location.h" |
#include "base/logging.h" |
#include "base/memory/ref_counted.h" |
+#include "base/rand_util.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/task_runner.h" |
#include "base/threading/thread_task_runner_handle.h" |
-#include "crypto/random.h" |
#include "mojo/edk/embedder/embedder_internal.h" |
#include "mojo/edk/embedder/platform_channel_pair.h" |
#include "mojo/edk/embedder/process_delegate.h" |
#include "mojo/edk/system/core.h" |
+#if !defined(OS_NACL) |
+#include "crypto/random.h" |
+#endif |
+ |
namespace mojo { |
namespace edk { |
@@ -138,7 +142,12 @@ ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { |
std::string GenerateRandomToken() { |
char random_bytes[16]; |
+#if defined(OS_NACL) |
+ // Not secure. For NaCl only! |
+ base::RandBytes(random_bytes, 16); |
+#else |
crypto::RandBytes(random_bytes, 16); |
+#endif |
return base::HexEncode(random_bytes, 16); |
} |