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

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

Issue 11419270: Use size_t as the type of key_length and digest_length arguments of HMAC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix compilation errors Created 8 years 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
« no previous file with comments | « no previous file | chrome/nacl/nacl_validation_query.h » ('j') | crypto/hmac_openssl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Character used as a separator for construction of message to take HMAC of. 59 // Character used as a separator for construction of message to take HMAC of.
60 // It is critical to validate all caller-supplied data (used to construct 60 // It is critical to validate all caller-supplied data (used to construct
61 // message) to be clear of this separator because it could allow attacks. 61 // message) to be clear of this separator because it could allow attacks.
62 const char kItemSeparator = '\n'; 62 const char kItemSeparator = '\n';
63 63
64 // Character used for var=value separation. 64 // Character used for var=value separation.
65 const char kVarValueSeparator = '='; 65 const char kVarValueSeparator = '=';
66 66
67 const size_t kKeySizeInBytes = 128 / 8; 67 const size_t kKeySizeInBytes = 128 / 8;
68 const int kHMACSizeInBytes = 256 / 8; 68 const size_t kHMACSizeInBytes = 256 / 8;
69 69
70 // Length of base64 string required to encode given number of raw octets. 70 // Length of base64 string required to encode given number of raw octets.
71 #define BASE64_PER_RAW(X) (X > 0 ? ((X - 1) / 3 + 1) * 4 : 0) 71 #define BASE64_PER_RAW(X) (X > 0 ? ((X - 1) / 3 + 1) * 4 : 0)
72 72
73 // Size of decimal string representing 64-bit tick. 73 // Size of decimal string representing 64-bit tick.
74 const size_t kTickStringLength = 20; 74 const size_t kTickStringLength = 20;
75 75
76 // A passport consists of 2 parts: HMAC and tick. 76 // A passport consists of 2 parts: HMAC and tick.
77 const size_t kPassportSize = 77 const size_t kPassportSize =
78 BASE64_PER_RAW(kHMACSizeInBytes) + kTickStringLength; 78 BASE64_PER_RAW(kHMACSizeInBytes) + kTickStringLength;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 const std::string& domain, const VarValueMap& var_value_map) { 469 const std::string& domain, const VarValueMap& var_value_map) {
470 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); 470 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0);
471 } 471 }
472 472
473 // static 473 // static
474 void InternalAuthGeneration::GenerateNewKey() { 474 void InternalAuthGeneration::GenerateNewKey() {
475 g_generation_service.Get().GenerateNewKey(); 475 g_generation_service.Get().GenerateNewKey();
476 } 476 }
477 477
478 } // namespace chrome 478 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/nacl/nacl_validation_query.h » ('j') | crypto/hmac_openssl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698