Commit Graph

208 Commits

Author SHA1 Message Date
Lucas Clemente
3300b6cef0 Store ackframe along with swf in the packet packer 2017-06-21 11:16:28 +02:00
Lucas Clemente
efc9ec5051 Add packer.SetLeastUnacked and remove the parameter from the Pack* functions 2017-06-21 11:16:28 +02:00
Lucas Clemente
ff8c75a22e Send ACKs and SWFs even if we are congestion limited
Fixes #576.
2017-06-20 23:41:36 +02:00
Lucas Clemente
6157eeffdb Factor crypto frame packing into a separate function 2017-06-20 10:38:55 +02:00
Lucas Clemente
8b56b6c169 Separate non-fw retransmissions from the main code path 2017-06-20 10:25:45 +02:00
Lucas Clemente
f1c2163f14 Remove non-retransmittable logic from packer, this is now in ackhandler 2017-06-20 10:25:45 +02:00
Lucas Clemente
e50a03148d Separate the CONN_CLOSE packing path from the normal one 2017-06-20 10:25:45 +02:00
Lucas Clemente
dc3126ba90 Move packet writing and sealing to a new function 2017-06-20 10:25:45 +02:00
Lucas Clemente
cbb640b093 Don't pass the stop waiting frame to the packer as a parameter 2017-06-20 10:25:45 +02:00
Lucas Clemente
495399ede6 Remove PackPacket's control frames parameter
With this change it would theoretically be possible for outdated control frames to be sent, but this is quite unlikely in practice.
2017-06-20 10:25:45 +02:00
Lucas Clemente
80f87e2fab Fix formatting 2017-06-10 15:33:07 +02:00
Lucas Clemente
e43b91f633 Fix encryption of stream data
This commit splits up handling of the crypto stream and the other streams in the framer, crypto setup, and the packer.

- Crypto stream data is handled separately and should never be sent unencrypted or FW-secure. Fixes #544.
- Non-crypto stream data is only sent with FW encryption on the server and only with non-FW or FW encryption on the client. Fixes #611.

The crypto stream is current excluded from flow control (#657), but that shouldn't be an issue in practice for now.
2017-06-09 19:12:10 +02:00
Lucas Clemente
4ea2ccd526 Improve STOP_WAITING detection in packet packer 2017-06-09 19:12:10 +02:00
Lucas Clemente
86b329d7da Factor public header creation into a new function 2017-06-09 19:12:09 +02:00
Marten Seemann
2903f9b238 return a lambda to for sealing a packet in the CryptoSetup 2017-03-22 16:52:00 +07:00
Marten Seemann
8c5e7818a0 retransmit the diversification nonce in the packet carrying the SHLO
The packet containing the SHLO is the only packet that is sent with
initial encryption. If it is lost, we need to make sure that the
diversification nonce is included in the PublicHeader, otherwise the
client will not be able to derive the keys for the forward-secure
encryption.
2017-03-01 15:11:01 +07:00
Marten Seemann
5e91f139ce add a method to pack a retransmission in the packetPacker 2017-03-01 14:11:21 +07:00
Marten Seemann
9e147714ac pack smaller packets as long as the encryption is not forward secure 2017-03-01 14:01:52 +07:00
Marten Seemann
d4b2b66273 change composeNextPacket function signature in packetPacker 2017-03-01 14:01:52 +07:00
Marten Seemann
88561ff8c7 prevent sending of unencrypted stream data on data streams
fixes #446
2017-02-25 10:13:34 +07:00
Marten Seemann
1bd1a9e0e5 store the encryption level that a packet was sent with 2017-02-25 08:27:15 +07:00
Marten Seemann
d1c9d8e93d only send the client version number until the handshake is complete
fixes #426
2017-02-20 11:52:00 +07:00
Marten Seemann
6cb48aad71 send correct version number in PublicHeader 2017-01-14 18:52:25 +07:00
Marten Seemann
fece562b22 compose PublicHeader depending on perspective set in packetPacker 2017-01-14 18:52:12 +07:00
Marten Seemann
756a421065 calculate PublicHeader length for packets with VersionFlag and ResetFlag 2017-01-14 18:45:16 +07:00
Marten Seemann
6c0a885a0e pass perspective to packetPacker 2017-01-14 18:45:16 +07:00
Marten Seemann
2b7c67d297 create handshake.CryptoSetup interface 2017-01-14 18:45:14 +07:00
Marten Seemann
cc2d966d84 write PublicHeaders for packets sent as a client
fixes #346
2017-01-14 18:45:13 +07:00
Marten Seemann
c6c1233e98 simplify the packPacket method in the packetPacker 2017-01-11 00:13:52 +07:00
Marten Seemann
edf6ee3dfc implement a sophisticated ack algorithm
fixes #354
2017-01-09 15:01:44 +07:00
Marten Seemann
ebc053dbe0 create interface for the ConnectionParametersManager 2016-12-08 18:39:14 +07:00
Marten Seemann
0d6356d9d8 rename PublicHeader.WritePublicHeader to PublicHeader.Write 2016-11-06 22:34:16 +07:00
Lucas Clemente
2970ee3ac5 fix public header write error handling 2016-09-16 21:01:00 +02:00
Lucas Clemente
809ea02511 use packetPacker.controlFrames as stack, decreasing allocs 2016-09-07 15:20:26 +02:00
Lucas Clemente
340fb52848 cleanup some v33 leftovers 2016-09-01 20:26:32 +02:00
Lucas Clemente
6bb89d4902 remove entropy from packet packer 2016-09-01 20:26:32 +02:00
Lucas Clemente
d76d86a7e1 fix detection of only-ack packets
ref #315
2016-09-01 20:24:19 +02:00
Marten Seemann
bca012cbde handle Frame.Write errors in packet packer 2016-08-17 18:10:23 +07:00
Marten Seemann
88e1e50efe only increase packet number when sending a packet in PacketPacker
fixes #288
2016-08-16 17:07:03 +07:00
Marten Seemann
78fab5c264 use PacketNumberGenerator in PacketPacker 2016-08-11 11:03:45 +02:00
Lucas Clemente
805c21cb77 use LeastUnacked in packet number derivation
fixes #271
2016-08-10 13:32:36 +02:00
Marten Seemann
8b845fada9 make PublicHeader public 2016-08-04 15:45:11 +07:00
Lucas Clemente
950e59fa3d add a sync.Pool of byte buffers with maximum packet size as cap
ref #217
2016-07-26 15:36:28 +02:00
Lucas Clemente
90aa8cfa95 make packetPacker use in-place encryption
ref #217
2016-07-26 15:16:23 +02:00
Lucas Clemente
d5255a4075 update AEADs to allow in-place encryption and decryption
ref #217
2016-07-26 15:13:15 +02:00
Lucas Clemente
44acb8ca82 remove session.maybeSendPacket, restrict small frame detection to ACKs
ref #217
2016-07-26 13:44:07 +02:00
Lucas Clemente
136a1c574c remove call to streamFramer.HasData in packet packer
ref #217
2016-07-26 13:42:31 +02:00
Lucas Clemente
7adf760fa4 change streamFramer to pop as many stream frames as possible at once
ref #217
2016-07-26 13:42:30 +02:00
Lucas Clemente
58ec83c4ba remove unneeded function call to framer.HasData 2016-07-12 14:42:53 +02:00
Lucas Clemente
f04d14ac3e use flow controller for window update handling, remove windowUpdateMgr 2016-07-11 14:54:32 +02:00