Skip to content

Commit 74615ef

Browse files
committed
apply libquic changes (55.0.2861.0)
1 parent a94d7b5 commit 74615ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+717
-319
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#CXX=g++-4.8
22
#AR=ar
33
#CC=gcc-4.8
4-
CFLAGS=-Wall -Ilibquic/src -Ilibquic/src/third_party/protobuf/src -DUSE_OPENSSL=1 -Iboringssl/include -g -gdwarf-4
4+
CFLAGS=-Wall -Ilibquic/src -Ilibquic/src/third_party/protobuf/src -DUSE_OPENSSL=1 -Iboringssl/include -g
55
CPPFLAGS=--std=gnu++11
66
CPP_FILES:=$(wildcard src/*.cc)
77
CPP_BASE_FILES:=$(CPP_FILES:src/%=%)

go_functions.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ void DeleteGoSession_C(int64_t go_quic_dispatcher, int64_t go_quic_server_sessio
2222
DeleteGoSession(go_quic_dispatcher, go_quic_server_session);
2323
}
2424

25-
int GetProof_C(int64_t go_proof_source, char* server_ip, size_t server_ip_sz, char* hostname, size_t hostname_sz, char* server_config, size_t server_config_sz, int quic_version, char* chlo_hash, size_t chlo_hash_len, int ecdsa_ok, char **out_signature, size_t *out_signature_sz) {
26-
return GetProof(go_proof_source, server_ip, server_ip_sz, hostname, hostname_sz, server_config, server_config_sz, quic_version, chlo_hash, chlo_hash_len, ecdsa_ok, out_signature, out_signature_sz);
25+
int GetProof_C(int64_t go_proof_source, char* server_ip, size_t server_ip_sz, char* hostname, size_t hostname_sz, char* server_config, size_t server_config_sz, int quic_version, char* chlo_hash, size_t chlo_hash_len, char **out_signature, size_t *out_signature_sz) {
26+
return GetProof(go_proof_source, server_ip, server_ip_sz, hostname, hostname_sz, server_config, server_config_sz, quic_version, chlo_hash, chlo_hash_len, out_signature, out_signature_sz);
2727
}
2828

2929
int64_t CreateIncomingDynamicStream_C(int64_t go_quic_server_session, uint32_t id, void* go_quic_simple_server_stream_go_wrapper) {

go_functions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void WriteToUDP_C(int64_t go_writer, void* peer_ip, size_t peer_ip_sz, uint16_t
1010
void WriteToUDPClient_C(int64_t go_writer, void* peer_ip, size_t peer_ip_sz, uint16_t peer_port, void* buffer, size_t buf_len);
1111
int64_t CreateGoSession_C(int64_t go_quic_dispatcher, void* quic_server_session);
1212
void DeleteGoSession_C(int64_t go_quic_dispatcher, int64_t go_quic_server_session);
13-
int GetProof_C(int64_t go_proof_source, char* server_ip, size_t server_ip_sz, char* hostname, size_t hostname_sz, char* server_config, size_t server_config_sz, int quic_version, char* chlo_hash, size_t chlo_hash_len, int ecdsa_ok, char **out_signature, size_t *out_signature_sz);
13+
int GetProof_C(int64_t go_proof_source, char* server_ip, size_t server_ip_sz, char* hostname, size_t hostname_sz, char* server_config, size_t server_config_sz, int quic_version, char* chlo_hash, size_t chlo_hash_len, char **out_signature, size_t *out_signature_sz);
1414
int64_t CreateIncomingDynamicStream_C(int64_t go_quic_server_session, uint32_t id, void* go_quic_simple_server_stream_go_wrapper);
1515
void UnregisterQuicServerStreamFromSession_C(int64_t go_stream);
1616
void UnregisterQuicClientStreamFromSession_C(int64_t go_stream);

libquic

Submodule libquic updated 604 files

proof_source.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type ProofSource struct {
2121
proofSource_c unsafe.Pointer
2222
}
2323

24-
func (ps *ProofSource) GetProof(quicVersion int, addr net.IP, hostname []byte, serverConfig []byte, chloHash []byte, ecdsaOk bool) (outSignature []byte) {
24+
func (ps *ProofSource) GetProof(quicVersion int, addr net.IP, hostname []byte, serverConfig []byte, chloHash []byte) (outSignature []byte) {
2525
var err error = nil
2626
var bufferToSign *bytes.Buffer
2727

@@ -99,17 +99,16 @@ func GetProof(proof_source_key int64,
9999
server_config_c unsafe.Pointer, server_config_sz_c C.size_t,
100100
quicVersion int,
101101
chlo_hash_c unsafe.Pointer, chlo_hash_sz C.size_t,
102-
ecdsa_ok_c C.int, out_signature_c **C.char, out_signature_sz_c *C.size_t) C.int {
102+
out_signature_c **C.char, out_signature_sz_c *C.size_t) C.int {
103103

104104
proofSource := proofSourcePtr.Get(proof_source_key)
105105

106106
serverIp := net.IP(C.GoBytes(server_ip_c, C.int(server_ip_sz)))
107107
hostname := C.GoBytes(hostname_c, C.int(hostname_sz_c))
108108
serverConfig := C.GoBytes(server_config_c, C.int(server_config_sz_c))
109109
chloHash := C.GoBytes(chlo_hash_c, C.int(chlo_hash_sz))
110-
ecdsaOk := int(ecdsa_ok_c) > 0
111110

112-
sig := proofSource.GetProof(quicVersion, serverIp, hostname, serverConfig, chloHash, ecdsaOk)
111+
sig := proofSource.GetProof(quicVersion, serverIp, hostname, serverConfig, chloHash)
113112

114113
*out_signature_c = C.CString(string(sig)) // Must free C string
115114
*out_signature_sz_c = C.size_t(len(sig))

src/adaptor.cc

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "adaptor.h"
22

3-
#include "go_quic_dispatcher.h"
3+
#include "go_quic_simple_dispatcher.h"
44
#include "go_quic_connection_helper.h"
55
#include "go_quic_server_packet_writer.h"
66
#include "go_quic_simple_server_stream.h"
@@ -11,12 +11,12 @@
1111
#include "proof_source_goquic.h"
1212
#include "go_ephemeral_key_source.h"
1313

14-
#include "net/quic/quic_connection.h"
15-
#include "net/quic/quic_clock.h"
16-
#include "net/quic/quic_time.h"
17-
#include "net/quic/quic_protocol.h"
18-
#include "net/quic/crypto/quic_random.h"
19-
#include "net/quic/crypto/crypto_server_config_protobuf.h"
14+
#include "net/quic/core/quic_connection.h"
15+
#include "net/quic/core/quic_clock.h"
16+
#include "net/quic/core/quic_time.h"
17+
#include "net/quic/core/quic_protocol.h"
18+
#include "net/quic/core/crypto/quic_random.h"
19+
#include "net/quic/core/crypto/crypto_server_config_protobuf.h"
2020
#include "net/base/ip_address.h"
2121
#include "net/base/ip_endpoint.h"
2222
#include "base/strings/string_piece.h"
@@ -163,7 +163,7 @@ void delete_crypto_config(QuicCryptoServerConfig* crypto_config) {
163163
delete crypto_config;
164164
}
165165

166-
GoQuicDispatcher* create_quic_dispatcher(
166+
GoQuicSimpleDispatcher* create_quic_dispatcher(
167167
GoPtr go_writer,
168168
GoPtr go_quic_dispatcher,
169169
GoPtr go_task_runner,
@@ -176,9 +176,12 @@ GoQuicDispatcher* create_quic_dispatcher(
176176

177177
std::unique_ptr<QuicConnectionHelperInterface> helper(new GoQuicConnectionHelper(clock, random_generator));
178178
std::unique_ptr<QuicAlarmFactory> alarm_factory(new GoQuicAlarmFactory(clock, go_task_runner));
179-
std::unique_ptr<QuicServerSessionBase::Helper> session_helper(new GoQuicSimpleServerSessionHelper(QuicRandom::GetInstance()));
179+
std::unique_ptr<QuicCryptoServerStream::Helper> session_helper(new GoQuicSimpleServerSessionHelper(QuicRandom::GetInstance()));
180+
// XXX: quic_server uses QuicSimpleCryptoServerStreamHelper,
181+
// while quic_simple_server uses QuicSimpleServerSessionHelper.
182+
// Pick one and remove the other later
180183

181-
QuicVersionVector versions(net::QuicSupportedVersions());
184+
QuicVersionManager* version_manager = new QuicVersionManager(net::AllSupportedVersions());
182185

183186
/* Initialize Configs ------------------------------------------------*/
184187

@@ -199,8 +202,9 @@ GoQuicDispatcher* create_quic_dispatcher(
199202
/* Initialize Configs Ends ----------------------------------------*/
200203

201204
// Deleted by delete_go_quic_dispatcher()
202-
GoQuicDispatcher* dispatcher =
203-
new GoQuicDispatcher(*config, crypto_config, versions, std::move(helper), std::move(session_helper), std::move(alarm_factory), go_quic_dispatcher);
205+
GoQuicSimpleDispatcher* dispatcher =
206+
new GoQuicSimpleDispatcher(*config, crypto_config, version_manager,
207+
std::move(helper), std::move(session_helper), std::move(alarm_factory), go_quic_dispatcher);
204208

205209
GoQuicServerPacketWriter* writer = new GoQuicServerPacketWriter(
206210
go_writer, dispatcher); // Deleted by scoped ptr of GoQuicDispatcher
@@ -210,11 +214,11 @@ GoQuicDispatcher* create_quic_dispatcher(
210214
return dispatcher;
211215
}
212216

213-
void delete_go_quic_dispatcher(GoQuicDispatcher* dispatcher) {
217+
void delete_go_quic_dispatcher(GoQuicSimpleDispatcher* dispatcher) {
214218
delete dispatcher;
215219
}
216220

217-
void quic_dispatcher_process_packet(GoQuicDispatcher* dispatcher,
221+
void quic_dispatcher_process_packet(GoQuicSimpleDispatcher* dispatcher,
218222
uint8_t* self_address_ip,
219223
size_t self_address_len,
220224
uint16_t self_address_port,

src/adaptor.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
#include "go_structs.h"
77

88
#ifdef __cplusplus
9-
#include "go_quic_dispatcher.h"
9+
#include "go_quic_simple_dispatcher.h"
1010
#include "go_quic_simple_server_stream.h"
1111
#include "go_quic_alarm_go_wrapper.h"
1212
#include "go_quic_server_packet_writer.h"
1313
#include "proof_source_goquic.h"
14-
#include "net/quic/quic_connection.h"
15-
#include "net/quic/quic_protocol.h"
14+
#include "net/quic/core/quic_connection.h"
15+
#include "net/quic/core/quic_protocol.h"
1616
#include "net/base/ip_endpoint.h"
1717
#include "net/spdy/spdy_header_block.h"
1818

@@ -21,7 +21,7 @@ using namespace net;
2121
extern "C" {
2222
#else
2323
typedef void QuicConnection;
24-
typedef void GoQuicDispatcher;
24+
typedef void GoQuicSimpleDispatcher;
2525
typedef void GoQuicSimpleServerStream;
2626
typedef void SpdyHeaderBlock;
2727
typedef void GoQuicAlarmGoWrapper;
@@ -48,12 +48,12 @@ QuicCryptoServerConfig* init_crypto_config(
4848

4949
void delete_crypto_config(QuicCryptoServerConfig* config);
5050

51-
GoQuicDispatcher* create_quic_dispatcher(GoPtr go_writer_,
51+
GoQuicSimpleDispatcher* create_quic_dispatcher(GoPtr go_writer_,
5252
GoPtr go_quic_dispatcher,
5353
GoPtr go_task_runner,
5454
QuicCryptoServerConfig* crypto_config);
55-
void delete_go_quic_dispatcher(GoQuicDispatcher* dispatcher);
56-
void quic_dispatcher_process_packet(GoQuicDispatcher* dispatcher,
55+
void delete_go_quic_dispatcher(GoQuicSimpleDispatcher* dispatcher);
56+
void quic_dispatcher_process_packet(GoQuicSimpleDispatcher* dispatcher,
5757
uint8_t* self_address_ip,
5858
size_t self_address_len,
5959
uint16_t self_address_port,

src/adaptor_client.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
#include "net/base/ip_address.h"
1212
#include "net/base/ip_endpoint.h"
13-
#include "net/quic/quic_connection.h"
14-
#include "net/quic/quic_clock.h"
15-
#include "net/quic/quic_protocol.h"
16-
#include "net/quic/crypto/quic_random.h"
13+
#include "net/quic/core/quic_connection.h"
14+
#include "net/quic/core/quic_clock.h"
15+
#include "net/quic/core/quic_protocol.h"
16+
#include "net/quic/core/crypto/quic_random.h"
1717
#include "base/strings/string_piece.h"
1818

1919
using namespace net;

src/adaptor_client.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "go_quic_client_session.h"
1010
#include "go_quic_spdy_client_stream.h"
1111
#include "net/base/ip_endpoint.h"
12-
#include "net/quic/quic_protocol.h"
12+
#include "net/quic/core/quic_protocol.h"
1313
using namespace net;
1414

1515
extern "C" {

src/chlo_extractor.cc

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
#include "chlo_extractor.h"
66

7-
#include "net/quic/crypto/crypto_framer.h"
8-
#include "net/quic/crypto/crypto_handshake_message.h"
9-
#include "net/quic/crypto/crypto_protocol.h"
10-
#include "net/quic/crypto/quic_decrypter.h"
11-
#include "net/quic/crypto/quic_encrypter.h"
12-
#include "net/quic/quic_framer.h"
7+
#include "net/quic/core/crypto/crypto_framer.h"
8+
#include "net/quic/core/crypto/crypto_handshake_message.h"
9+
#include "net/quic/core/crypto/crypto_protocol.h"
10+
#include "net/quic/core/crypto/quic_decrypter.h"
11+
#include "net/quic/core/crypto/quic_encrypter.h"
12+
#include "net/quic/core/quic_framer.h"
1313

1414
using base::StringPiece;
1515

@@ -148,7 +148,9 @@ void ChloFramerVisitor::OnError(CryptoFramer* framer) {}
148148

149149
void ChloFramerVisitor::OnHandshakeMessage(
150150
const CryptoHandshakeMessage& message) {
151-
delegate_->OnChlo(framer_->version(), connection_id_, message);
151+
if (delegate_ != nullptr) {
152+
delegate_->OnChlo(framer_->version(), connection_id_, message);
153+
}
152154
found_chlo_ = true;
153155
}
154156

src/chlo_extractor.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef NET_TOOLS_QUIC_CHLO_EXTRACTOR_H_
66
#define NET_TOOLS_QUIC_CHLO_EXTRACTOR_H_
77

8-
#include "net/quic/crypto/crypto_handshake_message.h"
9-
#include "net/quic/quic_protocol.h"
8+
#include "net/quic/core/crypto/crypto_handshake_message.h"
9+
#include "net/quic/core/quic_protocol.h"
1010

1111
namespace net {
1212

@@ -31,7 +31,7 @@ class ChloExtractor {
3131
const QuicVersionVector& versions,
3232
Delegate* delegate);
3333

34-
ChloExtractor(ChloExtractor&) = delete;
34+
ChloExtractor(const ChloExtractor&) = delete;
3535
ChloExtractor operator=(const ChloExtractor&) = delete;
3636
};
3737

src/go_ephemeral_key_source.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef __GO_EPHEMERAL_KEY_SOURCE__H__
22
#define __GO_EPHEMERAL_KEY_SOURCE__H__
33

4-
#include "net/quic/crypto/key_exchange.h"
5-
#include "net/quic/crypto/ephemeral_key_source.h"
6-
#include "net/quic/quic_time.h"
4+
#include "net/quic/core/crypto/key_exchange.h"
5+
#include "net/quic/core/crypto/ephemeral_key_source.h"
6+
#include "net/quic/core/quic_time.h"
77

88
namespace net {
99

src/go_proof_verifier.cc

+10
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,14 @@ QuicAsyncStatus GoProofVerifier::VerifyProof(
6868
}
6969
}
7070

71+
QuicAsyncStatus GoProofVerifier::VerifyCertChain(
72+
const std::string& hostname,
73+
const std::vector<std::string>& certs,
74+
const ProofVerifyContext* context,
75+
std::string* error_details,
76+
std::unique_ptr<ProofVerifyDetails>* details,
77+
std::unique_ptr<ProofVerifierCallback> callback) {
78+
// TODO(hodduc)
79+
}
80+
7181
} // namespace net

src/go_proof_verifier.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <string>
55

6-
#include "net/quic/crypto/proof_verifier.h"
6+
#include "net/quic/core/crypto/proof_verifier.h"
77
#include "go_structs.h"
88

99
namespace net {
@@ -37,6 +37,13 @@ class NET_EXPORT_PRIVATE GoProofVerifier : public ProofVerifier {
3737
std::unique_ptr<ProofVerifyDetails>* details,
3838
std::unique_ptr<ProofVerifierCallback> callback) override;
3939

40+
QuicAsyncStatus VerifyCertChain(
41+
const std::string& hostname,
42+
const std::vector<std::string>& certs,
43+
const ProofVerifyContext* context,
44+
std::string* error_details,
45+
std::unique_ptr<ProofVerifyDetails>* details,
46+
std::unique_ptr<ProofVerifierCallback> callback) override;
4047
private:
4148
GoPtr go_proof_verifier_;
4249

src/go_quic_alarm_factory.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#define GO_QUIC_ALARM_FACTORY_H_
33

44
#include "go_structs.h"
5-
#include "net/quic/quic_alarm.h"
6-
#include "net/quic/quic_alarm_factory.h"
7-
#include "net/quic/quic_clock.h"
5+
#include "net/quic/core/quic_alarm.h"
6+
#include "net/quic/core/quic_alarm_factory.h"
7+
#include "net/quic/core/quic_clock.h"
88

99
namespace net {
1010

src/go_quic_alarm_go_wrapper.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef __GO_QUIC_ALARM_GO_WRAPPER_H__
22
#define __GO_QUIC_ALARM_GO_WRAPPER_H__
33
#include "go_functions.h"
4-
#include "net/quic/quic_clock.h"
5-
#include "net/quic/quic_alarm.h"
4+
#include "net/quic/core/quic_clock.h"
5+
#include "net/quic/core/quic_alarm.h"
66
#include "base/logging.h"
77
#include <iostream>
88

src/go_quic_client_packet_writer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "net/base/ip_address.h"
55
#include "net/base/ip_endpoint.h"
6-
#include "net/quic/quic_packet_writer.h"
6+
#include "net/quic/core/quic_packet_writer.h"
77
#include "go_structs.h"
88

99
namespace net {

src/go_quic_client_session.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "go_quic_client_session.h"
22

3-
#include "net/quic/crypto/crypto_protocol.h"
4-
#include "net/quic/quic_server_id.h"
3+
#include "net/quic/core/crypto/crypto_protocol.h"
4+
#include "net/quic/core/quic_server_id.h"
55
#include "go_quic_spdy_client_stream.h"
66

77
using std::string;

src/go_quic_client_session.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
#include <memory>
55

6-
#include "net/quic/quic_client_session_base.h"
7-
#include "net/quic/quic_crypto_client_stream.h"
8-
#include "net/quic/quic_protocol.h"
6+
#include "net/quic/core/quic_client_session_base.h"
7+
#include "net/quic/core/quic_crypto_client_stream.h"
8+
#include "net/quic/core/quic_protocol.h"
99
#include "go_quic_spdy_client_stream.h"
1010

1111
namespace net {

src/go_quic_connection_helper.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "go_quic_connection_helper.h"
22

3-
#include "net/quic/quic_connection.h"
4-
#include "net/quic/quic_clock.h"
5-
#include "net/quic/crypto/quic_random.h"
3+
#include "net/quic/core/quic_connection.h"
4+
#include "net/quic/core/quic_clock.h"
5+
#include "net/quic/core/crypto/quic_random.h"
66

77
namespace net {
88

src/go_quic_connection_helper.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef GO_QUIC_CONNECTION_HELPER_H_
22
#define GO_QUIC_CONNECTION_HELPER_H_
3-
#include "net/quic/quic_connection.h"
4-
#include "net/quic/quic_clock.h"
5-
#include "net/quic/quic_simple_buffer_allocator.h"
3+
#include "net/quic/core/quic_connection.h"
4+
#include "net/quic/core/quic_clock.h"
5+
#include "net/quic/core/quic_simple_buffer_allocator.h"
66
#include "go_structs.h"
77

88
namespace net {

0 commit comments

Comments
 (0)