summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-11-16 15:26:10 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-11-16 15:26:10 +0900
commit57449535225aace4a5d35ad4dd07bf911189f86e (patch)
tree227aa41ac321cf3f650766fdce80ec9a909e6522
parentf3e1504e2e01ddf11759362a29f5f0609f87a815 (diff)
downloadlibgcrypt-gniibe/jitterent.tar.gz
Use jent_read_entropy_safe for rndjent.gniibe/jitterent
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--random/jitterentropy-base.c2
-rw-r--r--random/jitterentropy.h2
-rw-r--r--random/rndjent.c2
3 files changed, 5 insertions, 1 deletions
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