Commit f6edbb9d authored by jan.koester's avatar jan.koester
Browse files

test

parent fc2d531e
Loading
Loading
Loading
Loading
+8 −5
Changes for src/quic.cpp: 8 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -2570,12 +2570,15 @@ void quic::processInitialPacket(const uint8_t* data, size_t len, size_t pn_offse
    }
}

void quic::processHandshakePacket(const uint8_t* data, size_t len) {
void quic::processHandshakePacket(const uint8_t* data, size_t len, size_t pn_offset_hint) {
    QUIC_DBG("processHandshakePacket: len=%zu", len);

    // Parse the header to get the actual packet length (for coalesced packets)
    if (len < 20) return;

    // See processInitialPacket()'s identical comment on packet_len/hint.
    size_t packet_len = len;

    if (pn_offset_hint == SIZE_MAX || pn_offset_hint > len) {
        size_t offset = 5;  // After first byte + version
        if (offset >= len) return;
        uint8_t dcid_len = data[offset++];
@@ -2595,8 +2598,8 @@ void quic::processHandshakePacket(const uint8_t* data, size_t len) {
        if (payload_len > len - offset) return;

        // Total packet length = header length (offset) + payload length
    size_t packet_len = offset + payload_len;
    
        packet_len = offset + payload_len;
    }

    // Decrypt and process Handshake packet
    std::vector<uint8_t>& header = _recv_header_scratch;
@@ -2604,7 +2607,7 @@ void quic::processHandshakePacket(const uint8_t* data, size_t len) {
    uint64_t pn;

    // Handshake packets use the negotiated cipher - use actual packet_len
    if (!unprotectPacket(data, packet_len, header, payload, pn, EncryptionLevel::Handshake, _hs_keys.recv)) {
    if (!unprotectPacket(data, packet_len, header, payload, pn, EncryptionLevel::Handshake, _hs_keys.recv, pn_offset_hint)) {
        QUIC_DBG("processHandshakePacket: decrypt FAILED");
        return;
    }