From 57449535225aace4a5d35ad4dd07bf911189f86e Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 16 Nov 2021 15:26:10 +0900 Subject: Use jent_read_entropy_safe for rndjent. Signed-off-by: NIIBE Yutaka --- random/jitterentropy-base.c | 2 ++ random/jitterentropy.h | 2 ++ random/rndjent.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c index c9cdb026..9aef266a 100644 --- a/random/jitterentropy-base.c +++ b/random/jitterentropy-base.c @@ -725,8 +725,10 @@ int jent_entropy_init_ex(unsigned int osr, unsigned int flags) return jent_entropy_init_common_post(ret); } +#ifdef JENT_CONF_ENABLE_INTERNAL_TIMER JENT_PRIVATE_STATIC int jent_entropy_switch_notime_impl(struct jent_notime_thread *new_thread) { return jent_notime_switch(new_thread); } +#endif diff --git a/random/jitterentropy.h b/random/jitterentropy.h index 02c60b78..0a91f36a 100644 --- a/random/jitterentropy.h +++ b/random/jitterentropy.h @@ -382,9 +382,11 @@ int jent_entropy_init_ex(unsigned int osr, unsigned int flags); JENT_PRIVATE_STATIC unsigned int jent_version(void); +#ifdef JENT_CONF_ENABLE_INTERNAL_TIMER /* Set a different thread handling logic for the notimer support */ JENT_PRIVATE_STATIC int jent_entropy_switch_notime_impl(struct jent_notime_thread *new_thread); +#endif /* -- END of Main interface functions -- */ diff --git a/random/rndjent.c b/random/rndjent.c index 0fab3deb..4bac9102 100644 --- a/random/rndjent.c +++ b/random/rndjent.c @@ -301,7 +301,7 @@ _gcry_rndjent_poll (void (*add)(const void*, size_t, enum random_origins), size_t n = length < sizeof(buffer)? length : sizeof (buffer); jent_rng_totalcalls++; - rc = jent_read_entropy (jent_rng_collector, buffer, n); + rc = jent_read_entropy_safe (&jent_rng_collector, buffer, n); if (rc < 0) break; /* We need to hash the output to conform to the BSI -- cgit v1.2.1