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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/crypto/null_decrypter.h ('k') | net/quic/crypto/null_encrypter.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/crypto/null_decrypter.h" 5 #include "net/quic/crypto/null_decrypter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "net/quic/quic_data_reader.h" 9 #include "net/quic/quic_data_reader.h"
10 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 StringPiece NullDecrypter::GetNoncePrefix() const { 58 StringPiece NullDecrypter::GetNoncePrefix() const {
59 return StringPiece(); 59 return StringPiece();
60 } 60 }
61 61
62 const char* NullDecrypter::cipher_name() const { 62 const char* NullDecrypter::cipher_name() const {
63 return "NULL"; 63 return "NULL";
64 } 64 }
65 65
66 uint32 NullDecrypter::cipher_id() const { 66 uint32_t NullDecrypter::cipher_id() const {
67 return 0; 67 return 0;
68 } 68 }
69 69
70 bool NullDecrypter::ReadHash(QuicDataReader* reader, uint128* hash) { 70 bool NullDecrypter::ReadHash(QuicDataReader* reader, uint128* hash) {
71 uint64 lo; 71 uint64_t lo;
72 uint32 hi; 72 uint32_t hi;
73 if (!reader->ReadUInt64(&lo) || !reader->ReadUInt32(&hi)) { 73 if (!reader->ReadUInt64(&lo) || !reader->ReadUInt32(&hi)) {
74 return false; 74 return false;
75 } 75 }
76 *hash = hi; 76 *hash = hi;
77 *hash <<= 64; 77 *hash <<= 64;
78 *hash += lo; 78 *hash += lo;
79 return true; 79 return true;
80 } 80 }
81 81
82 uint128 NullDecrypter::ComputeHash(const StringPiece data1, 82 uint128 NullDecrypter::ComputeHash(const StringPiece data1,
83 const StringPiece data2) const { 83 const StringPiece data2) const {
84 uint128 correct_hash = QuicUtils::FNV1a_128_Hash_Two( 84 uint128 correct_hash = QuicUtils::FNV1a_128_Hash_Two(
85 data1.data(), data1.length(), data2.data(), data2.length()); 85 data1.data(), data1.length(), data2.data(), data2.length());
86 uint128 mask(UINT64_C(0x0), UINT64_C(0xffffffff)); 86 uint128 mask(UINT64_C(0x0), UINT64_C(0xffffffff));
87 mask <<= 96; 87 mask <<= 96;
88 correct_hash &= ~mask; 88 correct_hash &= ~mask;
89 return correct_hash; 89 return correct_hash;
90 } 90 }
91 91
92 } // namespace net 92 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/null_decrypter.h ('k') | net/quic/crypto/null_encrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698