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

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

Issue 1765603002: Add QUIC 31 in which the server's proof covers both the static server config as well as a hash of t… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
« no previous file with comments | « net/quic/crypto/crypto_utils.h ('k') | net/quic/crypto/proof_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/quic/crypto/crypto_utils.h ('k') | net/quic/crypto/proof_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698