| 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/quic/core/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/core/crypto/quic_crypto_client_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 *error_details = "Symmetric key setup failed"; | 651 *error_details = "Symmetric key setup failed"; |
| 652 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED; | 652 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED; |
| 653 } | 653 } |
| 654 | 654 |
| 655 const QuicData& cetv_plaintext = cetv.GetSerialized(); | 655 const QuicData& cetv_plaintext = cetv.GetSerialized(); |
| 656 const size_t encrypted_len = | 656 const size_t encrypted_len = |
| 657 crypters.encrypter->GetCiphertextSize(cetv_plaintext.length()); | 657 crypters.encrypter->GetCiphertextSize(cetv_plaintext.length()); |
| 658 std::unique_ptr<char[]> output(new char[encrypted_len]); | 658 std::unique_ptr<char[]> output(new char[encrypted_len]); |
| 659 size_t output_size = 0; | 659 size_t output_size = 0; |
| 660 if (!crypters.encrypter->EncryptPacket( | 660 if (!crypters.encrypter->EncryptPacket( |
| 661 preferred_version, kDefaultPathId /* path id */, | 661 preferred_version, 0 /* packet number */, |
| 662 0 /* packet number */, StringPiece() /* associated data */, | 662 StringPiece() /* associated data */, cetv_plaintext.AsStringPiece(), |
| 663 cetv_plaintext.AsStringPiece(), output.get(), &output_size, | 663 output.get(), &output_size, encrypted_len)) { |
| 664 encrypted_len)) { | |
| 665 *error_details = "Packet encryption failed"; | 664 *error_details = "Packet encryption failed"; |
| 666 return QUIC_ENCRYPTION_FAILURE; | 665 return QUIC_ENCRYPTION_FAILURE; |
| 667 } | 666 } |
| 668 | 667 |
| 669 out->SetStringPiece(kCETV, StringPiece(output.get(), output_size)); | 668 out->SetStringPiece(kCETV, StringPiece(output.get(), output_size)); |
| 670 out->MarkDirty(); | 669 out->MarkDirty(); |
| 671 | 670 |
| 672 out->set_minimum_size(orig_min_size); | 671 out->set_minimum_size(orig_min_size); |
| 673 } | 672 } |
| 674 | 673 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 } | 977 } |
| 979 | 978 |
| 980 // Update canonical version to point at the "most recent" entry. | 979 // Update canonical version to point at the "most recent" entry. |
| 981 canonical_server_map_[suffix_server_id] = server_id; | 980 canonical_server_map_[suffix_server_id] = server_id; |
| 982 | 981 |
| 983 server_state->InitializeFrom(*canonical_state); | 982 server_state->InitializeFrom(*canonical_state); |
| 984 return true; | 983 return true; |
| 985 } | 984 } |
| 986 | 985 |
| 987 } // namespace net | 986 } // namespace net |
| OLD | NEW |