| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_crypto_stream.h" | 5 #include "net/quic/quic_crypto_stream.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 return data_len; | 55 return data_len; |
| 56 } | 56 } |
| 57 | 57 |
| 58 QuicPriority QuicCryptoStream::EffectivePriority() const { | 58 QuicPriority QuicCryptoStream::EffectivePriority() const { |
| 59 return QuicUtils::HighestPriority(); | 59 return QuicUtils::HighestPriority(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void QuicCryptoStream::SendHandshakeMessage( | 62 void QuicCryptoStream::SendHandshakeMessage( |
| 63 const CryptoHandshakeMessage& message) { | 63 const CryptoHandshakeMessage& message) { |
| 64 SendHandshakeMessage(message, NULL); |
| 65 } |
| 66 |
| 67 void QuicCryptoStream::SendHandshakeMessage( |
| 68 const CryptoHandshakeMessage& message, |
| 69 QuicAckNotifier::DelegateInterface* delegate) { |
| 64 DVLOG(1) << ENDPOINT << "Sending " << message.DebugString(); | 70 DVLOG(1) << ENDPOINT << "Sending " << message.DebugString(); |
| 65 session()->OnCryptoHandshakeMessageSent(message); | 71 session()->OnCryptoHandshakeMessageSent(message); |
| 66 const QuicData& data = message.GetSerialized(); | 72 const QuicData& data = message.GetSerialized(); |
| 67 // TODO(wtc): check the return value. | 73 // TODO(wtc): check the return value. |
| 68 WriteOrBufferData(string(data.data(), data.length()), false, NULL); | 74 WriteOrBufferData(string(data.data(), data.length()), false, delegate); |
| 69 } | 75 } |
| 70 | 76 |
| 71 bool QuicCryptoStream::ExportKeyingMaterial( | 77 bool QuicCryptoStream::ExportKeyingMaterial( |
| 72 StringPiece label, | 78 StringPiece label, |
| 73 StringPiece context, | 79 StringPiece context, |
| 74 size_t result_len, | 80 size_t result_len, |
| 75 string* result) const { | 81 string* result) const { |
| 76 if (!handshake_confirmed()) { | 82 if (!handshake_confirmed()) { |
| 77 DLOG(ERROR) << "ExportKeyingMaterial was called before forward-secure" | 83 DLOG(ERROR) << "ExportKeyingMaterial was called before forward-secure" |
| 78 << "encryption was established."; | 84 << "encryption was established."; |
| 79 return false; | 85 return false; |
| 80 } | 86 } |
| 81 return CryptoUtils::ExportKeyingMaterial( | 87 return CryptoUtils::ExportKeyingMaterial( |
| 82 crypto_negotiated_params_.subkey_secret, | 88 crypto_negotiated_params_.subkey_secret, |
| 83 label, | 89 label, |
| 84 context, | 90 context, |
| 85 result_len, | 91 result_len, |
| 86 result); | 92 result); |
| 87 } | 93 } |
| 88 | 94 |
| 89 const QuicCryptoNegotiatedParameters& | 95 const QuicCryptoNegotiatedParameters& |
| 90 QuicCryptoStream::crypto_negotiated_params() const { | 96 QuicCryptoStream::crypto_negotiated_params() const { |
| 91 return crypto_negotiated_params_; | 97 return crypto_negotiated_params_; |
| 92 } | 98 } |
| 93 | 99 |
| 94 } // namespace net | 100 } // namespace net |
| OLD | NEW |