| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic/test_tools/crypto_test_utils.h" | 5 #include "net/quic/test_tools/crypto_test_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "crypto/openssl_util.h" | 10 #include "crypto/openssl_util.h" |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 return QuicUtils::FNV1a_64_Hash(chain->certs.at(0).c_str(), | 581 return QuicUtils::FNV1a_64_Hash(chain->certs.at(0).c_str(), |
| 582 chain->certs.at(0).length()); | 582 chain->certs.at(0).length()); |
| 583 } | 583 } |
| 584 | 584 |
| 585 class MockCommonCertSets : public CommonCertSets { | 585 class MockCommonCertSets : public CommonCertSets { |
| 586 public: | 586 public: |
| 587 MockCommonCertSets(StringPiece cert, uint64_t hash, uint32_t index) | 587 MockCommonCertSets(StringPiece cert, uint64_t hash, uint32_t index) |
| 588 : cert_(cert.as_string()), hash_(hash), index_(index) {} | 588 : cert_(cert.as_string()), hash_(hash), index_(index) {} |
| 589 | 589 |
| 590 StringPiece GetCommonHashes() const override { | 590 StringPiece GetCommonHashes() const override { |
| 591 CHECK(false) << "not implemented"; | 591 // not implemented |
| 592 CHECK(false); |
| 592 return StringPiece(); | 593 return StringPiece(); |
| 593 } | 594 } |
| 594 | 595 |
| 595 StringPiece GetCert(uint64_t hash, uint32_t index) const override { | 596 StringPiece GetCert(uint64_t hash, uint32_t index) const override { |
| 596 if (hash == hash_ && index == index_) { | 597 if (hash == hash_ && index == index_) { |
| 597 return cert_; | 598 return cert_; |
| 598 } | 599 } |
| 599 return StringPiece(); | 600 return StringPiece(); |
| 600 } | 601 } |
| 601 | 602 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 break; | 845 break; |
| 845 } | 846 } |
| 846 | 847 |
| 847 if (tagstr[0] == '$') { | 848 if (tagstr[0] == '$') { |
| 848 // Special value. | 849 // Special value. |
| 849 const char* const special = tagstr + 1; | 850 const char* const special = tagstr + 1; |
| 850 if (strcmp(special, "padding") == 0) { | 851 if (strcmp(special, "padding") == 0) { |
| 851 const int min_bytes = va_arg(ap, int); | 852 const int min_bytes = va_arg(ap, int); |
| 852 msg.set_minimum_size(min_bytes); | 853 msg.set_minimum_size(min_bytes); |
| 853 } else { | 854 } else { |
| 854 CHECK(false) << "Unknown special value: " << special; | 855 // Unknown special value. |
| 856 CHECK(false); |
| 855 } | 857 } |
| 856 | 858 |
| 857 continue; | 859 continue; |
| 858 } | 860 } |
| 859 | 861 |
| 860 const QuicTag tag = ParseTag(tagstr); | 862 const QuicTag tag = ParseTag(tagstr); |
| 861 const char* valuestr = va_arg(ap, const char*); | 863 const char* valuestr = va_arg(ap, const char*); |
| 862 | 864 |
| 863 size_t len = strlen(valuestr); | 865 size_t len = strlen(valuestr); |
| 864 if (len > 0 && valuestr[0] == '#') { | 866 if (len > 0 && valuestr[0] == '#') { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 // Pass a inchoate CHLO. | 1014 // Pass a inchoate CHLO. |
| 1013 FullChloGenerator generator(crypto_config, server_addr, client_addr, clock, | 1015 FullChloGenerator generator(crypto_config, server_addr, client_addr, clock, |
| 1014 proof, compressed_certs_cache, out); | 1016 proof, compressed_certs_cache, out); |
| 1015 crypto_config->ValidateClientHello( | 1017 crypto_config->ValidateClientHello( |
| 1016 inchoate_chlo, client_addr.host(), server_addr, version, clock, proof, | 1018 inchoate_chlo, client_addr.host(), server_addr, version, clock, proof, |
| 1017 generator.GetValidateClientHelloCallback()); | 1019 generator.GetValidateClientHelloCallback()); |
| 1018 } | 1020 } |
| 1019 | 1021 |
| 1020 } // namespace test | 1022 } // namespace test |
| 1021 } // namespace net | 1023 } // namespace net |
| OLD | NEW |