aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_random.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/util/crypto_random.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/util/crypto_random.c')
-rw-r--r--src/util/crypto_random.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 03f6c0e98..bb105437d 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -71,8 +71,8 @@ GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i)
71 ul = UINT32_MAX - (UINT32_MAX % i); 71 ul = UINT32_MAX - (UINT32_MAX % i);
72 do 72 do
73 { 73 {
74 gcry_randomize ((unsigned char *) &ret, 74 gcry_randomize ((unsigned char *) &ret, sizeof (uint32_t),
75 sizeof (uint32_t), GCRY_STRONG_RANDOM); 75 GCRY_STRONG_RANDOM);
76 } 76 }
77 while (ret >= ul); 77 while (ret >= ul);
78 return ret % i; 78 return ret % i;
@@ -147,8 +147,8 @@ GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max)
147 ul = UINT64_MAX - (UINT64_MAX % max); 147 ul = UINT64_MAX - (UINT64_MAX % max);
148 do 148 do
149 { 149 {
150 gcry_randomize ((unsigned char *) &ret, 150 gcry_randomize ((unsigned char *) &ret, sizeof (uint64_t),
151 sizeof (uint64_t), GCRY_STRONG_RANDOM); 151 GCRY_STRONG_RANDOM);
152 } 152 }
153 while (ret >= ul); 153 while (ret >= ul);
154 return ret % max; 154 return ret % max;
@@ -195,8 +195,8 @@ static struct GNUNET_OS_Process *genproc;
195 * blocked gathering entropy. 195 * blocked gathering entropy.
196 */ 196 */
197static void 197static void
198entropy_generator (void *cls, 198entropy_generator (void *cls, const char *what, int printchar, int current,
199 const char *what, int printchar, int current, int total) 199 int total)
200{ 200{
201 unsigned long code; 201 unsigned long code;
202 enum GNUNET_OS_ProcessStatusType type; 202 enum GNUNET_OS_ProcessStatusType type;
@@ -234,11 +234,10 @@ entropy_generator (void *cls,
234 } 234 }
235 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 235 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
236 _("Starting `%s' process to generate entropy\n"), "find"); 236 _("Starting `%s' process to generate entropy\n"), "find");
237 genproc = GNUNET_OS_start_process (NULL, NULL, "sh", 237 genproc =
238 "sh", 238 GNUNET_OS_start_process (NULL, NULL, "sh", "sh", "-c",
239 "-c", 239 "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null",
240 "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", 240 NULL);
241 NULL);
242} 241}
243 242
244 243