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

Unified Diff: net/quic/crypto/quic_decrypter.h

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/crypto/null_encrypter_test.cc ('k') | net/quic/crypto/quic_encrypter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/quic_decrypter.h
diff --git a/net/quic/crypto/quic_decrypter.h b/net/quic/crypto/quic_decrypter.h
index e5c5635772352d1f3d787766bb25e206a3732d40..c8b691ddb24827a0ed4300ed2f6ddaffaffe2789 100644
--- a/net/quic/crypto/quic_decrypter.h
+++ b/net/quic/crypto/quic_decrypter.h
@@ -17,9 +17,37 @@ class NET_EXPORT_PRIVATE QuicDecrypter {
static QuicDecrypter* Create(CryptoTag algorithm);
+ // Sets the encryption key. Returns true on success, false on failure.
+ //
+ // NOTE: The key is the client_write_key or server_write_key derived from
+ // the master secret.
+ virtual bool SetKey(base::StringPiece key) = 0;
+
+ // Sets the fixed initial bytes of the nonce. Returns true on success,
+ // false on failure.
+ //
+ // NOTE: The nonce prefix is the client_write_iv or server_write_iv
+ // derived from the master secret. A 64-bit packet sequence number will
+ // be appended to form the nonce.
+ //
+ // <------------ 64 bits ----------->
+ // +---------------------+----------------------------------+
+ // | Fixed prefix | Packet sequence number |
+ // +---------------------+----------------------------------+
+ // Nonce format
+ //
+ // The security of the nonce format requires that QUIC never reuse a
+ // packet sequence number, even when retransmitting a lost packet.
+ virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) = 0;
+
// Returns a newly created QuicData object containing the decrypted
- // |ciphertext| or NULL if there is an error.
- virtual QuicData* Decrypt(base::StringPiece associated_data,
+ // |ciphertext| or NULL if there is an error. |sequence_number| is
+ // appended to the |nonce_prefix| value provided in SetNoncePrefix()
+ // to form the nonce.
+ // TODO(wtc): add a way for Decrypt to report decryption failure due
+ // to non-authentic inputs, as opposed to other reasons for failure.
+ virtual QuicData* Decrypt(QuicPacketSequenceNumber sequence_number,
+ base::StringPiece associated_data,
base::StringPiece ciphertext) = 0;
};
« no previous file with comments | « net/quic/crypto/null_encrypter_test.cc ('k') | net/quic/crypto/quic_encrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698