| 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 "net/quic/core/crypto/crypto_server_config_protobuf.h" | 7 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" |
| 8 #include "net/quic/core/quic_utils.h" | 8 #include "net/quic/core/quic_utils.h" |
| 9 #include "net/quic/test_tools/mock_clock.h" | 9 #include "net/quic/test_tools/mock_clock.h" |
| 10 #include "net/test/gtest_util.h" | 10 #include "net/test/gtest_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 QuicCryptoServerConfig::ConfigOptions old_config_options; | 116 QuicCryptoServerConfig::ConfigOptions old_config_options; |
| 117 old_config_options.id = "old-config-id"; | 117 old_config_options.id = "old-config-id"; |
| 118 delete crypto_config.AddDefaultConfig(QuicRandom::GetInstance(), &clock, | 118 delete crypto_config.AddDefaultConfig(QuicRandom::GetInstance(), &clock, |
| 119 old_config_options); | 119 old_config_options); |
| 120 QuicCryptoServerConfig::ConfigOptions new_config_options; | 120 QuicCryptoServerConfig::ConfigOptions new_config_options; |
| 121 std::unique_ptr<QuicServerConfigProtobuf> primary_config( | 121 std::unique_ptr<QuicServerConfigProtobuf> primary_config( |
| 122 crypto_config.GenerateConfig(QuicRandom::GetInstance(), &clock, | 122 crypto_config.GenerateConfig(QuicRandom::GetInstance(), &clock, |
| 123 new_config_options)); | 123 new_config_options)); |
| 124 primary_config->set_primary_time(clock.WallNow().ToUNIXSeconds()); | 124 primary_config->set_primary_time(clock.WallNow().ToUNIXSeconds()); |
| 125 std::unique_ptr<CryptoHandshakeMessage> msg( | 125 std::unique_ptr<CryptoHandshakeMessage> msg( |
| 126 crypto_config.AddConfig(primary_config.get(), clock.WallNow())); | 126 crypto_config.AddConfig(std::move(primary_config), clock.WallNow())); |
| 127 StringPiece orbit; | 127 StringPiece orbit; |
| 128 ASSERT_TRUE(msg->GetStringPiece(kORBT, &orbit)); | 128 ASSERT_TRUE(msg->GetStringPiece(kORBT, &orbit)); |
| 129 string nonce; | 129 string nonce; |
| 130 CryptoUtils::GenerateNonce( | 130 CryptoUtils::GenerateNonce( |
| 131 clock.WallNow(), QuicRandom::GetInstance(), | 131 clock.WallNow(), QuicRandom::GetInstance(), |
| 132 StringPiece(reinterpret_cast<const char*>(orbit.data()), | 132 StringPiece(reinterpret_cast<const char*>(orbit.data()), |
| 133 sizeof(orbit.size())), | 133 sizeof(orbit.size())), |
| 134 &nonce); | 134 &nonce); |
| 135 string nonce_hex = "#" + QuicUtils::HexEncode(nonce); | 135 string nonce_hex = "#" + QuicUtils::HexEncode(nonce); |
| 136 | 136 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 160 // Verify that full_chlo can pass crypto_config's verification. | 160 // Verify that full_chlo can pass crypto_config's verification. |
| 161 ShloVerifier shlo_verifier(&crypto_config, server_ip, client_addr, &clock, | 161 ShloVerifier shlo_verifier(&crypto_config, server_ip, client_addr, &clock, |
| 162 &proof, &compressed_certs_cache); | 162 &proof, &compressed_certs_cache); |
| 163 crypto_config.ValidateClientHello( | 163 crypto_config.ValidateClientHello( |
| 164 full_chlo, client_addr.address(), server_ip, version, &clock, &proof, | 164 full_chlo, client_addr.address(), server_ip, version, &clock, &proof, |
| 165 shlo_verifier.GetValidateClientHelloCallback()); | 165 shlo_verifier.GetValidateClientHelloCallback()); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace test | 168 } // namespace test |
| 169 } // namespace net | 169 } // namespace net |
| OLD | NEW |