lsquic_crand.h revision 06b2a236
1/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_crand.h -- cached random bytes
4 *
5 * The idea is to reduce number of calls to RAND_bytes()
6 */
7
8#ifndef LSQUIC_CRAND_H
9#define LSQUIC_CRAND_H 1
10
11struct crand
12{
13    unsigned        nybble_off;     /* Increments 2 per byte */
14    uint8_t         rand_buf[256];  /* Must be power of two */
15};
16
17uint8_t
18lsquic_crand_get_nybble (struct crand *);
19
20uint8_t
21lsquic_crand_get_byte (struct crand *);
22
23#endif
24