| 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_ENCRYPTER_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_QUIC_ENCRYPTER_H_ |
| 6 #define NET_QUIC_CORE_CRYPTO_QUIC_ENCRYPTER_H_ | 6 #define NET_QUIC_CORE_CRYPTO_QUIC_ENCRYPTER_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 | 9 |
| 10 #include "net/quic/core/quic_packets.h" | 10 #include "net/quic/core/quic_packets.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) = 0; | 42 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) = 0; |
| 43 | 43 |
| 44 // Writes encrypted |plaintext| and a MAC over |plaintext| and | 44 // Writes encrypted |plaintext| and a MAC over |plaintext| and |
| 45 // |associated_data| into output. Sets |output_length| to the number of | 45 // |associated_data| into output. Sets |output_length| to the number of |
| 46 // bytes written. Returns true on success or false if there was an error. | 46 // bytes written. Returns true on success or false if there was an error. |
| 47 // |packet_number| is appended to the |nonce_prefix| value provided in | 47 // |packet_number| is appended to the |nonce_prefix| value provided in |
| 48 // SetNoncePrefix() to form the nonce. |output| must not overlap with | 48 // SetNoncePrefix() to form the nonce. |output| must not overlap with |
| 49 // |associated_data|. If |output| overlaps with |plaintext| then | 49 // |associated_data|. If |output| overlaps with |plaintext| then |
| 50 // |plaintext| must be <= |output|. | 50 // |plaintext| must be <= |output|. |
| 51 virtual bool EncryptPacket(QuicVersion version, | 51 virtual bool EncryptPacket(QuicVersion version, |
| 52 QuicPathId path_id, | |
| 53 QuicPacketNumber packet_number, | 52 QuicPacketNumber packet_number, |
| 54 base::StringPiece associated_data, | 53 base::StringPiece associated_data, |
| 55 base::StringPiece plaintext, | 54 base::StringPiece plaintext, |
| 56 char* output, | 55 char* output, |
| 57 size_t* output_length, | 56 size_t* output_length, |
| 58 size_t max_output_length) = 0; | 57 size_t max_output_length) = 0; |
| 59 | 58 |
| 60 // GetKeySize() and GetNoncePrefixSize() tell the HKDF class how many bytes | 59 // GetKeySize() and GetNoncePrefixSize() tell the HKDF class how many bytes |
| 61 // of key material needs to be derived from the master secret. | 60 // of key material needs to be derived from the master secret. |
| 62 // NOTE: the sizes returned by GetKeySize() and GetNoncePrefixSize() are | 61 // NOTE: the sizes returned by GetKeySize() and GetNoncePrefixSize() are |
| (...skipping 14 matching lines...) Expand all Loading... |
| 77 virtual size_t GetCiphertextSize(size_t plaintext_size) const = 0; | 76 virtual size_t GetCiphertextSize(size_t plaintext_size) const = 0; |
| 78 | 77 |
| 79 // For use by unit tests only. | 78 // For use by unit tests only. |
| 80 virtual base::StringPiece GetKey() const = 0; | 79 virtual base::StringPiece GetKey() const = 0; |
| 81 virtual base::StringPiece GetNoncePrefix() const = 0; | 80 virtual base::StringPiece GetNoncePrefix() const = 0; |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 } // namespace net | 83 } // namespace net |
| 85 | 84 |
| 86 #endif // NET_QUIC_CORE_CRYPTO_QUIC_ENCRYPTER_H_ | 85 #endif // NET_QUIC_CORE_CRYPTO_QUIC_ENCRYPTER_H_ |
| OLD | NEW |