Update broken references to image assets
[chromium-blink-merge.git] / net / quic / p2p / quic_p2p_crypto_stream.cc
blob6ecb3732d1026ccbe7cb02b9952b79f569247850
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/quic/p2p/quic_p2p_crypto_stream.h"
7 #include "crypto/hkdf.h"
8 #include "net/quic/crypto/crypto_handshake_message.h"
9 #include "net/quic/crypto/quic_decrypter.h"
10 #include "net/quic/crypto/quic_encrypter.h"
11 #include "net/quic/quic_session.h"
13 namespace net {
15 QuicP2PCryptoStream::QuicP2PCryptoStream(QuicSession* session,
16 const QuicP2PCryptoConfig& config)
17 : QuicCryptoStream(session), config_(config) {}
19 QuicP2PCryptoStream::~QuicP2PCryptoStream() {}
21 bool QuicP2PCryptoStream::Connect() {
22 QuicCryptoNegotiatedParameters crypto_params;
23 if (!config_.GetNegotiatedParameters(session()->connection()->perspective(),
24 &crypto_params)) {
25 return false;
28 CrypterPair* crypters = &crypto_params.forward_secure_crypters;
30 session()->connection()->SetEncrypter(ENCRYPTION_FORWARD_SECURE,
31 crypters->encrypter.release());
32 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
33 session()->connection()->SetAlternativeDecrypter(
34 ENCRYPTION_FORWARD_SECURE, crypters->decrypter.release(),
35 false /* don't latch */);
36 encryption_established_ = true;
37 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_FIRST_ESTABLISHED);
38 session()->OnConfigNegotiated();
39 session()->connection()->OnHandshakeComplete();
40 handshake_confirmed_ = true;
41 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
43 return true;
46 } // namespace net