#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <isc/assertions.h>
#include <isc/lfsr.h>
#include <isc/util.h>
Go to the source code of this file.
Defines | |
#define | VALID_LFSR(x) (x != NULL) |
Functions | |
void | isc_lfsr_init (isc_lfsr_t *lfsr, isc_uint32_t state, unsigned int bits, isc_uint32_t tap, unsigned int count, isc_lfsrreseed_t reseed, void *arg) |
Initialize an LFSR. | |
static isc_uint32_t | lfsr_generate (isc_lfsr_t *lfsr) |
void | isc_lfsr_generate (isc_lfsr_t *lfsr, void *data, unsigned int count) |
Returns "count" bytes of data from the LFSR. | |
static isc_uint32_t | lfsr_skipgenerate (isc_lfsr_t *lfsr, unsigned int skip) |
void | isc_lfsr_skip (isc_lfsr_t *lfsr, unsigned int skip) |
Skip "skip" states. | |
isc_uint32_t | isc_lfsr_generate32 (isc_lfsr_t *lfsr1, isc_lfsr_t *lfsr2) |
Given two LFSRs, use the current state from each to skip entries in the other. The next states are then xor'd together and returned. |
Definition in file lfsr.c.
#define VALID_LFSR | ( | x | ) | (x != NULL) |
Definition at line 31 of file lfsr.c.
Referenced by isc_lfsr_generate(), isc_lfsr_generate32(), isc_lfsr_init(), and isc_lfsr_skip().
void isc_lfsr_init | ( | isc_lfsr_t * | lfsr, | |
isc_uint32_t | state, | |||
unsigned int | bits, | |||
isc_uint32_t | tap, | |||
unsigned int | count, | |||
isc_lfsrreseed_t | reseed, | |||
void * | arg | |||
) |
Initialize an LFSR.
Note:
Definition at line 34 of file lfsr.c.
References isc_lfsr::arg, isc_lfsr::bits, isc_lfsr::count, REQUIRE, reseed(), isc_lfsr::reseed, isc_lfsr::state, isc_lfsr::tap, and VALID_LFSR.
static isc_uint32_t lfsr_generate | ( | isc_lfsr_t * | lfsr | ) | [inline, static] |
Return the next state of the lfsr.
Definition at line 59 of file lfsr.c.
References isc_lfsr::arg, isc_lfsr::bits, isc_lfsr::reseed, return(), isc_lfsr::state, and isc_lfsr::tap.
Referenced by isc_lfsr_generate(), isc_lfsr_skip(), and lfsr_skipgenerate().
void isc_lfsr_generate | ( | isc_lfsr_t * | lfsr, | |
void * | data, | |||
unsigned int | count | |||
) |
Returns "count" bytes of data from the LFSR.
Requires:
Definition at line 86 of file lfsr.c.
References isc_lfsr::arg, isc_lfsr::count, lfsr_generate(), REQUIRE, isc_lfsr::reseed, and VALID_LFSR.
static isc_uint32_t lfsr_skipgenerate | ( | isc_lfsr_t * | lfsr, | |
unsigned int | skip | |||
) | [inline, static] |
Definition at line 118 of file lfsr.c.
References lfsr_generate(), and isc_lfsr::state.
Referenced by isc_lfsr_generate32().
void isc_lfsr_skip | ( | isc_lfsr_t * | lfsr, | |
unsigned int | skip | |||
) |
Skip "skip" states.
Requires:
Definition at line 132 of file lfsr.c.
References lfsr_generate(), REQUIRE, and VALID_LFSR.
isc_uint32_t isc_lfsr_generate32 | ( | isc_lfsr_t * | lfsr1, | |
isc_lfsr_t * | lfsr2 | |||
) |
Given two LFSRs, use the current state from each to skip entries in the other. The next states are then xor'd together and returned.
WARNING:
Definition at line 145 of file lfsr.c.
References lfsr_skipgenerate(), REQUIRE, isc_lfsr::state, and VALID_LFSR.