forked from nhorman/rng-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rngd_entsource.h
108 lines (91 loc) · 3.2 KB
/
rngd_entsource.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* rngd_source.h -- Entropy source and conditioning
*
* Copyright (C) 2001 Philipp Rumpf
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*/
#ifndef RNGD_ENTSOURCE__H
#define RNGD_ENTSOURCE__H
#include "rng-tools-config.h"
#include <unistd.h>
#include <stdint.h>
/* Logic and contexts */
extern fips_ctx_t fipsctx; /* Context for the FIPS tests */
extern fips_ctx_t tpm_fipsctx; /* Context for the tpm FIPS tests */
/*
* Initialize entropy source and entropy conditioning
*
* sourcedev is the path to the entropy source
*/
extern int init_entropy_source(struct rng *);
#ifdef HAVE_RDRAND
extern int init_drng_entropy_source(struct rng *);
#endif
#ifdef HAVE_DARN
extern int init_darn_entropy_source(struct rng *);
#endif
#ifdef HAVE_NISTBEACON
extern int init_nist_entropy_source(struct rng *);
#endif
#ifdef HAVE_RNDR
extern int init_rndr_entropy_source(struct rng *);
#endif
#ifdef HAVE_JITTER
extern int init_jitter_entropy_source(struct rng *);
extern void close_jitter_entropy_source(struct rng *);
extern void cache_jitter_entropy_data(struct rng *);
#endif
#ifdef HAVE_PKCS11
extern int init_pkcs11_entropy_source(struct rng *);
extern void close_pkcs11_entropy_source(struct rng *);
#endif
#ifdef HAVE_RTLSDR
extern int init_rtlsdr_entropy_source(struct rng *);
extern void close_rtlsdr_entropy_source(struct rng *);
#endif
#ifdef HAVE_QRYPT
extern int init_qrypt_entropy_source(struct rng *);
extern void close_qrypt_entropy_source(struct rng *);
#endif
extern int init_tpm_entropy_source(struct rng *);
/* Read data from the entropy source */
extern int xread(void *buf, size_t size, struct rng *ent_src);
#ifdef HAVE_RDRAND
extern int xread_drng(void *buf, size_t size, struct rng *ent_src);
#endif
#ifdef HAVE_DARN
extern int xread_darn(void *buf, size_t size, struct rng *ent_src);
#endif
#ifdef HAVE_RNDR
extern int xread_rndr(void *buf, size_t size, struct rng *ent_src);
#endif
#ifdef HAVE_JITTER
extern int xread_jitter(void *buf, size_t size, struct rng *ent_src);
#endif
#ifdef HAVE_PKCS11
extern int xread_pkcs11(void *buf, size_t size, struct rng *ent_src);
#endif
#ifdef HAVE_RTLSDR
extern int xread_rtlsdr(void *buf, size_t size, struct rng *ent_src);
#endif
#ifdef HAVE_QRYPT
extern int xread_qrypt(void *buf, size_t size, struct rng *ent_src);
#endif
extern int xread_nist(void *buf, size_t size, struct rng *ent_src);
extern int xread_tpm(void *buf, size_t size, struct rng *ent_src);
extern int init_namedpipe_entropy_source(struct rng *ent_src);
extern int xread_namedpipe(void *buf, size_t size, struct rng *ent_src);
#endif /* RNGD_ENTSOURCE__H */