Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 098f27f9ef8be2a418f76896ee3c824e8709fcf7 authored by Matt Caswell on 17 October 2023, 13:55:48 UTC, committed by Tomas Mraz on 19 October 2023, 09:54:44 UTC
Ignore ping deadline when calculating tick deadline if we can't send
If the CC TX allowance is zero then we cannot send a PING frame at the
moment, so do not take into account the ping deadline when calculating the
tick deadline in that case.

This avoids the hang found by the fuzzer mentioned in
https://github.com/openssl/openssl/pull/22368#issuecomment-1765131727

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22410)
1 parent 56e3032
  • Files
  • Changes
  • 55eafe5
  • /
  • test
  • /
  • cc_dummy.c
Raw File
Cook and download a directory from the Software Heritage Vault

You have requested the cooking of the directory with identifier None into a standard tar.gz archive.

Are you sure you want to continue ?

Download a directory from the Software Heritage Vault

You have requested the download of the directory with identifier None as a standard tar.gz archive.

Are you sure you want to continue ?

Cook and download a revision from the Software Heritage Vault

You have requested the cooking of the history heading to revision with identifier swh:1:rev:098f27f9ef8be2a418f76896ee3c824e8709fcf7 into a bare git archive.

Are you sure you want to continue ?

Download a revision from the Software Heritage Vault

You have requested the download of the history heading to revision with identifier swh:1:rev:098f27f9ef8be2a418f76896ee3c824e8709fcf7 as a bare git archive.

Are you sure you want to continue ?

Invalid Email !

The provided email is not well-formed.

Download link has expired

The requested archive is no longer available for download from the Software Heritage Vault.

Do you want to cook it again ?

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • content
revision badge
swh:1:rev:098f27f9ef8be2a418f76896ee3c824e8709fcf7
content badge Iframe embedding
swh:1:cnt:4b2bc041998eddf622fa37fae1f43276a670aea9
cc_dummy.c
/*
 * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include "internal/quic_cc.h"
#include "internal/quic_types.h"

typedef struct ossl_cc_dummy_st {
    size_t max_dgram_len;
    size_t *p_diag_max_dgram_len;
} OSSL_CC_DUMMY;

static void dummy_update_diag(OSSL_CC_DUMMY *d);

static OSSL_CC_DATA *dummy_new(OSSL_TIME (*now_cb)(void *arg),
                               void *now_cb_arg)
{
    OSSL_CC_DUMMY *d = OPENSSL_zalloc(sizeof(*d));

    if (d == NULL)
        return NULL;

    d->max_dgram_len = QUIC_MIN_INITIAL_DGRAM_LEN;
    return (OSSL_CC_DATA *)d;
}

static void dummy_free(OSSL_CC_DATA *cc)
{
    OPENSSL_free(cc);
}

static void dummy_reset(OSSL_CC_DATA *cc)
{

}

static int dummy_set_input_params(OSSL_CC_DATA *cc, const OSSL_PARAM *params)
{
    OSSL_CC_DUMMY *d = (OSSL_CC_DUMMY *)cc;
    const OSSL_PARAM *p;
    size_t value;

    p = OSSL_PARAM_locate_const(params, OSSL_CC_OPTION_MAX_DGRAM_PAYLOAD_LEN);
    if (p != NULL) {
        if (!OSSL_PARAM_get_size_t(p, &value))
            return 0;
        if (value < QUIC_MIN_INITIAL_DGRAM_LEN)
            return 0;

        d->max_dgram_len = value;
        dummy_update_diag(d);
    }

    return 1;
}

static int dummy_bind_diagnostic(OSSL_CC_DATA *cc, OSSL_PARAM *params)
{
    OSSL_CC_DUMMY *d = (OSSL_CC_DUMMY *)cc;
    const OSSL_PARAM *p;

    p = OSSL_PARAM_locate_const(params, OSSL_CC_OPTION_MAX_DGRAM_PAYLOAD_LEN);
    if (p != NULL) {
        if (p->data_type != OSSL_PARAM_UNSIGNED_INTEGER
            || p->data_size != sizeof(size_t))
            return 0;

        d->p_diag_max_dgram_len = p->data;
    }

    dummy_update_diag(d);
    return 1;
}

static int dummy_unbind_diagnostic(OSSL_CC_DATA *cc, OSSL_PARAM *params)
{
    OSSL_CC_DUMMY *d = (OSSL_CC_DUMMY *)cc;

    if (OSSL_PARAM_locate_const(params, OSSL_CC_OPTION_MAX_DGRAM_PAYLOAD_LEN)
        != NULL)
        d->p_diag_max_dgram_len = NULL;

    return 1;
}

static void dummy_update_diag(OSSL_CC_DUMMY *d)
{
    if (d->p_diag_max_dgram_len != NULL)
        *d->p_diag_max_dgram_len = d->max_dgram_len;
}

static uint64_t dummy_get_tx_allowance(OSSL_CC_DATA *cc)
{
    return SIZE_MAX;
}

static OSSL_TIME dummy_get_wakeup_deadline(OSSL_CC_DATA *cc)
{
    return ossl_time_infinite();
}

static int dummy_on_data_sent(OSSL_CC_DATA *cc,
                              uint64_t num_bytes)
{
    return 1;
}

static int dummy_on_data_acked(OSSL_CC_DATA *cc,
                               const OSSL_CC_ACK_INFO *info)
{
    return 1;
}

static int dummy_on_data_lost(OSSL_CC_DATA *cc,
                              const OSSL_CC_LOSS_INFO *info)
{
    return 1;
}

static int dummy_on_data_lost_finished(OSSL_CC_DATA *cc,
                                       uint32_t flags)
{
    return 1;
}

static int dummy_on_data_invalidated(OSSL_CC_DATA *cc,
                                     uint64_t num_bytes)
{
    return 1;
}

const OSSL_CC_METHOD ossl_cc_dummy_method = {
    dummy_new,
    dummy_free,
    dummy_reset,
    dummy_set_input_params,
    dummy_bind_diagnostic,
    dummy_unbind_diagnostic,
    dummy_get_tx_allowance,
    dummy_get_wakeup_deadline,
    dummy_on_data_sent,
    dummy_on_data_acked,
    dummy_on_data_lost,
    dummy_on_data_lost_finished,
    dummy_on_data_invalidated,
};
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top