Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: base/rand_util_nacl.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/rand_util.cc ('k') | base/rand_util_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/rand_util_nacl.cc
diff --git a/base/rand_util_nacl.cc b/base/rand_util_nacl.cc
deleted file mode 100644
index b771dc44547dbce7f3b99058cab0c6bce4c43fe1..0000000000000000000000000000000000000000
--- a/base/rand_util_nacl.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/rand_util.h"
-
-#include <nacl/nacl_random.h>
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-
-namespace {
-
-void GetRandomBytes(void* output, size_t num_bytes) {
- char* output_ptr = static_cast<char*>(output);
- while (num_bytes > 0) {
- size_t nread;
- const int error = nacl_secure_random(output_ptr, num_bytes, &nread);
- CHECK_EQ(error, 0);
- CHECK_LE(nread, num_bytes);
- output_ptr += nread;
- num_bytes -= nread;
- }
-}
-
-} // namespace
-
-namespace base {
-
-// NOTE: This function must be cryptographically secure. http://crbug.com/140076
-uint64 RandUint64() {
- uint64 result;
- GetRandomBytes(&result, sizeof(result));
- return result;
-}
-
-void RandBytes(void* output, size_t output_length) {
- GetRandomBytes(output, output_length);
-}
-
-} // namespace base
« no previous file with comments | « base/rand_util.cc ('k') | base/rand_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698