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

Unified Diff: net/quic/crypto/crypto_utils.cc

Issue 14411004: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use CONFIG_VERSION insteaf of VERSION Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/crypto/crypto_utils.cc
diff --git a/net/quic/crypto/crypto_utils.cc b/net/quic/crypto/crypto_utils.cc
index 6e52898462cc50f9c7553e169099eae305a16d3a..e7a2376659241ed2f7eea3787583bb601bd1245f 100644
--- a/net/quic/crypto/crypto_utils.cc
+++ b/net/quic/crypto/crypto_utils.cc
@@ -72,7 +72,12 @@ void CryptoUtils::GenerateNonce(QuicTime::Delta now,
nonce->reserve(kNonceSize);
nonce->resize(kNonceSize);
uint32 gmt_unix_time = now.ToSeconds();
- memcpy(&(*nonce)[0], &gmt_unix_time, sizeof(gmt_unix_time));
+ // The time in the nonce must be encoded in big-endian because the
+ // strike-register depends on the nonces being ordered by time.
+ (*nonce)[0] = static_cast<char>(gmt_unix_time >> 24);
+ (*nonce)[1] = static_cast<char>(gmt_unix_time >> 16);
+ (*nonce)[2] = static_cast<char>(gmt_unix_time >> 8);
+ (*nonce)[3] = static_cast<char>(gmt_unix_time);
size_t bytes_written = sizeof(gmt_unix_time);
if (orbit.size() == 8) {

Powered by Google App Engine
This is Rietveld 408576698