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

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

Issue 2604513002: Optimize CT & OCSP handling code (Closed)
Patch Set: Review feedback round two Created 3 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "net/cert/ct_serialization.h" 5 #include "net/cert/ct_serialization.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 std::string* output) { 376 std::string* output) {
377 WriteUint(kVersionLength, signed_tree_head.version, output); 377 WriteUint(kVersionLength, signed_tree_head.version, output);
378 WriteUint(kSignatureTypeLength, TREE_HASH, output); 378 WriteUint(kSignatureTypeLength, TREE_HASH, output);
379 WriteTimeSinceEpoch(signed_tree_head.timestamp, output); 379 WriteTimeSinceEpoch(signed_tree_head.timestamp, output);
380 WriteUint(kTreeSizeLength, signed_tree_head.tree_size, output); 380 WriteUint(kTreeSizeLength, signed_tree_head.tree_size, output);
381 WriteEncodedBytes( 381 WriteEncodedBytes(
382 base::StringPiece(signed_tree_head.sha256_root_hash, kSthRootHashLength), 382 base::StringPiece(signed_tree_head.sha256_root_hash, kSthRootHashLength),
383 output); 383 output);
384 } 384 }
385 385
386 bool DecodeSCTList(base::StringPiece* input, 386 bool DecodeSCTList(base::StringPiece input,
387 std::vector<base::StringPiece>* output) { 387 std::vector<base::StringPiece>* output) {
388 std::vector<base::StringPiece> result; 388 std::vector<base::StringPiece> result;
389 if (!ReadList(kSCTListLengthBytes, kSerializedSCTLengthBytes, 389 if (!ReadList(kSCTListLengthBytes, kSerializedSCTLengthBytes, &input,
390 input, &result)) { 390 &result)) {
391 return false; 391 return false;
392 } 392 }
393 393
394 if (!input->empty() || result.empty()) 394 if (!input.empty() || result.empty())
395 return false; 395 return false;
396 output->swap(result); 396 output->swap(result);
397 return true; 397 return true;
398 } 398 }
399 399
400 bool DecodeSignedCertificateTimestamp( 400 bool DecodeSignedCertificateTimestamp(
401 base::StringPiece* input, 401 base::StringPiece* input,
402 scoped_refptr<SignedCertificateTimestamp>* output) { 402 scoped_refptr<SignedCertificateTimestamp>* output) {
403 scoped_refptr<SignedCertificateTimestamp> result( 403 scoped_refptr<SignedCertificateTimestamp> result(
404 new SignedCertificateTimestamp()); 404 new SignedCertificateTimestamp());
(...skipping 24 matching lines...) Expand all
429 bool EncodeSCTListForTesting(const base::StringPiece& sct, 429 bool EncodeSCTListForTesting(const base::StringPiece& sct,
430 std::string* output) { 430 std::string* output) {
431 std::string encoded_sct; 431 std::string encoded_sct;
432 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) && 432 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) &&
433 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output); 433 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output);
434 } 434 }
435 435
436 } // namespace ct 436 } // namespace ct
437 437
438 } // namespace net 438 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698