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_CRYPTO_QUIC_DECRYPTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ |
6 #define NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ |
7 | 7 |
8 #include "net/base/net_export.h" | 8 #include "net/base/net_export.h" |
9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // <------------ 64 bits -----------> | 32 // <------------ 64 bits -----------> |
33 // +---------------------+----------------------------------+ | 33 // +---------------------+----------------------------------+ |
34 // | Fixed prefix | Packet sequence number | | 34 // | Fixed prefix | Packet sequence number | |
35 // +---------------------+----------------------------------+ | 35 // +---------------------+----------------------------------+ |
36 // Nonce format | 36 // Nonce format |
37 // | 37 // |
38 // The security of the nonce format requires that QUIC never reuse a | 38 // The security of the nonce format requires that QUIC never reuse a |
39 // packet sequence number, even when retransmitting a lost packet. | 39 // packet sequence number, even when retransmitting a lost packet. |
40 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) = 0; | 40 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) = 0; |
41 | 41 |
42 // Returns a newly created QuicData object containing the decrypted | 42 // Populates |output| with the decrypted |ciphertext| and populates |
43 // |ciphertext| or nullptr if there is an error. |sequence_number| is | 43 // |output_length| with the length. Returns 0 if there is an error. |
| 44 // |output| size is specified by |max_output_length| and must be |
| 45 // at least as large as the ciphertext. |sequence_number| is |
44 // appended to the |nonce_prefix| value provided in SetNoncePrefix() | 46 // appended to the |nonce_prefix| value provided in SetNoncePrefix() |
45 // to form the nonce. | 47 // to form the nonce. |
46 // TODO(wtc): add a way for DecryptPacket to report decryption failure due | 48 // TODO(wtc): add a way for DecryptPacket to report decryption failure due |
47 // to non-authentic inputs, as opposed to other reasons for failure. | 49 // to non-authentic inputs, as opposed to other reasons for failure. |
48 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, | 50 virtual bool DecryptPacket(QuicPacketSequenceNumber sequence_number, |
49 base::StringPiece associated_data, | 51 const base::StringPiece& associated_data, |
50 base::StringPiece ciphertext) = 0; | 52 const base::StringPiece& ciphertext, |
| 53 char* output, |
| 54 size_t* output_length, |
| 55 size_t max_output_length) = 0; |
51 | 56 |
52 // For use by unit tests only. | 57 // For use by unit tests only. |
53 virtual base::StringPiece GetKey() const = 0; | 58 virtual base::StringPiece GetKey() const = 0; |
54 virtual base::StringPiece GetNoncePrefix() const = 0; | 59 virtual base::StringPiece GetNoncePrefix() const = 0; |
55 }; | 60 }; |
56 | 61 |
57 } // namespace net | 62 } // namespace net |
58 | 63 |
59 #endif // NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ | 64 #endif // NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ |
OLD | NEW |