diff options
author | ncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 00:16:47 +0000 |
---|---|---|
committer | ncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 00:16:47 +0000 |
commit | 43866cd42bd433961d3b631ebbd9afe2ae85699f (patch) | |
tree | dec64d88f0f35f8e00a0b2850d614016b4024381 /crypto/symmetric_key_win.cc | |
parent | 000b98ddf1aca041c77865d1ba8968577a1efa35 (diff) | |
download | chromium_src-43866cd42bd433961d3b631ebbd9afe2ae85699f.zip chromium_src-43866cd42bd433961d3b631ebbd9afe2ae85699f.tar.gz chromium_src-43866cd42bd433961d3b631ebbd9afe2ae85699f.tar.bz2 |
Create a database for NaCl validation caching that is shared between processes.
This change primarily entails creating a SyncChannel between sel_ldr and the
browser. Queries to the database could be made from any thread inside sel_ldr,
so the query mechanism needs to be thread safe.
This feature is currently disabled by default, and requires an environment
variable to enable. A few changes need to be made before this features is safe
and can be enabled, such as making sure each installation has a unique,
crypographically secure key.
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2515
TEST= Run NaCl w/ NACL_VALIDATION_CACHE=1
Review URL: http://codereview.chromium.org/9796006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/symmetric_key_win.cc')
-rw-r--r-- | crypto/symmetric_key_win.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/symmetric_key_win.cc b/crypto/symmetric_key_win.cc index d2034e0..87e0bc3 100644 --- a/crypto/symmetric_key_win.cc +++ b/crypto/symmetric_key_win.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. @@ -50,11 +50,12 @@ ALG_ID GetAESAlgIDForKeySize(size_t key_size_in_bits) { // TODO(wtc): use this function in hmac_win.cc. bool ImportRawKey(HCRYPTPROV provider, ALG_ID alg, - const void* key_data, DWORD key_size, + const void* key_data, size_t key_size, ScopedHCRYPTKEY* key) { DCHECK_GT(key_size, 0); - DWORD actual_size = sizeof(PlaintextBlobHeader) + key_size; + DWORD actual_size = + static_cast<DWORD>(sizeof(PlaintextBlobHeader) + key_size); std::vector<BYTE> tmp_data(actual_size); BYTE* actual_key = &tmp_data[0]; memcpy(actual_key + sizeof(PlaintextBlobHeader), key_data, key_size); @@ -66,7 +67,7 @@ bool ImportRawKey(HCRYPTPROV provider, key_header->hdr.bVersion = CUR_BLOB_VERSION; key_header->hdr.aiKeyAlg = alg; - key_header->cbKeySize = key_size; + key_header->cbKeySize = static_cast<DWORD>(key_size); HCRYPTKEY unsafe_key = NULL; DWORD flags = CRYPT_EXPORTABLE; @@ -184,7 +185,7 @@ bool GenerateHMACKey(size_t key_size_in_bits, if (!ok) return false; - DWORD key_size_in_bytes = key_size_in_bits / 8; + DWORD key_size_in_bytes = static_cast<DWORD>(key_size_in_bits / 8); scoped_array<BYTE> random(new BYTE[key_size_in_bytes]); ok = CryptGenRandom(safe_provider, key_size_in_bytes, random.get()); if (!ok) @@ -258,7 +259,7 @@ bool ComputePBKDF2Block(HCRYPTHASH hash, // Iteration U_1: Compute PRF for S. ok = CryptHashData(safe_hash, reinterpret_cast<const BYTE*>(salt.data()), - salt.size(), 0); + static_cast<DWORD>(salt.size()), 0); if (!ok) return false; |