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

Side by Side Diff: net/base/crl_set.cc

Issue 7823004: Convert SHA256_LENGTH from a constant-in-anonymous-enum to a static const. This defines the cons... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 | 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/base64.h" 5 #include "base/base64.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "crypto/sha2.h" 10 #include "crypto/sha2.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return NULL; 145 return NULL;
146 return reinterpret_cast<DictionaryValue*>(header.release()); 146 return reinterpret_cast<DictionaryValue*>(header.release());
147 } 147 }
148 148
149 // kCurrentFileVersion is the version of the CRLSet file format that we 149 // kCurrentFileVersion is the version of the CRLSet file format that we
150 // currently implement. 150 // currently implement.
151 static const int kCurrentFileVersion = 0; 151 static const int kCurrentFileVersion = 0;
152 152
153 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, 153 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash,
154 std::vector<std::string>* out_serials) { 154 std::vector<std::string>* out_serials) {
155 if (data->size() < crypto::SHA256_LENGTH) 155 if (data->size() < crypto::kSHA256Length)
156 return false; 156 return false;
157 *out_parent_spki_hash = std::string(data->data(), crypto::SHA256_LENGTH); 157 *out_parent_spki_hash = std::string(data->data(), crypto::kSHA256Length);
158 data->remove_prefix(crypto::SHA256_LENGTH); 158 data->remove_prefix(crypto::kSHA256Length);
159 159
160 if (data->size() < sizeof(uint32)) 160 if (data->size() < sizeof(uint32))
161 return false; 161 return false;
162 uint32 num_serials; 162 uint32 num_serials;
163 memcpy(&num_serials, data->data(), sizeof(uint32)); // assumes little endian 163 memcpy(&num_serials, data->data(), sizeof(uint32)); // assumes little endian
164 data->remove_prefix(sizeof(uint32)); 164 data->remove_prefix(sizeof(uint32));
165 165
166 for (uint32 i = 0; i < num_serials; i++) { 166 for (uint32 i = 0; i < num_serials; i++) {
167 uint8 serial_length; 167 uint8 serial_length;
168 if (data->size() < sizeof(uint8)) 168 if (data->size() < sizeof(uint8))
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 uint32 CRLSet::sequence() const { 434 uint32 CRLSet::sequence() const {
435 return sequence_; 435 return sequence_;
436 } 436 }
437 437
438 const CRLSet::CRLList& CRLSet::crls() const { 438 const CRLSet::CRLList& CRLSet::crls() const {
439 return crls_; 439 return crls_;
440 } 440 }
441 441
442 } // namespace net 442 } // namespace net
OLDNEW
« crypto/sha2.h ('K') | « crypto/sha2_unittest.cc ('k') | net/base/dnssec_chain_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698