| 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 #ifndef NET_QUIC_CORE_CRYPTO_QUIC_DECRYPTER_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_QUIC_DECRYPTER_H_ |
| 6 #define NET_QUIC_CORE_CRYPTO_QUIC_DECRYPTER_H_ | 6 #define NET_QUIC_CORE_CRYPTO_QUIC_DECRYPTER_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // Populates |output| with the decrypted |ciphertext| and populates | 61 // Populates |output| with the decrypted |ciphertext| and populates |
| 62 // |output_length| with the length. Returns 0 if there is an error. | 62 // |output_length| with the length. Returns 0 if there is an error. |
| 63 // |output| size is specified by |max_output_length| and must be | 63 // |output| size is specified by |max_output_length| and must be |
| 64 // at least as large as the ciphertext. |packet_number| is | 64 // at least as large as the ciphertext. |packet_number| is |
| 65 // appended to the |nonce_prefix| value provided in SetNoncePrefix() | 65 // appended to the |nonce_prefix| value provided in SetNoncePrefix() |
| 66 // to form the nonce. | 66 // to form the nonce. |
| 67 // TODO(wtc): add a way for DecryptPacket to report decryption failure due | 67 // TODO(wtc): add a way for DecryptPacket to report decryption failure due |
| 68 // to non-authentic inputs, as opposed to other reasons for failure. | 68 // to non-authentic inputs, as opposed to other reasons for failure. |
| 69 virtual bool DecryptPacket(QuicVersion version, | 69 virtual bool DecryptPacket(QuicVersion version, |
| 70 QuicPathId path_id, | |
| 71 QuicPacketNumber packet_number, | 70 QuicPacketNumber packet_number, |
| 72 base::StringPiece associated_data, | 71 base::StringPiece associated_data, |
| 73 base::StringPiece ciphertext, | 72 base::StringPiece ciphertext, |
| 74 char* output, | 73 char* output, |
| 75 size_t* output_length, | 74 size_t* output_length, |
| 76 size_t max_output_length) = 0; | 75 size_t max_output_length) = 0; |
| 77 | 76 |
| 78 // The name of the cipher. | 77 // The name of the cipher. |
| 79 virtual const char* cipher_name() const = 0; | 78 virtual const char* cipher_name() const = 0; |
| 80 // The ID of the cipher. Return 0x03000000 ORed with the 'cryptographic suite | 79 // The ID of the cipher. Return 0x03000000 ORed with the 'cryptographic suite |
| 81 // selector'. | 80 // selector'. |
| 82 virtual uint32_t cipher_id() const = 0; | 81 virtual uint32_t cipher_id() const = 0; |
| 83 | 82 |
| 84 // For use by unit tests only. | 83 // For use by unit tests only. |
| 85 virtual base::StringPiece GetKey() const = 0; | 84 virtual base::StringPiece GetKey() const = 0; |
| 86 virtual base::StringPiece GetNoncePrefix() const = 0; | 85 virtual base::StringPiece GetNoncePrefix() const = 0; |
| 87 | 86 |
| 88 static void DiversifyPreliminaryKey(base::StringPiece preliminary_key, | 87 static void DiversifyPreliminaryKey(base::StringPiece preliminary_key, |
| 89 base::StringPiece nonce_prefix, | 88 base::StringPiece nonce_prefix, |
| 90 const DiversificationNonce& nonce, | 89 const DiversificationNonce& nonce, |
| 91 size_t key_size, | 90 size_t key_size, |
| 92 size_t nonce_prefix_size, | 91 size_t nonce_prefix_size, |
| 93 std::string* out_key, | 92 std::string* out_key, |
| 94 std::string* out_nonce_prefix); | 93 std::string* out_nonce_prefix); |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 } // namespace net | 96 } // namespace net |
| 98 | 97 |
| 99 #endif // NET_QUIC_CORE_CRYPTO_QUIC_DECRYPTER_H_ | 98 #endif // NET_QUIC_CORE_CRYPTO_QUIC_DECRYPTER_H_ |
| OLD | NEW |