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

Side by Side Diff: components/os_crypt/os_crypt_win.cc

Issue 686883002: Add crypto/wincrypt_shim.h wrapper header to resolve BoringSSL conflicts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sleevi comments Created 6 years, 1 month 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
« no previous file with comments | « components/os_crypt/ie7_password_win.cc ('k') | crypto/capi_util.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/os_crypt/os_crypt.h" 5 #include "components/os_crypt/os_crypt.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <wincrypt.h>
9 8
10 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "crypto/wincrypt_shim.h"
11 11
12 #pragma comment(lib, "crypt32.lib") 12 #pragma comment(lib, "crypt32.lib")
13 13
14 bool OSCrypt::EncryptString16(const base::string16& plaintext, 14 bool OSCrypt::EncryptString16(const base::string16& plaintext,
15 std::string* ciphertext) { 15 std::string* ciphertext) {
16 return EncryptString(base::UTF16ToUTF8(plaintext), ciphertext); 16 return EncryptString(base::UTF16ToUTF8(plaintext), ciphertext);
17 } 17 }
18 18
19 bool OSCrypt::DecryptString16(const std::string& ciphertext, 19 bool OSCrypt::DecryptString16(const std::string& ciphertext,
20 base::string16* plaintext) { 20 base::string16* plaintext) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DATA_BLOB output; 57 DATA_BLOB output;
58 BOOL result = CryptUnprotectData(&input, NULL, NULL, NULL, NULL, 58 BOOL result = CryptUnprotectData(&input, NULL, NULL, NULL, NULL,
59 0, &output); 59 0, &output);
60 if (!result) 60 if (!result)
61 return false; 61 return false;
62 62
63 plaintext->assign(reinterpret_cast<char*>(output.pbData), output.cbData); 63 plaintext->assign(reinterpret_cast<char*>(output.pbData), output.cbData);
64 LocalFree(output.pbData); 64 LocalFree(output.pbData);
65 return true; 65 return true;
66 } 66 }
OLDNEW
« no previous file with comments | « components/os_crypt/ie7_password_win.cc ('k') | crypto/capi_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698