OLD | NEW |
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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 input, &result)) { | 309 input, &result)) { |
310 return false; | 310 return false; |
311 } | 311 } |
312 | 312 |
313 if (!input->empty() || result.empty()) | 313 if (!input->empty() || result.empty()) |
314 return false; | 314 return false; |
315 output->swap(result); | 315 output->swap(result); |
316 return true; | 316 return true; |
317 } | 317 } |
318 | 318 |
319 bool DecodeSignedCertificateTimestamp(base::StringPiece* input, | 319 bool DecodeSignedCertificateTimestamp( |
| 320 base::StringPiece* input, |
320 scoped_refptr<SignedCertificateTimestamp>* output) { | 321 scoped_refptr<SignedCertificateTimestamp>* output) { |
321 scoped_refptr<SignedCertificateTimestamp> result( | 322 scoped_refptr<SignedCertificateTimestamp> result( |
322 new SignedCertificateTimestamp()); | 323 new SignedCertificateTimestamp()); |
323 unsigned version; | 324 unsigned version; |
324 if (!ReadUint(kVersionLength, input, &version)) | 325 if (!ReadUint(kVersionLength, input, &version)) |
325 return false; | 326 return false; |
326 if (version != SignedCertificateTimestamp::SCT_VERSION_1) { | 327 if (version != SignedCertificateTimestamp::SCT_VERSION_1) { |
327 DVLOG(1) << "Unsupported/invalid version " << version; | 328 DVLOG(1) << "Unsupported/invalid version " << version; |
328 return false; | 329 return false; |
329 } | 330 } |
(...skipping 28 matching lines...) Expand all Loading... |
358 bool EncodeSCTListForTesting(const base::StringPiece& sct, | 359 bool EncodeSCTListForTesting(const base::StringPiece& sct, |
359 std::string* output) { | 360 std::string* output) { |
360 std::string encoded_sct; | 361 std::string encoded_sct; |
361 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) && | 362 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) && |
362 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output); | 363 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output); |
363 } | 364 } |
364 | 365 |
365 } // namespace ct | 366 } // namespace ct |
366 | 367 |
367 } // namespace net | 368 } // namespace net |
OLD | NEW |