Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/bind9/isc
File: lfsr.h
/*
[0] Fix | Delete
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
[1] Fix | Delete
*
[2] Fix | Delete
* This Source Code Form is subject to the terms of the Mozilla Public
[3] Fix | Delete
* License, v. 2.0. If a copy of the MPL was not distributed with this
[4] Fix | Delete
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
[5] Fix | Delete
*
[6] Fix | Delete
* See the COPYRIGHT file distributed with this work for additional
[7] Fix | Delete
* information regarding copyright ownership.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
[11] Fix | Delete
#ifndef ISC_LFSR_H
[12] Fix | Delete
#define ISC_LFSR_H 1
[13] Fix | Delete
[14] Fix | Delete
/*! \file isc/lfsr.h */
[15] Fix | Delete
[16] Fix | Delete
#include <inttypes.h>
[17] Fix | Delete
[18] Fix | Delete
#include <isc/lang.h>
[19] Fix | Delete
#include <isc/types.h>
[20] Fix | Delete
[21] Fix | Delete
typedef struct isc_lfsr isc_lfsr_t;
[22] Fix | Delete
[23] Fix | Delete
/*%
[24] Fix | Delete
* This function is called when reseeding is needed. It is allowed to
[25] Fix | Delete
* modify any state in the LFSR in any way it sees fit OTHER THAN "bits".
[26] Fix | Delete
*
[27] Fix | Delete
* It MUST set "count" to a new value or the lfsr will never reseed again.
[28] Fix | Delete
*
[29] Fix | Delete
* Also, a reseed will never occur in the middle of an extraction. This
[30] Fix | Delete
* is purely an optimization, and is probably what one would want.
[31] Fix | Delete
*/
[32] Fix | Delete
typedef void (*isc_lfsrreseed_t)(isc_lfsr_t *, void *);
[33] Fix | Delete
[34] Fix | Delete
/*%
[35] Fix | Delete
* The members of this structure can be used by the application, but care
[36] Fix | Delete
* needs to be taken to not change state once the lfsr is in operation.
[37] Fix | Delete
*/
[38] Fix | Delete
struct isc_lfsr {
[39] Fix | Delete
uint32_t state; /*%< previous state */
[40] Fix | Delete
unsigned int bits; /*%< length */
[41] Fix | Delete
uint32_t tap; /*%< bit taps */
[42] Fix | Delete
unsigned int count; /*%< reseed count (in BITS!) */
[43] Fix | Delete
isc_lfsrreseed_t reseed; /*%< reseed function */
[44] Fix | Delete
void *arg; /*%< reseed function argument */
[45] Fix | Delete
};
[46] Fix | Delete
[47] Fix | Delete
ISC_LANG_BEGINDECLS
[48] Fix | Delete
[49] Fix | Delete
[50] Fix | Delete
void
[51] Fix | Delete
isc_lfsr_init(isc_lfsr_t *lfsr, uint32_t state, unsigned int bits,
[52] Fix | Delete
uint32_t tap, unsigned int count,
[53] Fix | Delete
isc_lfsrreseed_t reseed, void *arg);
[54] Fix | Delete
/*%<
[55] Fix | Delete
* Initialize an LFSR.
[56] Fix | Delete
*
[57] Fix | Delete
* Note:
[58] Fix | Delete
*
[59] Fix | Delete
*\li Putting untrusted values into this function will cause the LFSR to
[60] Fix | Delete
* generate (perhaps) non-maximal length sequences.
[61] Fix | Delete
*
[62] Fix | Delete
* Requires:
[63] Fix | Delete
*
[64] Fix | Delete
*\li lfsr != NULL
[65] Fix | Delete
*
[66] Fix | Delete
*\li 8 <= bits <= 32
[67] Fix | Delete
*
[68] Fix | Delete
*\li tap != 0
[69] Fix | Delete
*/
[70] Fix | Delete
[71] Fix | Delete
void
[72] Fix | Delete
isc_lfsr_generate(isc_lfsr_t *lfsr, void *data, unsigned int count);
[73] Fix | Delete
/*%<
[74] Fix | Delete
* Returns "count" bytes of data from the LFSR.
[75] Fix | Delete
*
[76] Fix | Delete
* Requires:
[77] Fix | Delete
*
[78] Fix | Delete
*\li lfsr be valid.
[79] Fix | Delete
*
[80] Fix | Delete
*\li data != NULL.
[81] Fix | Delete
*
[82] Fix | Delete
*\li count > 0.
[83] Fix | Delete
*/
[84] Fix | Delete
[85] Fix | Delete
void
[86] Fix | Delete
isc_lfsr_skip(isc_lfsr_t *lfsr, unsigned int skip);
[87] Fix | Delete
/*%<
[88] Fix | Delete
* Skip "skip" states.
[89] Fix | Delete
*
[90] Fix | Delete
* Requires:
[91] Fix | Delete
*
[92] Fix | Delete
*\li lfsr be valid.
[93] Fix | Delete
*/
[94] Fix | Delete
[95] Fix | Delete
uint32_t
[96] Fix | Delete
isc_lfsr_generate32(isc_lfsr_t *lfsr1, isc_lfsr_t *lfsr2);
[97] Fix | Delete
/*%<
[98] Fix | Delete
* Given two LFSRs, use the current state from each to skip entries in the
[99] Fix | Delete
* other. The next states are then xor'd together and returned.
[100] Fix | Delete
*
[101] Fix | Delete
* WARNING:
[102] Fix | Delete
*
[103] Fix | Delete
*\li This function is used only for very, very low security data, such
[104] Fix | Delete
* as DNS message IDs where it is desired to have an unpredictable
[105] Fix | Delete
* stream of bytes that are harder to predict than a simple flooding
[106] Fix | Delete
* attack.
[107] Fix | Delete
*
[108] Fix | Delete
* Notes:
[109] Fix | Delete
*
[110] Fix | Delete
*\li Since the current state from each of the LFSRs is used to skip
[111] Fix | Delete
* state in the other, it is important that no state be leaked
[112] Fix | Delete
* from either LFSR.
[113] Fix | Delete
*
[114] Fix | Delete
* Requires:
[115] Fix | Delete
*
[116] Fix | Delete
*\li lfsr1 and lfsr2 be valid.
[117] Fix | Delete
*
[118] Fix | Delete
*\li 1 <= skipbits <= 31
[119] Fix | Delete
*/
[120] Fix | Delete
[121] Fix | Delete
ISC_LANG_ENDDECLS
[122] Fix | Delete
[123] Fix | Delete
#endif /* ISC_LFSR_H */
[124] Fix | Delete
[125] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function