-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprandom.h
More file actions
36 lines (29 loc) · 762 Bytes
/
prandom.h
File metadata and controls
36 lines (29 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef PRANDOM_H
#define PRANDOM_H
#ifdef __KERNEL__
#include <linux/string.h>
#else
#include <string.h>
#endif
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stddef.h>
#endif
#include "Galois_Field_256.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
#define POLY_DEGREE 256
#define GF256_ONE (GF256_t)0x01
static const int GF256_DEGREES_AUTO[] = {0, 2, 5, 10, 255};
struct gf256_gprn
{
GF256_t coeff[POLY_DEGREE];
GF256_t t[POLY_DEGREE];
int index;
};
void gf256_gprn_init_t(struct gf256_gprn* gprn, GF256_t* coeff_data, GF256_t* seed_data);
GF256_t gf256_gprn_next(struct gf256_gprn* gprn);
void gf256_gprn_generate(struct gf256_gprn* gprn, size_t count, GF256_t* output);
#endif