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

Side by Side Diff: components/gcm_driver/crypto/gcm_message_cryptographer.cc

Issue 1485023003: Misc truncation fixes for gn builds with VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes to four more components/content files 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/gcm_driver/crypto/gcm_message_cryptographer.h" 5 #include "components/gcm_driver/crypto/gcm_message_cryptographer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 std::stringstream info_stream; 48 std::stringstream info_stream;
49 info_stream << "Content-Encoding: " << content_encoding << '\x00'; 49 info_stream << "Content-Encoding: " << content_encoding << '\x00';
50 50
51 switch (label) { 51 switch (label) {
52 case GCMMessageCryptographer::Label::P256: 52 case GCMMessageCryptographer::Label::P256:
53 info_stream << "P-256" << '\x00'; 53 info_stream << "P-256" << '\x00';
54 break; 54 break;
55 } 55 }
56 56
57 uint16_t local_len = base::HostToNet16(recipient_public_key.size()); 57 uint16_t local_len =
58 base::HostToNet16(static_cast<uint16_t>(recipient_public_key.size()));
58 info_stream.write(reinterpret_cast<char*>(&local_len), sizeof(local_len)); 59 info_stream.write(reinterpret_cast<char*>(&local_len), sizeof(local_len));
59 info_stream << recipient_public_key; 60 info_stream << recipient_public_key;
60 61
61 uint16_t peer_len = base::HostToNet16(sender_public_key.size()); 62 uint16_t peer_len =
63 base::HostToNet16(static_cast<uint16_t>(sender_public_key.size()));
62 info_stream.write(reinterpret_cast<char*>(&peer_len), sizeof(peer_len)); 64 info_stream.write(reinterpret_cast<char*>(&peer_len), sizeof(peer_len));
63 info_stream << sender_public_key; 65 info_stream << sender_public_key;
64 66
65 return info_stream.str(); 67 return info_stream.str();
66 } 68 }
67 69
68 } // namespace 70 } // namespace
69 71
70 const size_t GCMMessageCryptographer::kAuthenticationTagBytes = 16; 72 const size_t GCMMessageCryptographer::kAuthenticationTagBytes = 16;
71 const size_t GCMMessageCryptographer::kSaltSize = 16; 73 const size_t GCMMessageCryptographer::kSaltSize = 16;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 0 /* subkey_secret_bytes_to_generate */); 218 0 /* subkey_secret_bytes_to_generate */);
217 219
218 // draft-thomson-http-encryption defines that the result should be XOR'ed with 220 // draft-thomson-http-encryption defines that the result should be XOR'ed with
219 // the record's sequence number, however, Web Push encryption is limited to a 221 // the record's sequence number, however, Web Push encryption is limited to a
220 // single record per draft-ietf-webpush-encryption. 222 // single record per draft-ietf-webpush-encryption.
221 223
222 return hkdf.client_write_key().as_string(); 224 return hkdf.client_write_key().as_string();
223 } 225 }
224 226
225 } // namespace gcm 227 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/util.cc ('k') | components/history/core/browser/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698