uint32_t enc_level;
int old_have_processed_any_pkt = ch->have_processed_any_pkt;
OSSL_QTX_IOVEC iovec;
- uint32_t *supported_ver;
- size_t remaining_len;
+ PACKET vpkt;
+ unsigned long supported_ver;
assert(ch->qrx_pkt != NULL);
* needs to be traversed so that we can find a matching
* version
*/
- supported_ver = (uint32_t *)ch->qrx_pkt->hdr->data;
- remaining_len = ch->qrx_pkt->hdr->len;
- while (remaining_len > 0) {
+ if (!PACKET_buf_init(&vpkt, ch->qrx_pkt->hdr->data,
+ ch->qrx_pkt->hdr->len))
+ return;
+
+ while (PACKET_remaining(&vpkt) > 0) {
/*
* We only support quic version 1 at the moment, so
* look to see if thats offered
*/
- if (*supported_ver == QUIC_VERSION_1) {
+ if (!PACKET_get_net_4(&vpkt, &supported_ver))
+ return;
+
+ supported_ver = ntohl(supported_ver);
+ if (supported_ver == QUIC_VERSION_1) {
/*
* If the server supports version 1, set it as
* the packetisers version
0, "handling ver negotiation packet");
return;
}
- /* move to the next supported ver */
- supported_ver++;
- remaining_len -= sizeof(uint32_t);
}
/*
WPACKET wpkt;
uint32_t supported_versions[1];
size_t written;
+ size_t i;
memset(&hdr, 0, sizeof(QUIC_PKT_HDR));
/*
/*
* Add the array of supported versions to the end of the packet
*/
- if (!WPACKET_memcpy(&wpkt, supported_versions, sizeof(supported_versions)))
- return;
+ for (i = 0; i < OSSL_NELEM(supported_versions); i++) {
+ if (!WPACKET_put_bytes_u32(&wpkt, htonl(supported_versions[i])))
+ return;
+ }
if (!WPACKET_get_total_written(&wpkt, &msg[0].data_len))
return;
/*
* If we don't get a supported version, respond with a ver
* negotiation packet, and discard
- * TODO: Rate limit the reception of these
+ * TODO(QUIC SERVER): Rate limit the reception of these
*/
port_send_version_negotiation(port, &e->peer, &hdr);
goto undesirable;