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

Side by Side Diff: net/quic/core/crypto/null_decrypter.cc

Issue 2850573002: Landing Recent QUIC changes until 3:35 PM, Apr 26, 2017 UTC-4 (Closed)
Patch Set: Remove Disconnect from ~QuicTestClient Created 3 years, 7 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/core/crypto/crypto_framer.cc ('k') | net/quic/core/quic_connection.h » ('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/core/crypto/null_decrypter.h" 5 #include "net/quic/core/crypto/null_decrypter.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 8
9 #include "net/base/int128.h" 9 #include "net/base/int128.h"
10 #include "net/quic/core/quic_data_reader.h" 10 #include "net/quic/core/quic_data_reader.h"
(...skipping 25 matching lines...) Expand all
36 return true; 36 return true;
37 } 37 }
38 38
39 bool NullDecrypter::DecryptPacket(QuicVersion version, 39 bool NullDecrypter::DecryptPacket(QuicVersion version,
40 QuicPacketNumber /*packet_number*/, 40 QuicPacketNumber /*packet_number*/,
41 QuicStringPiece associated_data, 41 QuicStringPiece associated_data,
42 QuicStringPiece ciphertext, 42 QuicStringPiece ciphertext,
43 char* output, 43 char* output,
44 size_t* output_length, 44 size_t* output_length,
45 size_t max_output_length) { 45 size_t max_output_length) {
46 QuicDataReader reader(ciphertext.data(), ciphertext.length(), perspective_); 46 QuicDataReader reader(ciphertext.data(), ciphertext.length(), perspective_,
47 HOST_BYTE_ORDER);
47 uint128 hash; 48 uint128 hash;
48 49
49 if (!ReadHash(&reader, &hash)) { 50 if (!ReadHash(&reader, &hash)) {
50 return false; 51 return false;
51 } 52 }
52 53
53 QuicStringPiece plaintext = reader.ReadRemainingPayload(); 54 QuicStringPiece plaintext = reader.ReadRemainingPayload();
54 if (plaintext.length() > max_output_length) { 55 if (plaintext.length() > max_output_length) {
55 QUIC_BUG << "Output buffer must be larger than the plaintext."; 56 QUIC_BUG << "Output buffer must be larger than the plaintext.";
56 return false; 57 return false;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } else { 107 } else {
107 correct_hash = QuicUtils::FNV1a_128_Hash_Two(data1, data2); 108 correct_hash = QuicUtils::FNV1a_128_Hash_Two(data1, data2);
108 } 109 }
109 uint128 mask = MakeUint128(UINT64_C(0x0), UINT64_C(0xffffffff)); 110 uint128 mask = MakeUint128(UINT64_C(0x0), UINT64_C(0xffffffff));
110 mask <<= 96; 111 mask <<= 96;
111 correct_hash &= ~mask; 112 correct_hash &= ~mask;
112 return correct_hash; 113 return correct_hash;
113 } 114 }
114 115
115 } // namespace net 116 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/crypto_framer.cc ('k') | net/quic/core/quic_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698