Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: net/quic/crypto/quic_decrypter.h

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_ack_notifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Decrypt authenticates |associated_data| and |ciphertext| and then decrypts
43 // |ciphertext| into |output|, using |nonce|. |nonce| must be 8 bytes longer
44 // than the nonce prefix length returned by GetNoncePrefixSize() (of the
45 // encrypter). |output| must be as long as |ciphertext| on entry and, on
46 // successful return, the true length of the plaintext will be written to
47 // |*output_length|.
48 virtual bool Decrypt(base::StringPiece nonce,
49 base::StringPiece associated_data,
50 base::StringPiece ciphertext,
51 unsigned char* output,
52 size_t* output_length) = 0;
53
54 // Returns a newly created QuicData object containing the decrypted 42 // Returns a newly created QuicData object containing the decrypted
55 // |ciphertext| or nullptr if there is an error. |sequence_number| is 43 // |ciphertext| or nullptr if there is an error. |sequence_number| is
56 // appended to the |nonce_prefix| value provided in SetNoncePrefix() 44 // appended to the |nonce_prefix| value provided in SetNoncePrefix()
57 // to form the nonce. 45 // to form the nonce.
58 // TODO(wtc): add a way for DecryptPacket to report decryption failure due 46 // TODO(wtc): add a way for DecryptPacket to report decryption failure due
59 // to non-authentic inputs, as opposed to other reasons for failure. 47 // to non-authentic inputs, as opposed to other reasons for failure.
60 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, 48 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number,
61 base::StringPiece associated_data, 49 base::StringPiece associated_data,
62 base::StringPiece ciphertext) = 0; 50 base::StringPiece ciphertext) = 0;
63 51
64 // For use by unit tests only. 52 // For use by unit tests only.
65 virtual base::StringPiece GetKey() const = 0; 53 virtual base::StringPiece GetKey() const = 0;
66 virtual base::StringPiece GetNoncePrefix() const = 0; 54 virtual base::StringPiece GetNoncePrefix() const = 0;
67 }; 55 };
68 56
69 } // namespace net 57 } // namespace net
70 58
71 #endif // NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ 59 #endif // NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_ack_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698