lfsr.h File Reference

#include <isc/lang.h>
#include <isc/types.h>

Go to the source code of this file.

Data Structures

struct  isc_lfsr
 The members of this structure can be used by the application, but care needs to be taken to not change state once the lfsr is in operation. More...

Defines

#define ISC_LFSR_H   1

Typedefs

typedef struct isc_lfsr isc_lfsr_t
typedef void(* isc_lfsrreseed_t )(isc_lfsr_t *, void *)
 This function is called when reseeding is needed. It is allowed to modify any state in the LFSR in any way it sees fit OTHER THAN "bits".

Functions

ISC_LANG_BEGINDECLS 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.
void isc_lfsr_generate (isc_lfsr_t *lfsr, void *data, unsigned int count)
 Returns "count" bytes of data from the LFSR.
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.h.


Define Documentation

#define ISC_LFSR_H   1

Definition at line 21 of file lfsr.h.


Typedef Documentation

typedef struct isc_lfsr isc_lfsr_t

Definition at line 28 of file lfsr.h.

typedef void(* isc_lfsrreseed_t)(isc_lfsr_t *, void *)

This function is called when reseeding is needed. It is allowed to modify any state in the LFSR in any way it sees fit OTHER THAN "bits".

It MUST set "count" to a new value or the lfsr will never reseed again.

Also, a reseed will never occur in the middle of an extraction. This is purely an optimization, and is probably what one would want.

Definition at line 39 of file lfsr.h.


Function Documentation

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

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.

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:15 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha