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

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

Issue 14651009: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integer constant is too large for 'unsigned long' type Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/crypto_server_config.cc ('k') | net/quic/crypto/proof_test.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/crypto/null_encrypter.h" 5 #include "net/quic/crypto/null_encrypter.h"
6 #include "net/quic/quic_data_writer.h" 6 #include "net/quic/quic_data_writer.h"
7 #include "net/quic/quic_utils.h" 7 #include "net/quic/quic_utils.h"
8 8
9 using base::StringPiece; 9 using base::StringPiece;
10 using std::string; 10 using std::string;
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 bool NullEncrypter::Encrypt( 24 bool NullEncrypter::Encrypt(
25 StringPiece /*nonce*/, 25 StringPiece /*nonce*/,
26 StringPiece associated_data, 26 StringPiece associated_data,
27 StringPiece plaintext, 27 StringPiece plaintext,
28 unsigned char* output) { 28 unsigned char* output) {
29 string buffer = associated_data.as_string(); 29 string buffer = associated_data.as_string();
30 plaintext.AppendToString(&buffer); 30 plaintext.AppendToString(&buffer);
31 uint128 hash = QuicUtils::FNV1a_128_Hash(buffer.data(), buffer.length()); 31 uint128 hash = QuicUtils::FNV1a_128_Hash(buffer.data(), buffer.length());
32 memcpy(output, &hash, sizeof(hash)); 32 QuicUtils::SerializeUint128(hash, output);
33 memcpy(output + sizeof(hash), plaintext.data(), plaintext.size()); 33 memcpy(output + sizeof(hash), plaintext.data(), plaintext.size());
34 return true; 34 return true;
35 } 35 }
36 36
37 QuicData* NullEncrypter::EncryptPacket( 37 QuicData* NullEncrypter::EncryptPacket(
38 QuicPacketSequenceNumber /*sequence_number*/, 38 QuicPacketSequenceNumber /*sequence_number*/,
39 StringPiece associated_data, 39 StringPiece associated_data,
40 StringPiece plaintext) { 40 StringPiece plaintext) {
41 const size_t len = plaintext.size() + sizeof(uint128); 41 const size_t len = plaintext.size() + sizeof(uint128);
42 uint8* buffer = new uint8[len]; 42 uint8* buffer = new uint8[len];
(...skipping 19 matching lines...) Expand all
62 62
63 StringPiece NullEncrypter::GetKey() const { 63 StringPiece NullEncrypter::GetKey() const {
64 return StringPiece(); 64 return StringPiece();
65 } 65 }
66 66
67 StringPiece NullEncrypter::GetNoncePrefix() const { 67 StringPiece NullEncrypter::GetNoncePrefix() const {
68 return StringPiece(); 68 return StringPiece();
69 } 69 }
70 70
71 } // namespace net 71 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/crypto_server_config.cc ('k') | net/quic/crypto/proof_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698