summaryrefslogtreecommitdiff
path: root/random
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-11-17 14:47:33 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-11-17 14:53:17 +0900
commit964c9c5eee30cc45488b88ec4c0199a41861e4aa (patch)
tree32c2f39207d8c5b2058a4c3860f2816d90ab7c9d /random
parentd5ae5229db70f71301a3f3eefdd38a73a4fde499 (diff)
downloadlibgcrypt-964c9c5eee30cc45488b88ec4c0199a41861e4aa.tar.gz
jitterentropy: Disable use of pthread.
* random/jitterentropy.h (JENT_CONF_ENABLE_INTERNAL_TIMER): Undefine. * random/jitterentropy-base.c [JENT_CONF_ENABLE_INTERNAL_TIMER] (jent_entropy_switch_notime_impl): Add conditional compilation. * random/jitterentropy-base-user.h [JENT_CONF_ENABLE_INTERNAL_TIMER] (jent_yield): Likewise. * random/jitterentropy.h [JENT_CONF_ENABLE_INTERNAL_TIMER] (jent_entropy_switch_notime_impl): Likewise. -- GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'random')
-rw-r--r--random/jitterentropy-base-user.h4
-rw-r--r--random/jitterentropy-base.c2
-rw-r--r--random/jitterentropy.h4
3 files changed, 9 insertions, 1 deletions
diff --git a/random/jitterentropy-base-user.h b/random/jitterentropy-base-user.h
index f0fd4842..a05d2114 100644
--- a/random/jitterentropy-base-user.h
+++ b/random/jitterentropy-base-user.h
@@ -293,9 +293,13 @@ static inline uint32_t jent_cache_size_roundup(void)
#endif /* __linux__ */
+#ifdef JENT_CONF_ENABLE_INTERNAL_TIMER
+#include <sched.h>
+
static inline void jent_yield(void)
{
sched_yield();
}
+#endif
#endif /* GCRYPT_JITTERENTROPY_BASE_USER_H */
diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c
index 30109dc1..5ff6654c 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 4322c65d..0a91f36a 100644
--- a/random/jitterentropy.h
+++ b/random/jitterentropy.h
@@ -59,7 +59,7 @@
* must offer POSIX threads. If this option is disabled, no linking
* with the POSIX threads library is needed.
*/
-#define JENT_CONF_ENABLE_INTERNAL_TIMER
+#undef JENT_CONF_ENABLE_INTERNAL_TIMER
/*
* Disable the loop shuffle operation
@@ -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 -- */