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

Side by Side Diff: chrome/browser/internal_auth.cc

Issue 1358513003: Use correct IntToString variants in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/internal_auth.h" 5 #include "chrome/browser/internal_auth.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 DCHECK(IsDomainSane(domain)); 150 DCHECK(IsDomainSane(domain));
151 DCHECK(IsVarValueMapSane(map)); 151 DCHECK(IsVarValueMapSane(map));
152 152
153 out->clear(); 153 out->clear();
154 std::string result(kPassportSize, '0'); 154 std::string result(kPassportSize, '0');
155 155
156 std::string blob; 156 std::string blob;
157 blob = domain + kItemSeparator; 157 blob = domain + kItemSeparator;
158 std::string tmp; 158 std::string tmp;
159 ConvertVarValueMapToBlob(map, &tmp); 159 ConvertVarValueMapToBlob(map, &tmp);
160 blob += tmp + kItemSeparator + base::Uint64ToString(tick); 160 blob += tmp + kItemSeparator + base::Int64ToString(tick);
161 161
162 std::string hmac; 162 std::string hmac;
163 unsigned char* hmac_data = reinterpret_cast<unsigned char*>( 163 unsigned char* hmac_data = reinterpret_cast<unsigned char*>(
164 base::WriteInto(&hmac, kHMACSizeInBytes + 1)); 164 base::WriteInto(&hmac, kHMACSizeInBytes + 1));
165 if (!engine->Sign(blob, hmac_data, kHMACSizeInBytes)) { 165 if (!engine->Sign(blob, hmac_data, kHMACSizeInBytes)) {
166 NOTREACHED(); 166 NOTREACHED();
167 return; 167 return;
168 } 168 }
169 std::string hmac_base64; 169 std::string hmac_base64;
170 base::Base64Encode(hmac, &hmac_base64); 170 base::Base64Encode(hmac, &hmac_base64);
171 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { 171 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) {
172 NOTREACHED(); 172 NOTREACHED();
173 return; 173 return;
174 } 174 }
175 DCHECK(hmac_base64.size() < result.size()); 175 DCHECK(hmac_base64.size() < result.size());
176 std::copy(hmac_base64.begin(), hmac_base64.end(), result.begin()); 176 std::copy(hmac_base64.begin(), hmac_base64.end(), result.begin());
177 177
178 std::string tick_decimal = base::Uint64ToString(tick); 178 std::string tick_decimal = base::Int64ToString(tick);
179 DCHECK(tick_decimal.size() <= kTickStringLength); 179 DCHECK(tick_decimal.size() <= kTickStringLength);
180 std::copy( 180 std::copy(
181 tick_decimal.begin(), 181 tick_decimal.begin(),
182 tick_decimal.end(), 182 tick_decimal.end(),
183 result.begin() + kPassportSize - tick_decimal.size()); 183 result.begin() + kPassportSize - tick_decimal.size());
184 184
185 out->swap(result); 185 out->swap(result);
186 } 186 }
187 187
188 } // namespace 188 } // namespace
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 const std::string& domain, const VarValueMap& var_value_map) { 466 const std::string& domain, const VarValueMap& var_value_map) {
467 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); 467 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0);
468 } 468 }
469 469
470 // static 470 // static
471 void InternalAuthGeneration::GenerateNewKey() { 471 void InternalAuthGeneration::GenerateNewKey() {
472 g_generation_service.Get().GenerateNewKey(); 472 g_generation_service.Get().GenerateNewKey();
473 } 473 }
474 474
475 } // namespace chrome 475 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/importer/profile_writer.cc ('k') | chrome/browser/local_discovery/privet_http_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698