summaryrefslogtreecommitdiffstats
path: root/crypto/random.cc
diff options
context:
space:
mode:
authormniknami@chromium.org <mniknami@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 20:22:25 +0000
committermniknami@chromium.org <mniknami@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 20:22:25 +0000
commit9b2057825d45aab8c753c5764228f8e8a069e470 (patch)
tree5a64a7de6c123f4548b9ee7e3cb312db8dfa7779 /crypto/random.cc
parentbebe1d02eb8b14a6e7db2cce1a6d13f556a5390f (diff)
downloadchromium_src-9b2057825d45aab8c753c5764228f8e8a069e470.zip
chromium_src-9b2057825d45aab8c753c5764228f8e8a069e470.tar.gz
chromium_src-9b2057825d45aab8c753c5764228f8e8a069e470.tar.bz2
Added crypto random-number generator
Added a cryptographic random-number generator to crypto/. Modified sync to use this function instead. May also be used by Cloud Print in the future. Review URL: https://chromiumcodereview.appspot.com/10698177 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149689 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/random.cc')
-rw-r--r--crypto/random.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/random.cc b/crypto/random.cc
new file mode 100644
index 0000000..a19bb1a
--- /dev/null
+++ b/crypto/random.cc
@@ -0,0 +1,19 @@
+// 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 "crypto/random.h"
+
+#include "base/rand_util.h"
+
+namespace crypto {
+
+void RandBytes(void *bytes, size_t length) {
+ // It's OK to call base::RandBytes(), because it's already strongly random.
+ // But _other_ code should go through this function to ensure that code which
+ // needs secure randomness is easily discoverable.
+ base::RandBytes(bytes, length);
+}
+
+} // namespace crypto
+