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

Side by Side Diff: ppapi/shared_impl/crypto_impl.cc

Issue 6873156: Move crypto_helpers from sync to base (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Follow bbretw review Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/random_unittest.cc ('k') | webkit/glue/webkitclient_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/shared_impl/crypto_impl.h" 5 #include "ppapi/shared_impl/crypto_impl.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 8
9 namespace pp { 9 namespace pp {
10 namespace shared_impl { 10 namespace shared_impl {
11 11
12 // static 12 // static
13 void CryptoImpl::GetRandomBytes(char* buffer, uint32_t num_bytes) { 13 void CryptoImpl::GetRandomBytes(char* buffer, uint32_t num_bytes) {
14 // Note: this is a copy of WebKitClientImpl::cryptographicallyRandomValues. 14 base::RandBytes(buffer, num_bytes);
15 uint64 bytes = 0;
16 for (uint32_t i = 0; i < num_bytes; ++i) {
17 uint32_t offset = i % sizeof(bytes);
18 if (!offset)
19 bytes = base::RandUint64();
20 buffer[i] = reinterpret_cast<char*>(&bytes)[offset];
21 }
22 } 15 }
23 16
24 } // namespace shared_impl 17 } // namespace shared_impl
25 } // namespace pp 18 } // namespace pp
OLDNEW
« no previous file with comments | « chrome/common/random_unittest.cc ('k') | webkit/glue/webkitclient_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698