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

Side by Side Diff: net/cert/ct_log_response_parser.cc

Issue 1760413003: Revert of Certificate Transparency: Ensure timestamps over 32 bit are handled correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | net/cert/ct_log_response_parser_unittest.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 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 "net/cert/ct_log_response_parser.h" 5 #include "net/cert/ct_log_response_parser.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/json_value_converter.h" 8 #include "base/json/json_value_converter.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (!converter.Convert(json_signed_tree_head, &parsed_sth)) { 138 if (!converter.Convert(json_signed_tree_head, &parsed_sth)) {
139 DVLOG(1) << "Invalid Signed Tree Head JSON."; 139 DVLOG(1) << "Invalid Signed Tree Head JSON.";
140 return false; 140 return false;
141 } 141 }
142 142
143 if (!IsJsonSTHStructurallyValid(parsed_sth)) 143 if (!IsJsonSTHStructurallyValid(parsed_sth))
144 return false; 144 return false;
145 145
146 signed_tree_head->version = SignedTreeHead::V1; 146 signed_tree_head->version = SignedTreeHead::V1;
147 signed_tree_head->tree_size = parsed_sth.tree_size; 147 signed_tree_head->tree_size = parsed_sth.tree_size;
148 signed_tree_head->timestamp = base::Time::FromJsTime(parsed_sth.timestamp); 148 signed_tree_head->timestamp =
149 base::Time::UnixEpoch() + base::TimeDelta::FromMilliseconds(
150 static_cast<int64_t>(parsed_sth.timestamp));
149 signed_tree_head->signature = parsed_sth.signature; 151 signed_tree_head->signature = parsed_sth.signature;
150 memcpy(signed_tree_head->sha256_root_hash, 152 memcpy(signed_tree_head->sha256_root_hash,
151 parsed_sth.sha256_root_hash.c_str(), 153 parsed_sth.sha256_root_hash.c_str(),
152 kSthRootHashLength); 154 kSthRootHashLength);
153 return true; 155 return true;
154 } 156 }
155 157
156 bool FillConsistencyProof(const base::Value& json_consistency_proof, 158 bool FillConsistencyProof(const base::Value& json_consistency_proof,
157 std::vector<std::string>* consistency_proof) { 159 std::vector<std::string>* consistency_proof) {
158 JsonConsistencyProof parsed_proof; 160 JsonConsistencyProof parsed_proof;
(...skipping 14 matching lines...) Expand all
173 for (std::string* proof_node : parsed_proof.proof_nodes) { 175 for (std::string* proof_node : parsed_proof.proof_nodes) {
174 consistency_proof->push_back(*proof_node); 176 consistency_proof->push_back(*proof_node);
175 } 177 }
176 178
177 return true; 179 return true;
178 } 180 }
179 181
180 } // namespace ct 182 } // namespace ct
181 183
182 } // namespace net 184 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/cert/ct_log_response_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698