Remove dependency from //mojo to //crypto

Turns out we only use crypto::RandBytes, which just calls through to
base::RandBytes. This CL changes //mojo to just use base::RandBytes directly.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1244823003 .
diff --git a/mojo/dart/embedder/BUILD.gn b/mojo/dart/embedder/BUILD.gn
index 708fc66..f15e4aa 100644
--- a/mojo/dart/embedder/BUILD.gn
+++ b/mojo/dart/embedder/BUILD.gn
@@ -43,7 +43,6 @@
     ":generate_dart_embedder_service_isolate_resources_cc",
     "//base",
     "//base:i18n",
-    "//crypto",
     "//dart/runtime:libdart",
     "//dart/runtime/bin:libdart_embedder_noio",
     "//third_party/dart-pkg",
diff --git a/mojo/dart/embedder/builtin_natives.cc b/mojo/dart/embedder/builtin_natives.cc
index 4a8ce6e..e7a5585 100644
--- a/mojo/dart/embedder/builtin_natives.cc
+++ b/mojo/dart/embedder/builtin_natives.cc
@@ -12,7 +12,7 @@
 #include "base/logging.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
-#include "crypto/random.h"
+#include "base/rand_util.h"
 #include "dart/runtime/include/dart_api.h"
 #include "mojo/dart/embedder/builtin.h"
 #include "mojo/dart/embedder/mojo_natives.h"
@@ -324,7 +324,7 @@
   intptr_t count = static_cast<intptr_t>(count64);
   scoped_ptr<uint8_t[]> buffer(new uint8_t[count]);
 
-  crypto::RandBytes(reinterpret_cast<void*>(buffer.get()), count);
+  base::RandBytes(reinterpret_cast<void*>(buffer.get()), count);
 
   Dart_Handle result = Dart_NewTypedData(Dart_TypedData_kUint8, count);
   if (Dart_IsError(result)) {
diff --git a/mojo/dart/embedder/dart_controller.cc b/mojo/dart/embedder/dart_controller.cc
index 256494e..6819c69 100644
--- a/mojo/dart/embedder/dart_controller.cc
+++ b/mojo/dart/embedder/dart_controller.cc
@@ -6,8 +6,8 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/path_service.h"
+#include "base/rand_util.h"
 #include "base/sys_info.h"
-#include "crypto/random.h"
 #include "dart/runtime/include/dart_api.h"
 #include "dart/runtime/include/dart_native_api.h"
 #include "mojo/dart/embedder/builtin.h"
@@ -658,7 +658,7 @@
 }
 
 static bool generateEntropy(uint8_t* buffer, intptr_t length) {
-  crypto::RandBytes(reinterpret_cast<void*>(buffer), length);
+  base::RandBytes(reinterpret_cast<void*>(buffer), length);
   return true;
 }
 
diff --git a/mojo/dart/embedder/test/BUILD.gn b/mojo/dart/embedder/test/BUILD.gn
index 4a1c11b..87395a3 100644
--- a/mojo/dart/embedder/test/BUILD.gn
+++ b/mojo/dart/embedder/test/BUILD.gn
@@ -27,7 +27,6 @@
     ":dart_controller_for_test",
     ":dart_to_cpp_unittests",
     "//base",
-    "//crypto:crypto",
     "//mojo/dart/embedder:dart_controller_no_snapshot",
     "//mojo/edk/test:run_all_unittests",
     "//mojo/edk/test:test_support",
@@ -48,7 +47,6 @@
     ":dart_controller_for_test",
     ":dart_to_cpp_bindings",
     "//base",
-    "//crypto",
     "//mojo/dart/embedder:dart_controller_no_snapshot",
     "//mojo/edk/test:test_support",
     "//mojo/public/cpp/bindings",
diff --git a/mojo/dart/embedder/test/dart_to_cpp_tests.cc b/mojo/dart/embedder/test/dart_to_cpp_tests.cc
index 9148e28..9abc7a3 100644
--- a/mojo/dart/embedder/test/dart_to_cpp_tests.cc
+++ b/mojo/dart/embedder/test/dart_to_cpp_tests.cc
@@ -9,10 +9,10 @@
 #include "base/macros.h"
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
+#include "base/rand_util.h"
 #include "base/run_loop.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread.h"
-#include "crypto/random.h"
 #include "mojo/dart/embedder/dart_controller.h"
 #include "mojo/dart/embedder/test/dart_to_cpp.mojom.h"
 #include "mojo/edk/test/test_utils.h"
@@ -277,7 +277,7 @@
   }
 
   static bool GenerateEntropy(uint8_t* buffer, intptr_t length) {
-    crypto::RandBytes(reinterpret_cast<void*>(buffer), length);
+    base::RandBytes(reinterpret_cast<void*>(buffer), length);
     return true;
   }
 
diff --git a/mojo/dart/embedder/test/run_dart_tests.cc b/mojo/dart/embedder/test/run_dart_tests.cc
index 06bb77b..3b02600 100644
--- a/mojo/dart/embedder/test/run_dart_tests.cc
+++ b/mojo/dart/embedder/test/run_dart_tests.cc
@@ -7,7 +7,7 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "crypto/random.h"
+#include "base/rand_util.h"
 #include "mojo/dart/embedder/dart_controller.h"
 #include "mojo/public/c/system/types.h"
 #include "mojo/public/cpp/environment/environment.h"
@@ -20,7 +20,7 @@
 namespace {
 
 static bool generateEntropy(uint8_t* buffer, intptr_t length) {
-  crypto::RandBytes(reinterpret_cast<void*>(buffer), length);
+  base::RandBytes(reinterpret_cast<void*>(buffer), length);
   return true;
 }
 
diff --git a/mojo/dart/embedder/test/validation_unittest.cc b/mojo/dart/embedder/test/validation_unittest.cc
index bf5b87c..1513258 100644
--- a/mojo/dart/embedder/test/validation_unittest.cc
+++ b/mojo/dart/embedder/test/validation_unittest.cc
@@ -13,7 +13,7 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "crypto/random.h"
+#include "base/rand_util.h"
 #include "mojo/dart/embedder/dart_controller.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -36,7 +36,7 @@
 }
 
 static bool generateEntropy(uint8_t* buffer, intptr_t length) {
-  crypto::RandBytes(reinterpret_cast<void*>(buffer), length);
+  base::RandBytes(reinterpret_cast<void*>(buffer), length);
   return true;
 }
 
diff --git a/mojo/edk/embedder/BUILD.gn b/mojo/edk/embedder/BUILD.gn
index c3e0d53..b3144f0 100644
--- a/mojo/edk/embedder/BUILD.gn
+++ b/mojo/edk/embedder/BUILD.gn
@@ -87,7 +87,6 @@
 
   deps = [
     "//base",
-    "//crypto",
   ]
 
   if (is_android) {
diff --git a/mojo/edk/embedder/simple_platform_support.cc b/mojo/edk/embedder/simple_platform_support.cc
index 5024087..4207120 100644
--- a/mojo/edk/embedder/simple_platform_support.cc
+++ b/mojo/edk/embedder/simple_platform_support.cc
@@ -4,7 +4,7 @@
 
 #include "mojo/edk/embedder/simple_platform_support.h"
 
-#include "crypto/random.h"
+#include "base/rand_util.h"
 #include "mojo/edk/embedder/simple_platform_shared_buffer.h"
 
 namespace mojo {
@@ -12,7 +12,7 @@
 
 void SimplePlatformSupport::GetCryptoRandomBytes(void* bytes,
                                                  size_t num_bytes) {
-  crypto::RandBytes(bytes, num_bytes);
+  base::RandBytes(bytes, num_bytes);
 }
 
 PlatformSharedBuffer* SimplePlatformSupport::CreateSharedBuffer(