Index: net/quic/crypto/quic_decrypter.cc |
diff --git a/net/quic/crypto/quic_decrypter.cc b/net/quic/crypto/quic_decrypter.cc |
index eae1f8fcf6d6f3fcaa5776da6cc01cb19ca869f7..193d1e87eb4a0a44774df4670268d6eb3f47eba4 100644 |
--- a/net/quic/crypto/quic_decrypter.cc |
+++ b/net/quic/crypto/quic_decrypter.cc |
@@ -4,11 +4,15 @@ |
#include "net/quic/crypto/quic_decrypter.h" |
+#include "crypto/hkdf.h" |
#include "net/quic/crypto/aes_128_gcm_12_decrypter.h" |
#include "net/quic/crypto/chacha20_poly1305_rfc7539_decrypter.h" |
#include "net/quic/crypto/crypto_protocol.h" |
#include "net/quic/crypto/null_decrypter.h" |
+using base::StringPiece; |
+using std::string; |
+ |
namespace net { |
// static |
@@ -26,4 +30,20 @@ QuicDecrypter* QuicDecrypter::Create(QuicTag algorithm) { |
} |
} |
+// static |
+void QuicDecrypter::DiversifyPreliminaryKey(StringPiece preliminary_key, |
+ StringPiece nonce_prefix, |
+ DiversificationNonce nonce, |
+ size_t key_size, |
+ size_t nonce_prefix_size, |
+ string* out_key, |
+ string* out_nonce_prefix) { |
+ crypto::HKDF hkdf(preliminary_key.as_string() + nonce_prefix.as_string(), |
+ StringPiece(nonce, kDiversificationNonceSize), |
+ "QUIC key diversification", 0, key_size, 0, |
+ nonce_prefix_size, 0); |
+ *out_key = hkdf.server_write_key().as_string(); |
+ *out_nonce_prefix = hkdf.server_write_iv().as_string(); |
+} |
+ |
} // namespace net |