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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/crypto/crypto_utils.h" 5 #include "net/quic/crypto/crypto_utils.h"
6 6
7 #include "crypto/hkdf.h" 7 #include "crypto/hkdf.h"
8 #include "crypto/secure_hash.h"
8 #include "net/base/url_util.h" 9 #include "net/base/url_util.h"
9 #include "net/quic/crypto/crypto_handshake.h" 10 #include "net/quic/crypto/crypto_handshake.h"
10 #include "net/quic/crypto/crypto_protocol.h" 11 #include "net/quic/crypto/crypto_protocol.h"
11 #include "net/quic/crypto/quic_decrypter.h" 12 #include "net/quic/crypto/quic_decrypter.h"
12 #include "net/quic/crypto/quic_encrypter.h" 13 #include "net/quic/crypto/quic_encrypter.h"
13 #include "net/quic/crypto/quic_random.h" 14 #include "net/quic/crypto/quic_random.h"
14 #include "net/quic/quic_time.h" 15 #include "net/quic/quic_time.h"
15 #include "net/quic/quic_utils.h" 16 #include "net/quic/quic_utils.h"
16 #include "url/url_canon.h" 17 #include "url/url_canon.h"
17 18
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 268
268 RETURN_STRING_LITERAL(INVALID_EXPECTED_LEAF_CERTIFICATE); 269 RETURN_STRING_LITERAL(INVALID_EXPECTED_LEAF_CERTIFICATE);
269 RETURN_STRING_LITERAL(MAX_FAILURE_REASON); 270 RETURN_STRING_LITERAL(MAX_FAILURE_REASON);
270 } 271 }
271 // Return a default value so that we return this when |reason| doesn't match 272 // Return a default value so that we return this when |reason| doesn't match
272 // any HandshakeFailureReason.. This can happen when the message by the peer 273 // any HandshakeFailureReason.. This can happen when the message by the peer
273 // (attacker) has invalid reason. 274 // (attacker) has invalid reason.
274 return "INVALID_HANDSHAKE_FAILURE_REASON"; 275 return "INVALID_HANDSHAKE_FAILURE_REASON";
275 } 276 }
276 277
278 // static
279 void CryptoUtils::HashHandshakeMessage(const CryptoHandshakeMessage& message,
280 string* output) {
281 const QuicData& serialized = message.GetSerialized();
282 scoped_ptr<crypto::SecureHash> hash(
283 crypto::SecureHash::Create(crypto::SecureHash::SHA256));
284 hash->Update(serialized.data(), serialized.length());
285 uint8_t digest[32];
286 hash->Finish(digest, sizeof(digest));
287 output->assign(reinterpret_cast<const char*>(&digest), sizeof(digest));
288 }
289
277 } // namespace net 290 } // namespace net
OLDNEW
« 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