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

Unified Diff: net/quic/quic_crypto_client_stream.h

Issue 20047002: net: make QUIC ProofVerifier more generic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Can't use a token called "ERROR" on Windows. Created 7 years, 5 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
Index: net/quic/quic_crypto_client_stream.h
diff --git a/net/quic/quic_crypto_client_stream.h b/net/quic/quic_crypto_client_stream.h
index 4686fedf1a6c963409d9464601e1693419c42989..50cfbb867912d658ae7139ba5285334a58402e04 100644
--- a/net/quic/quic_crypto_client_stream.h
+++ b/net/quic/quic_crypto_client_stream.h
@@ -10,11 +10,13 @@
#include "net/cert/cert_verify_result.h"
#include "net/cert/x509_certificate.h"
#include "net/quic/crypto/crypto_handshake.h"
+#include "net/quic/crypto/proof_verifier.h"
#include "net/quic/quic_config.h"
#include "net/quic/quic_crypto_stream.h"
namespace net {
+class ProofVerifyDetails;
class QuicSession;
class SSLInfo;
@@ -47,7 +49,29 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
bool GetSSLInfo(SSLInfo* ssl_info);
private:
+ // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof.
+ // The ProofVerifier calls this class with the result of proof verification
+ // when verification is performed asynchronously.
+ class ProofVerifierCallbackImpl : public ProofVerifierCallback {
+ public:
+ explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream);
+ virtual ~ProofVerifierCallbackImpl();
+
+ // ProofVerifierCallback interface.
+ virtual void Run(bool ok,
+ const string& error_details,
+ scoped_ptr<ProofVerifyDetails>* details) OVERRIDE;
+
+ // Cancel causes any future callbacks to be ignored. It must be called on
+ // the same thread as the callback will be made on.
+ void Cancel();
+
+ private:
+ QuicCryptoClientStream* stream_;
+ };
+
friend class test::CryptoTestUtils;
+ friend class ProofVerifierCallbackImpl;
enum State {
STATE_IDLE,
@@ -59,17 +83,8 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
};
// DoHandshakeLoop performs a step of the handshake state machine. Note that
- // |in| is NULL for the first call. OnVerifyProofComplete passes the |result|
- // it has received from VerifyProof call (from all other places |result| is
- // set to OK).
- void DoHandshakeLoop(const CryptoHandshakeMessage* in, int result);
-
- // OnVerifyProofComplete is passed as the callback method to VerifyProof.
- // ProofVerifier calls this method with the result of proof verification when
- // verification is performed asynchronously.
- void OnVerifyProofComplete(int result);
-
- base::WeakPtrFactory<QuicCryptoClientStream> weak_factory_;
+ // |in| may be NULL if the call did not result from a received message
+ void DoHandshakeLoop(const CryptoHandshakeMessage* in);
State next_state_;
// num_client_hellos_ contains the number of client hello messages that this
@@ -86,13 +101,15 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
// Generation counter from QuicCryptoClientConfig's CachedState.
uint64 generation_counter_;
- // The result of certificate verification.
- // TODO(rtenneti): should we change CertVerifyResult to be
- // RefCountedThreadSafe object to avoid copying.
- CertVerifyResult cert_verify_result_;
+ // proof_verify_callback_ contains the callback object that we passed to an
+ // asynchronous proof verification. The ProofVerifier owns this object.
+ ProofVerifierCallbackImpl* proof_verify_callback_;
- // Error details for ProofVerifier's VerifyProof call.
- std::string error_details_;
+ // These members are used to store the result of an asynchronous proof
+ // verification.
+ bool verify_ok_;
+ string verify_error_details_;
+ scoped_ptr<ProofVerifyDetails> verify_details_;
DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream);
};

Powered by Google App Engine
This is Rietveld 408576698