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

Side by Side Diff: crypto/encryptor_win.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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
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 "base/crypto/encryptor.h" 5 #include "crypto/encryptor.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/crypto/symmetric_key.h" 9 #include "crypto/symmetric_key.h"
10 10
11 namespace base { 11 namespace crypto {
12 12
13 namespace { 13 namespace {
14 14
15 // On success, returns the block size (in bytes) for the algorithm that |key| 15 // On success, returns the block size (in bytes) for the algorithm that |key|
16 // is for. On failure, returns 0. 16 // is for. On failure, returns 0.
17 DWORD GetCipherBlockSize(HCRYPTKEY key) { 17 DWORD GetCipherBlockSize(HCRYPTKEY key) {
18 DWORD block_size_in_bits = 0; 18 DWORD block_size_in_bits = 0;
19 DWORD param_size = sizeof(block_size_in_bits); 19 DWORD param_size = sizeof(block_size_in_bits);
20 BOOL ok = CryptGetKeyParam(key, KP_BLOCKLEN, 20 BOOL ok = CryptGetKeyParam(key, KP_BLOCKLEN,
21 reinterpret_cast<BYTE*>(&block_size_in_bits), 21 reinterpret_cast<BYTE*>(&block_size_in_bits),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 BOOL ok = CryptDecrypt(capi_key_.get(), NULL, TRUE, 0, &tmp[0], &data_len); 105 BOOL ok = CryptDecrypt(capi_key_.get(), NULL, TRUE, 0, &tmp[0], &data_len);
106 if (!ok) 106 if (!ok)
107 return false; 107 return false;
108 108
109 DCHECK_GT(tmp.size(), data_len); 109 DCHECK_GT(tmp.size(), data_len);
110 110
111 plaintext->assign(reinterpret_cast<char*>(&tmp[0]), data_len); 111 plaintext->assign(reinterpret_cast<char*>(&tmp[0]), data_len);
112 return true; 112 return true;
113 } 113 }
114 114
115 } // namespace base 115 } // namespace crypto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698