Chromium Code Reviews| 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/test/ct_test_util.h" | 5 #include "net/test/ct_test_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 // log used in the tests. | 392 // log used in the tests. |
| 393 sct[15] = 't'; | 393 sct[15] = 't'; |
| 394 | 394 |
| 395 std::string sct_list; | 395 std::string sct_list; |
| 396 ct::EncodeSCTListForTesting(sct, &sct_list); | 396 ct::EncodeSCTListForTesting(sct, &sct_list); |
| 397 return sct_list; | 397 return sct_list; |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool CheckForSingleVerifiedSCTInResult(const ct::CTVerifyResult& result, | 400 bool CheckForSingleVerifiedSCTInResult(const ct::CTVerifyResult& result, |
| 401 const std::string& log_description) { | 401 const std::string& log_description) { |
| 402 return (result.verified_scts.size() == 1U) && result.invalid_scts.empty() && | 402 return (result.scts.size() == 1 && |
| 403 result.unknown_logs_scts.empty() && | 403 result.scts[0].status == ct::SCT_STATUS_OK && |
| 404 result.verified_scts[0]->log_description == log_description; | 404 result.scts[0].sct->log_description == log_description); |
| 405 } | 405 } |
| 406 | 406 |
| 407 bool CheckForSCTOrigin(const ct::CTVerifyResult& result, | 407 bool CheckForSCTOrigin(const ct::CTVerifyResult& result, |
| 408 ct::SignedCertificateTimestamp::Origin origin) { | 408 ct::SignedCertificateTimestamp::Origin origin) { |
| 409 return (result.verified_scts.size() > 0) && | 409 if (result.scts.size() == 0) |
|
eroman
2016/08/11 22:55:50
[optional] Can delete this line.
Eran Messeri
2016/08/13 21:53:26
Done.
| |
| 410 (result.verified_scts[0]->origin == origin); | 410 return false; |
| 411 | |
| 412 for (const auto& sct_and_status : result.scts) | |
| 413 if (sct_and_status.status == SCT_STATUS_OK && | |
| 414 sct_and_status.sct->origin == origin) | |
| 415 return true; | |
| 416 | |
| 417 return false; | |
| 411 } | 418 } |
| 412 | 419 |
| 413 } // namespace ct | 420 } // namespace ct |
| 414 | 421 |
| 415 } // namespace net | 422 } // namespace net |
| OLD | NEW |