lfsr.c File Reference

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


Detailed Description

Definition in file lfsr.c.


Define Documentation

#define VALID_LFSR (  )     (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().


Function Documentation

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:

Requires:

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:

Notes:

Requires:

Definition at line 145 of file lfsr.c.

References lfsr_skipgenerate(), REQUIRE, isc_lfsr::state, and VALID_LFSR.


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha