OpenVPN authenticates the opcode/peer-id header as AEAD additional data
only for P_DATA_V2. For P_DATA_V1 the additional data is the packet ID
alone. We included the opcode for both, so every data packet exchanged
with a server that does not push peer-id (e.g. SoftEther) failed
authentication and was silently dropped after a successful handshake.
Fixed two Hysteria v1 UDP regressions introduced in 48c1b1cdb2 :
- Mark UDP session requests correctly with UDP: true.
- Initialize the packet buffer with zero length and preallocated capacity to prevent leading zero bytes.
Regenerate the random seed when FakeRandom ends in a TLS downgrade canary or the HelloRetryRequest suffix, as required by JLS v3. Use the configured random source for both client and server hellos.
Decide whether fallback is safe based on bytes actually written instead of JLS authentication status. This allows authenticated preflight failures, including HRR and TLS configuration mismatches, to relay the untouched ClientHello to the camouflage target.
Keep rejecting fallback after a partial or complete server flight, update jls-tls for pre-write alert suppression, and add coverage for both sides of the write boundary.
JLS v3 does not permit HelloRetryRequest during JLS authentication. Keep the ClientHello random unchanged across HRR and make clients continue as ordinary TLS with certificate verification.
When an authenticated ClientHello would require HRR, fail before writing handshake data and wrap ErrJLSAuthFailed. This allows stream and QUIC callers to forward the untouched handshake to the camouflage fallback instead of accepting a non-standard JLS exchange.
JLS authenticates the serialized ServerHello with only the random field zeroed. The previous marshalForJLS implementation reordered extensions to match rustls-jls's internal struct order, even when that order differed from the bytes sent on the wire.
That canonical order is not defined by TLS or the JLS specification and couples this package to a rustls-jls implementation detail. Use the normal marshal output when sending and the original wire bytes when receiving, preserving extension order and leaving the TLS transcript untouched.
This intentionally removes compatibility with rustls-jls clients that re-encode ServerHello extensions before JLS verification.