[svn] gcry - r1432 - trunk/random
svn author marcus
cvs at cvs.gnupg.org
Tue Apr 27 05:04:56 CEST 2010
Author: marcus
Date: 2010-04-27 05:04:56 +0200 (Tue, 27 Apr 2010)
New Revision: 1432
Modified:
trunk/random/ChangeLog
trunk/random/rndw32ce.c
Log:
2010-04-27 Marcus Brinkmann <marcus at g10code.de>
* rndw32ce.c (fillup_buffer): Rewrite without using nested
functions, which are broken on arm/cegcc.
Modified: trunk/random/ChangeLog
===================================================================
--- trunk/random/ChangeLog 2010-04-19 17:15:03 UTC (rev 1431)
+++ trunk/random/ChangeLog 2010-04-27 03:04:56 UTC (rev 1432)
@@ -1,3 +1,8 @@
+2010-04-27 Marcus Brinkmann <marcus at g10code.de>
+
+ * rndw32ce.c (fillup_buffer): Rewrite without using nested
+ functions, which are broken on arm/cegcc.
+
2010-04-12 Brad Hards <bradh at frogmouth.net> (wk)
Spelling fixes.
Modified: trunk/random/rndw32ce.c
===================================================================
--- trunk/random/rndw32ce.c 2010-04-19 17:15:03 UTC (rev 1431)
+++ trunk/random/rndw32ce.c 2010-04-27 03:04:56 UTC (rev 1432)
@@ -34,27 +34,33 @@
some extra random. We do this, despite that it is a questionable
suggestion as the OS as better means of collecting entropy than an
application. */
+static size_t filler_used;
+static size_t filler_length;
+static unsigned char *filler_buffer;
+
static void
+filler (const void *data, size_t datalen, enum random_origins dummy)
+{
+ (void)dummy;
+ if (filler_used + datalen > filler_length)
+ datalen = filler_length - filler_used;
+ memcpy (filler_buffer + filler_used, data, datalen);
+ filler_used += datalen;
+}
+
+
+static void
fillup_buffer (unsigned char *buffer, size_t length)
{
- size_t used = 0;
+ filler_used = 0;
+ filler_length = length;
+ filler_buffer = buffer;
- /* This code uses gcc anyway, thus we can use a nested function. */
- void filler (const void *data, size_t datalen, enum random_origins dummy)
- {
- (void)dummy;
- if (used + datalen > length)
- datalen = length - used;
- memcpy (buffer+used, data, datalen);
- used += datalen;
- }
-
- while (used < length)
+ while (filler_used < length)
_gcry_rndw32ce_gather_random_fast (filler, 0);
}
-
int
_gcry_rndw32ce_gather_random (void (*add)(const void*, size_t,
enum random_origins),
More information about the Gnupg-commits
mailing list