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 48e7b18efcd77890f36272b46a4603d15a1ac221 authored by Neil Horman on 26 July 2024, 15:01:05 UTC, committed by Neil Horman on 09 August 2024, 12:28:38 UTC
limit bignums to 128 bytes
Keep us from spinning forever doing huge amounts of math in the fuzzer

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25013)

(cherry picked from commit f0768376e1639d12a328745ef69c90d584138074)
1 parent 67c6330
  • Files
  • Changes
  • 6cdbfeb
  • /
  • include
  • /
  • internal
  • /
  • event_queue.h
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:48e7b18efcd77890f36272b46a4603d15a1ac221 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:48e7b18efcd77890f36272b46a4603d15a1ac221 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:48e7b18efcd77890f36272b46a4603d15a1ac221
content badge Iframe embedding
swh:1:cnt:bda1ee6ad46d9048554550ee91e08de55423c29b
event_queue.h
/*
 * 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
 */

#ifndef OSSL_INTERNAL_EVENT_QUEUE_H
# define OSSL_INTERNAL_EVENT_QUEUE_H
# pragma once

# include "internal/priority_queue.h"
# include "internal/time.h"

/*
 * Opaque type holding an event.
 */
typedef struct ossl_event_st OSSL_EVENT;

DEFINE_PRIORITY_QUEUE_OF(OSSL_EVENT);

/*
 * Public type representing an event queue, the underlying structure being
 * opaque.
 */
typedef struct ossl_event_queue_st OSSL_EVENT_QUEUE;

/*
 * Public type representing a event queue entry.
 * It is (internally) public so that it can be embedded into other structures,
 * it should otherwise be treated as opaque.
 */
struct ossl_event_st {
    uint32_t type;              /* What type of event this is               */
    uint32_t priority;          /* What priority this event has             */
    OSSL_TIME when;             /* When the event is scheduled to happen    */
    void *ctx;                  /* User argument passed to call backs       */
    void *payload;              /* Event specific data of unknown kind      */
    size_t payload_size;        /* Length (in bytes) of event specific data */

    /* These fields are for internal use only */
    PRIORITY_QUEUE_OF(OSSL_EVENT) *queue;    /* Queue containing this event */
    size_t ref;                 /* ID for this event                        */
    unsigned int flag_dynamic : 1;  /* Malloced or not?                     */
};

/*
 * Utility function to populate an event structure and add it to the queue
 */
int ossl_event_queue_add(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event,
                         uint32_t type, uint32_t priority,
                         OSSL_TIME when, void *ctx,
                         void *payload, size_t payload_size);

/*
 * Utility functions to extract event fields
 */
static ossl_unused ossl_inline
uint32_t ossl_event_get_type(const OSSL_EVENT *event)
{
    return event->type;
}

static ossl_unused ossl_inline
uint32_t ossl_event_get_priority(const OSSL_EVENT *event)
{
    return event->priority;
}

static ossl_unused ossl_inline
OSSL_TIME ossl_event_get_when(const OSSL_EVENT *event)
{
    return event->when;
}

static ossl_unused ossl_inline
void *ossl_event_get0_ctx(const OSSL_EVENT *event)
{
    return event->ctx;
}

static ossl_unused ossl_inline
void *ossl_event_get0_payload(const OSSL_EVENT *event, size_t *length)
{
    if (length != NULL)
        *length = event->payload_size;
    return event->payload;
}

/*
 * Create and free a queue.
 */
OSSL_EVENT_QUEUE *ossl_event_queue_new(void);
void ossl_event_queue_free(OSSL_EVENT_QUEUE *queue);

/*
 * Schedule a new event into an event queue.
 *
 * The event parameters are taken from the function arguments.
 *
 * The function returns NULL on failure and the added event on success.
 */
OSSL_EVENT *ossl_event_queue_add_new(OSSL_EVENT_QUEUE *queue, 
                                     uint32_t type, uint32_t priority,
                                     OSSL_TIME when, void *ctx,
                                     void *payload, size_t payload_size)
;

/*
 * Schedule an event into an event queue.
 *
 * The event parameters are taken from the function arguments.
 *
 * The function returns 0 on failure and 1 on success.
 */
int ossl_event_queue_add(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event,
                         uint32_t type, uint32_t priority,
                         OSSL_TIME when, void *ctx,
                         void *payload, size_t payload_size);

/*
 * Delete an event from the queue.
 * This will cause the early deletion function to be called if it is non-NULL.
 * A pointer to the event structure is returned.
 */
int ossl_event_queue_remove(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event);

/*
 * Free a dynamic event.
 * Is a NOP for a static event.
 */
void ossl_event_free(OSSL_EVENT *event);

/*
 * Return the time until the next event for the specified event, if the event's
 * time is past, zero is returned.  Once activated, the event reference becomes
 * invalid and this function becomes undefined.
 */
OSSL_TIME ossl_event_time_until(const OSSL_EVENT *event);

/*
 * Return the time until the next event in the queue.
 * If the next event is in the past, zero is returned.
 */
OSSL_TIME ossl_event_queue_time_until_next(const OSSL_EVENT_QUEUE *queue);

/*
 * Postpone an event to trigger at the specified time.
 * If the event has triggered, this function's behaviour is undefined.
 */
int ossl_event_queue_postpone_until(OSSL_EVENT_QUEUE *queue,
                                    OSSL_EVENT *event,
                                    OSSL_TIME when);

/*
 * Return the next event to process.
 */
int ossl_event_queue_get1_next_event(OSSL_EVENT_QUEUE *queue,
                                     OSSL_EVENT **event);

#endif
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