Index: net/quic/crypto/crypto_utils.cc |
diff --git a/net/quic/crypto/crypto_utils.cc b/net/quic/crypto/crypto_utils.cc |
index 8843e2c692bf825513cec5e591b5917eb6f7f99b..2b22acd9930610f37a0ac6e9fed9e5cb5e8bbb0e 100644 |
--- a/net/quic/crypto/crypto_utils.cc |
+++ b/net/quic/crypto/crypto_utils.cc |
@@ -5,6 +5,7 @@ |
#include "net/quic/crypto/crypto_utils.h" |
#include "crypto/hkdf.h" |
+#include "crypto/secure_hash.h" |
#include "net/base/url_util.h" |
#include "net/quic/crypto/crypto_handshake.h" |
#include "net/quic/crypto/crypto_protocol.h" |
@@ -274,4 +275,16 @@ const char* CryptoUtils::HandshakeFailureReasonToString( |
return "INVALID_HANDSHAKE_FAILURE_REASON"; |
} |
+// static |
+void CryptoUtils::HashHandshakeMessage(const CryptoHandshakeMessage& message, |
+ string* output) { |
+ const QuicData& serialized = message.GetSerialized(); |
+ scoped_ptr<crypto::SecureHash> hash( |
+ crypto::SecureHash::Create(crypto::SecureHash::SHA256)); |
+ hash->Update(serialized.data(), serialized.length()); |
+ uint8_t digest[32]; |
+ hash->Finish(digest, sizeof(digest)); |
+ output->assign(reinterpret_cast<const char*>(&digest), sizeof(digest)); |
+} |
+ |
} // namespace net |