forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dan Zhang <danzh@google.com>
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
source/extensions/quic_listeners/quiche/envoy_quic_fake_proof_source.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include "quiche/quic/core/crypto/proof_source.h" | ||
#include "quiche/quic/platform/api/quic_reference_counted.h" | ||
|
||
namespace Envoy { | ||
|
||
class EnvoyQuicFakeProofSource : public quic::ProofSource { | ||
public: | ||
EnvoyQuicFakeProofSource() {} | ||
~EnvoyQuicFakeProofSource() override {} | ||
|
||
// ProofSource | ||
void GetProof(const quic::QuicSocketAddress& server_address, const std::string& hostname, | ||
const std::string& server_config, quic::QuicTransportVersion transport_version, | ||
quic::QuicStringPiece chlo_hash, | ||
std::unique_ptr<quic::Callback> callback) override { | ||
quic::QuicReferenceCountedPointer<quic::ProofSource::Chain> chain = | ||
GetCertChain(server_address, hostname); | ||
quic::QuicCryptoProof proof; | ||
proof.signature = "Dummy signature"; | ||
proof.leaf_cert_scts = "Dummy timestamp"; | ||
callback->Run(true, chain, proof, nullptr /* details */); | ||
} | ||
|
||
quic::QuicReferenceCountedPointer<Chain> | ||
GetCertChain(const quic::QuicSocketAddress& server_address, | ||
const std::string& hostname) override { | ||
std::vector<std::string> certs; | ||
certs.push_back(kDummyCertName); | ||
return quic::QuicReferenceCountedPointer<quic::ProofSource::Chain>( | ||
new quic::ProofSource::Chain(certs)); | ||
} | ||
|
||
void ComputeTlsSignature(const quic::QuicSocketAddress& server_address, | ||
const std::string& hostname, uint16_t signature_algorithm, | ||
quic::QuicStringPiece in, | ||
std::unique_ptr<quic::SignatureCallback> callback) override { | ||
callback->Run(true, "Dummy signature"); | ||
} | ||
}; | ||
|
||
} // namespace Envoy |
31 changes: 31 additions & 0 deletions
31
source/extensions/quic_listeners/quiche/envoy_quic_fake_proof_verifier.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "quiche/quic/core/crypto/proof_verifier.h" | ||
|
||
namespace Envoy { | ||
|
||
class EnvoyQuicFakeProofVerifier : public quic::ProofVerifier { | ||
public: | ||
EnvoyQuicFakeProofVerifier() {} | ||
~EnvoyQuicFakeProofVerifier() override {} | ||
|
||
quic::QuicAsyncStatus | ||
VerifyProof(const string& /*hostname*/, const uint16_t /*port*/, const string& /*server_config*/, | ||
quic::QuicTransportVersion /*quic_version*/, absl::string_view /*chlo_hash*/, | ||
const std::vector<string>& /*certs*/, const string& /*cert_sct*/, | ||
const string& /*signature*/, const quic::ProofVerifyContext* /*context*/, | ||
string* /*error_details*/, std::unique_ptr<quic::ProofVerifyDetails>* /*details*/, | ||
std::unique_ptr<quic::ProofVerifierCallback> /*callback*/) override { | ||
return quic::QUIC_SUCCESS; | ||
} | ||
quic::QuicAsyncStatus | ||
VerifyCertChain(const string& /*hostname*/, const std::vector<string>& /*certs*/, | ||
const quic::ProofVerifyContext* /*context*/, string* /*error_details*/, | ||
std::unique_ptr<quic::ProofVerifyDetails>* /*details*/, | ||
std::unique_ptr<quic::ProofVerifierCallback> /*callback*/) override { | ||
return quic::QUIC_SUCCESS; | ||
} | ||
std::unique_ptr<quic::ProofVerifyContext> CreateDefaultContext() override { return nullptr; } | ||
}; | ||
|
||
} // namespace Envoy |