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

Side by Side Diff: net/android/keystore_unittest.cc

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « media/audio/win/audio_manager_win.cc ('k') | net/base/net_string_util_icu.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <openssl/bn.h> 5 #include <openssl/bn.h>
6 #include <openssl/dsa.h> 6 #include <openssl/dsa.h>
7 #include <openssl/ecdsa.h> 7 #include <openssl/ecdsa.h>
8 #include <openssl/err.h> 8 #include <openssl/err.h>
9 #include <openssl/evp.h> 9 #include <openssl/evp.h>
10 #include <openssl/pem.h> 10 #include <openssl/pem.h>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return result; 90 return result;
91 } 91 }
92 92
93 // Resize a string to |size| bytes of data, then return its data buffer 93 // Resize a string to |size| bytes of data, then return its data buffer
94 // address cast as an 'unsigned char*', as expected by OpenSSL functions. 94 // address cast as an 'unsigned char*', as expected by OpenSSL functions.
95 // |str| the target string. 95 // |str| the target string.
96 // |size| the number of bytes to write into the string. 96 // |size| the number of bytes to write into the string.
97 // Return the string's new buffer in memory, as an 'unsigned char*' 97 // Return the string's new buffer in memory, as an 'unsigned char*'
98 // pointer. 98 // pointer.
99 unsigned char* OpenSSLWriteInto(std::string* str, size_t size) { 99 unsigned char* OpenSSLWriteInto(std::string* str, size_t size) {
100 return reinterpret_cast<unsigned char*>(WriteInto(str, size + 1)); 100 return reinterpret_cast<unsigned char*>(base::WriteInto(str, size + 1));
101 } 101 }
102 102
103 // Load a given private key file into an EVP_PKEY. 103 // Load a given private key file into an EVP_PKEY.
104 // |filename| is the key file path. 104 // |filename| is the key file path.
105 // Returns a new EVP_PKEY on success, NULL on failure. 105 // Returns a new EVP_PKEY on success, NULL on failure.
106 EVP_PKEY* ImportPrivateKeyFile(const char* filename) { 106 EVP_PKEY* ImportPrivateKeyFile(const char* filename) {
107 // Load file in memory. 107 // Load file in memory.
108 base::FilePath certs_dir = GetTestCertsDirectory(); 108 base::FilePath certs_dir = GetTestCertsDirectory();
109 base::FilePath file_path = certs_dir.AppendASCII(filename); 109 base::FilePath file_path = certs_dir.AppendASCII(filename);
110 base::ScopedFILE handle(base::OpenFile(file_path, "rb")); 110 base::ScopedFILE handle(base::OpenFile(file_path, "rb"));
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 std::string signature; 548 std::string signature;
549 DoKeySigningWithWrapper(wrapper_key.get(), 549 DoKeySigningWithWrapper(wrapper_key.get(),
550 openssl_key.get(), 550 openssl_key.get(),
551 message, 551 message,
552 &signature); 552 &signature);
553 ASSERT_TRUE(VerifyTestECDSASignature(message, signature)); 553 ASSERT_TRUE(VerifyTestECDSASignature(message, signature));
554 } 554 }
555 555
556 } // namespace android 556 } // namespace android
557 } // namespace net 557 } // namespace net
OLDNEW
« no previous file with comments | « media/audio/win/audio_manager_win.cc ('k') | net/base/net_string_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698