File: fips140.h

package info (click to toggle)
entropybroker 2.9-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,600 kB
  • sloc: cpp: 14,386; sh: 934; makefile: 188; java: 148; perl: 12
file content (47 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (3)
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
37
38
39
40
41
42
43
44
45
46
47
class fips140
{
	/* ringbuffer of 20000 bits */
	unsigned char fips140_rval[20000/8];
	/* point to current, ehr, thing */
	int fips140_p;
	/* number of bits in ringbuffer */
	int fips140_nbits;
	/* number of new bits after a long-test */
	int fips140_nnewbits;

	/* number of bits set to 1 (monobit test) */
	int fips140_n1;

	/* for poker test */
	int fips140_pokerbuf[16];

	/* where to store statistics */
	struct
	{
		int monobit;
		int poker;
		int longrun;
		int runs;
	} stats_t;

	int fips_version;
	char *user;

	static unsigned char fips140_bit1cnt[256];

	bool fips140_shorttest();
	bool fips140_longtest();

public:
	fips140();
	~fips140();

	static void init();

	void set_fips_version(int version);
	void set_user(const char *puser);

	void add(unsigned char newval);
	bool is_ok();
	char *stats();
};