]> git.ipfire.org Git - thirdparty/rng-tools.git/blame - rngd_entsource.h
rdrand: Enable the RDSEED instruction
[thirdparty/rng-tools.git] / rngd_entsource.h
CommitLineData
61af3de3
JG
1/*
2 * rngd_source.h -- Entropy source and conditioning
3 *
4 * Copyright (C) 2001 Philipp Rumpf
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
d1b4c504 10 *
61af3de3
JG
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
d32709d1 18 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
61af3de3
JG
19 */
20
21#ifndef RNGD_ENTSOURCE__H
22#define RNGD_ENTSOURCE__H
23
24#include "rng-tools-config.h"
25
26#include <unistd.h>
27#include <stdint.h>
28
29/* Logic and contexts */
30extern fips_ctx_t fipsctx; /* Context for the FIPS tests */
d1b4c504 31extern fips_ctx_t tpm_fipsctx; /* Context for the tpm FIPS tests */
61af3de3
JG
32
33/*
34 * Initialize entropy source and entropy conditioning
35 *
36 * sourcedev is the path to the entropy source
37 */
d1b4c504 38extern int init_entropy_source(struct rng *);
2a014536 39extern int init_drng_entropy_source(struct rng *);
d1b4c504 40extern int init_tpm_entropy_source(struct rng *);
61af3de3
JG
41
42/* Read data from the entropy source */
d1b4c504 43extern int xread(void *buf, size_t size, struct rng *ent_src);
2a014536 44extern int xread_drng(void *buf, size_t size, struct rng *ent_src);
d1b4c504 45extern int xread_tpm(void *buf, size_t size, struct rng *ent_src);
61af3de3
JG
46
47#endif /* RNGD_ENTSOURCE__H */