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/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 QuicPacketNumber packet_number, | 87 QuicPacketNumber packet_number, |
88 StringPiece associated_data, | 88 StringPiece associated_data, |
89 StringPiece plaintext, | 89 StringPiece plaintext, |
90 char* output, | 90 char* output, |
91 size_t* output_length, | 91 size_t* output_length, |
92 size_t max_output_length) override { | 92 size_t max_output_length) override { |
93 const size_t len = plaintext.size() + kTagSize; | 93 const size_t len = plaintext.size() + kTagSize; |
94 if (max_output_length < len) { | 94 if (max_output_length < len) { |
95 return false; | 95 return false; |
96 } | 96 } |
| 97 // Memmove is safe for inplace encryption. |
97 memmove(output, plaintext.data(), plaintext.size()); | 98 memmove(output, plaintext.data(), plaintext.size()); |
98 output += plaintext.size(); | 99 output += plaintext.size(); |
99 memset(output, tag_, kTagSize); | 100 memset(output, tag_, kTagSize); |
100 *output_length = len; | 101 *output_length = len; |
101 return true; | 102 return true; |
102 } | 103 } |
103 | 104 |
104 size_t GetKeySize() const override { return 0; } | 105 size_t GetKeySize() const override { return 0; } |
105 size_t GetNoncePrefixSize() const override { return 0; } | 106 size_t GetNoncePrefixSize() const override { return 0; } |
106 | 107 |
(...skipping 5399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5506 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); | 5507 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); |
5507 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), | 5508 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), |
5508 "Received a packet with multipath flag on when multipath is " | 5509 "Received a packet with multipath flag on when multipath is " |
5509 "not enabled."); | 5510 "not enabled."); |
5510 EXPECT_FALSE(connection_.connected()); | 5511 EXPECT_FALSE(connection_.connected()); |
5511 } | 5512 } |
5512 | 5513 |
5513 } // namespace | 5514 } // namespace |
5514 } // namespace test | 5515 } // namespace test |
5515 } // namespace net | 5516 } // namespace net |
OLD | NEW |