aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-08-01 14:31:38 -0700
committerJeff Garzik <jgarzik@redhat.com>2012-08-02 00:18:59 -0400
commit9b1a3bbbdf7da77cf84e2eaafb55260d357ae3de (patch)
treece86179cd9a766c353fc38e0aaabcd3bf6d1cf31
parent31a7953fa9fd18d50d9b4dc0d3bad65d560be3a2 (diff)
downloadrng-tools-9b1a3bbbdf7da77cf84e2eaafb55260d357ae3de.tar.gz
rng-tools-9b1a3bbbdf7da77cf84e2eaafb55260d357ae3de.tar.xz
rng-tools-9b1a3bbbdf7da77cf84e2eaafb55260d357ae3de.zip
rngd: don't open the TPM if hwrng is available
If /dev/hwrng is avaiable, do not open the TPM. Newer kernels export TPM randomness via /dev/hwrng; this properly handles multiplexing of the TPM so that we don't interfere with TrouSerS. Thus, we don't want to open /dev/tpm0 if we can open /dev/hwrng. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--rngd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rngd.c b/rngd.c
index f1b7e1a..8ab219c 100644
--- a/rngd.c
+++ b/rngd.c
@@ -301,13 +301,13 @@ int main(int argc, char **argv)
rc_rng = init_entropy_source(&rng_default);
if (arguments->enable_drng)
rc_drng = init_drng_entropy_source(&rng_drng);
- if (arguments->enable_tpm)
+ if (arguments->enable_tpm && rc_rng)
rc_tpm = init_tpm_entropy_source(&rng_tpm);
if (rc_rng && rc_drng && rc_tpm) {
if (!arguments->quiet) {
message(LOG_DAEMON|LOG_ERR,
- "can't open entropy source(tpm or intel/amd rng)");
+ "can't open any entropy source");
message(LOG_DAEMON|LOG_ERR,
"Maybe RNG device modules are not loaded\n");
}