| 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/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 20 matching lines...) Expand all Loading... |
| 31 QUIC_BUG << "Should not be called"; | 31 QUIC_BUG << "Should not be called"; |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool NullDecrypter::SetDiversificationNonce(const DiversificationNonce& nonce) { | 35 bool NullDecrypter::SetDiversificationNonce(const DiversificationNonce& nonce) { |
| 36 QUIC_BUG << "Should not be called"; | 36 QUIC_BUG << "Should not be called"; |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool NullDecrypter::DecryptPacket(QuicVersion version, | 40 bool NullDecrypter::DecryptPacket(QuicVersion version, |
| 41 QuicPathId /*path_id*/, | |
| 42 QuicPacketNumber /*packet_number*/, | 41 QuicPacketNumber /*packet_number*/, |
| 43 StringPiece associated_data, | 42 StringPiece associated_data, |
| 44 StringPiece ciphertext, | 43 StringPiece ciphertext, |
| 45 char* output, | 44 char* output, |
| 46 size_t* output_length, | 45 size_t* output_length, |
| 47 size_t max_output_length) { | 46 size_t max_output_length) { |
| 48 QuicDataReader reader(ciphertext.data(), ciphertext.length()); | 47 QuicDataReader reader(ciphertext.data(), ciphertext.length()); |
| 49 uint128 hash; | 48 uint128 hash; |
| 50 | 49 |
| 51 if (!ReadHash(&reader, &hash)) { | 50 if (!ReadHash(&reader, &hash)) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } else { | 107 } else { |
| 109 correct_hash = QuicUtils::FNV1a_128_Hash_Two(data1, data2); | 108 correct_hash = QuicUtils::FNV1a_128_Hash_Two(data1, data2); |
| 110 } | 109 } |
| 111 uint128 mask = MakeUint128(UINT64_C(0x0), UINT64_C(0xffffffff)); | 110 uint128 mask = MakeUint128(UINT64_C(0x0), UINT64_C(0xffffffff)); |
| 112 mask <<= 96; | 111 mask <<= 96; |
| 113 correct_hash &= ~mask; | 112 correct_hash &= ~mask; |
| 114 return correct_hash; | 113 return correct_hash; |
| 115 } | 114 } |
| 116 | 115 |
| 117 } // namespace net | 116 } // namespace net |
| OLD | NEW |