Index: net/quic/crypto/crypto_utils.cc |
diff --git a/net/quic/crypto/crypto_utils.cc b/net/quic/crypto/crypto_utils.cc |
index 67af2e9469ca622abd475b15712c82134e48dbad..c5957750654659225bc2cf0ccf796e7e476cfaaa 100644 |
--- a/net/quic/crypto/crypto_utils.cc |
+++ b/net/quic/crypto/crypto_utils.cc |
@@ -28,19 +28,21 @@ void CryptoUtils::GenerateNonce(QuicWallTime now, |
// a 4-byte timestamp + 28 random bytes. |
nonce->reserve(kNonceSize); |
nonce->resize(kNonceSize); |
- uint32 gmt_unix_time = now.ToUNIXSeconds(); |
+ |
+ uint32 gmt_unix_time = static_cast<uint32>(now.ToUNIXSeconds()); |
// 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 = 4; |
- size_t bytes_written = sizeof(gmt_unix_time); |
if (orbit.size() == 8) { |
memcpy(&(*nonce)[bytes_written], orbit.data(), orbit.size()); |
bytes_written += orbit.size(); |
} |
+ |
random_generator->RandBytes(&(*nonce)[bytes_written], |
kNonceSize - bytes_written); |
} |