facebook / mvfst

An implementation of the QUIC transport protocol.
MIT License
1.5k stars 242 forks source link

about encrypt/decrypt path in mvfst #253

Closed wtao0221 closed 2 years ago

wtao0221 commented 2 years ago

Hi,

I am going through mvfst's source code. I am wondering where the encrypt/decrypt happens in the code.

(Please correct me if I am wrong.) So basically in my understanding, there are 2 parts, one is that application writes data to the stream buffer, bound to one QUIC connection, the other one is that QUIC writes the buffer to the FD (i.e., network). The receive path works in a similar way.

Does the encrypt/decrypt happen in the first part or the second? Or is my understanding wrong?

mjoras commented 2 years ago

QUIC packets are encrypted individually, so it has to be done shortly before writing to the network by necessity.

mjoras commented 2 years ago

E.g. https://github.com/facebookincubator/mvfst/blob/main/quic/api/QuicTransportFunctions.cpp#L374

wtao0221 commented 2 years ago

Thanks. BTW, where is the API on choosing cipher suite?