Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: net/quic/quic_connection_test.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_client_session_test.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // have the same value and then removes them. 137 // have the same value and then removes them.
138 class TaggingDecrypter : public QuicDecrypter { 138 class TaggingDecrypter : public QuicDecrypter {
139 public: 139 public:
140 ~TaggingDecrypter() override {} 140 ~TaggingDecrypter() override {}
141 141
142 // QuicDecrypter interface 142 // QuicDecrypter interface
143 bool SetKey(StringPiece key) override { return true; } 143 bool SetKey(StringPiece key) override { return true; }
144 144
145 bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } 145 bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; }
146 146
147 bool Decrypt(StringPiece nonce,
148 StringPiece associated_data,
149 StringPiece ciphertext,
150 unsigned char* output,
151 size_t* output_length) override {
152 if (ciphertext.size() < kTagSize) {
153 return false;
154 }
155 if (!CheckTag(ciphertext, GetTag(ciphertext))) {
156 return false;
157 }
158 *output_length = ciphertext.size() - kTagSize;
159 memcpy(output, ciphertext.data(), *output_length);
160 return true;
161 }
162
163 QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, 147 QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number,
164 StringPiece associated_data, 148 StringPiece associated_data,
165 StringPiece ciphertext) override { 149 StringPiece ciphertext) override {
166 if (ciphertext.size() < kTagSize) { 150 if (ciphertext.size() < kTagSize) {
167 return nullptr; 151 return nullptr;
168 } 152 }
169 if (!CheckTag(ciphertext, GetTag(ciphertext))) { 153 if (!CheckTag(ciphertext, GetTag(ciphertext))) {
170 return nullptr; 154 return nullptr;
171 } 155 }
172 const size_t len = ciphertext.size() - kTagSize; 156 const size_t len = ciphertext.size() - kTagSize;
(...skipping 4265 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 // Regression test for b/18594622 4422 // Regression test for b/18594622
4439 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); 4423 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
4440 EXPECT_DFATAL( 4424 EXPECT_DFATAL(
4441 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), 4425 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()),
4442 "Attempt to send empty stream frame"); 4426 "Attempt to send empty stream frame");
4443 } 4427 }
4444 4428
4445 } // namespace 4429 } // namespace
4446 } // namespace test 4430 } // namespace test
4447 } // namespace net 4431 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session_test.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698