| 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_framer.h" | 5 #include "net/quic/quic_framer.h" |
| 6 | 6 |
| 7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
| 8 #include "net/quic/crypto/quic_decrypter.h" | 8 #include "net/quic/crypto/quic_decrypter.h" |
| 9 #include "net/quic/crypto/quic_encrypter.h" | 9 #include "net/quic/crypto/quic_encrypter.h" |
| 10 #include "net/quic/quic_data_reader.h" | 10 #include "net/quic/quic_data_reader.h" |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 return new QuicEncryptedPacket(buffer, len, true); | 1089 return new QuicEncryptedPacket(buffer, len, true); |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 size_t QuicFramer::GetMaxPlaintextSize(size_t ciphertext_size) { | 1092 size_t QuicFramer::GetMaxPlaintextSize(size_t ciphertext_size) { |
| 1093 // In order to keep the code simple, we don't have the current encryption | 1093 // In order to keep the code simple, we don't have the current encryption |
| 1094 // level to hand. At the moment, all AEADs have a tag-length of 16 bytes so | 1094 // level to hand. At the moment, all AEADs have a tag-length of 16 bytes so |
| 1095 // that doesn't matter but we take the minimum plaintext length just to be | 1095 // that doesn't matter but we take the minimum plaintext length just to be |
| 1096 // safe. | 1096 // safe. |
| 1097 size_t min_plaintext_size = ciphertext_size; | 1097 size_t min_plaintext_size = ciphertext_size; |
| 1098 | 1098 |
| 1099 for (int i = ENCRYPTION_NONE; i <= ENCRYPTION_FORWARD_SECURE; i++) { | 1099 for (int i = ENCRYPTION_NONE; i < NUM_ENCRYPTION_LEVELS; i++) { |
| 1100 if (encrypter_[i].get() != NULL) { | 1100 if (encrypter_[i].get() != NULL) { |
| 1101 size_t size = encrypter_[i]->GetMaxPlaintextSize(ciphertext_size); | 1101 size_t size = encrypter_[i]->GetMaxPlaintextSize(ciphertext_size); |
| 1102 if (size < min_plaintext_size) { | 1102 if (size < min_plaintext_size) { |
| 1103 min_plaintext_size = size; | 1103 min_plaintext_size = size; |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 return min_plaintext_size; | 1108 return min_plaintext_size; |
| 1109 } | 1109 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 | 1477 |
| 1478 bool QuicFramer::RaiseError(QuicErrorCode error) { | 1478 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 1479 DLOG(INFO) << detailed_error_; | 1479 DLOG(INFO) << detailed_error_; |
| 1480 set_error(error); | 1480 set_error(error); |
| 1481 visitor_->OnError(this); | 1481 visitor_->OnError(this); |
| 1482 reader_.reset(NULL); | 1482 reader_.reset(NULL); |
| 1483 return false; | 1483 return false; |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 } // namespace net | 1486 } // namespace net |
| OLD | NEW |