diff options
author | mniknami@chromium.org <mniknami@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-02 20:22:25 +0000 |
---|---|---|
committer | mniknami@chromium.org <mniknami@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-02 20:22:25 +0000 |
commit | 9b2057825d45aab8c753c5764228f8e8a069e470 (patch) | |
tree | 5a64a7de6c123f4548b9ee7e3cb312db8dfa7779 /crypto/openpgp_symmetric_encryption.cc | |
parent | bebe1d02eb8b14a6e7db2cce1a6d13f556a5390f (diff) | |
download | chromium_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/openpgp_symmetric_encryption.cc')
-rw-r--r-- | crypto/openpgp_symmetric_encryption.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/openpgp_symmetric_encryption.cc b/crypto/openpgp_symmetric_encryption.cc index 3f37d4c..7eb6737 100644 --- a/crypto/openpgp_symmetric_encryption.cc +++ b/crypto/openpgp_symmetric_encryption.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -12,7 +12,7 @@ #include <vector> #include "base/logging.h" -#include "base/rand_util.h" +#include "crypto/random.h" #include "crypto/scoped_nss_types.h" #include "crypto/nss_util.h" @@ -680,7 +680,8 @@ class Encrypter { ske.push_back(3); // iterated and salted S2K ske.push_back(2); // SHA-1 - uint64 salt64 = base::RandUint64(); + uint64 salt64; + crypto::RandBytes(&salt64, sizeof(salt64)); ByteString salt(sizeof(salt64), 0); // It's a random value, so endianness doesn't matter. @@ -710,7 +711,7 @@ class Encrypter { static const unsigned kBlockSize = 16; // AES block size uint8 prefix[kBlockSize + 2], fre[kBlockSize], iv[kBlockSize]; - base::RandBytes(iv, kBlockSize); + crypto::RandBytes(iv, kBlockSize); memset(fre, 0, sizeof(fre)); ScopedPK11Context aes_context; |