Index: net/quic/crypto/aead_base_decrypter_nss.cc |
diff --git a/net/quic/crypto/aead_base_decrypter_nss.cc b/net/quic/crypto/aead_base_decrypter_nss.cc |
index 710673071a89f0554bc95bc5b8edf4c9648a9672..26e72ee61528d21c5927b627444b8aea66fabafe 100644 |
--- a/net/quic/crypto/aead_base_decrypter_nss.cc |
+++ b/net/quic/crypto/aead_base_decrypter_nss.cc |
@@ -9,6 +9,7 @@ |
#include "base/memory/scoped_ptr.h" |
#include "crypto/scoped_nss_types.h" |
#include "net/quic/quic_flags.h" |
+#include "net/quic/quic_utils.h" |
using base::StringPiece; |
@@ -62,15 +63,8 @@ bool AeadBaseDecrypter::DecryptPacket(QuicPathId path_id, |
DCHECK_LE(nonce_size, sizeof(nonce)); |
memcpy(nonce, nonce_prefix_, nonce_prefix_size_); |
if (FLAGS_quic_include_path_id_in_iv) { |
- // Setting the nonce below relies on QuicPathId and QuicPacketNumber being |
- // specific sizes. |
- static_assert(sizeof(path_id) == 1, "Size of QuicPathId changed."); |
- static_assert(sizeof(packet_number) == 8, |
- "Size of QuicPacketNumber changed."); |
- // Use path_id and lower 7 bytes of packet_number as lower 8 bytes of nonce. |
uint64_t path_id_packet_number = |
- (static_cast<uint64_t>(path_id) << 56) | packet_number; |
- DCHECK(path_id != kDefaultPathId || path_id_packet_number == packet_number); |
+ QuicUtils::PackPathIdAndPacketNumber(path_id, packet_number); |
memcpy(nonce + nonce_prefix_size_, &path_id_packet_number, |
sizeof(path_id_packet_number)); |
} else { |