summaryrefslogtreecommitdiff
path: root/lib/randread.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/randread.c')
-rw-r--r--lib/randread.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/randread.c b/lib/randread.c
index dfba6118..a073cab2 100644
--- a/lib/randread.c
+++ b/lib/randread.c
@@ -1,6 +1,6 @@
/* Generate buffers of random data.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -275,12 +275,14 @@ readsource (struct randread_source *s, unsigned char *p, size_t size)
the buffered ISAAC generator in ISAAC. */
static void
-readisaac (struct isaac *isaac, unsigned char *p, size_t size)
+readisaac (struct isaac *isaac, void *p, size_t size)
{
size_t inbytes = isaac->buffered;
while (true)
{
+ char *char_p = p;
+
if (size <= inbytes)
{
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
@@ -289,14 +291,14 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
}
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, inbytes);
- p += inbytes;
+ p = char_p + inbytes;
size -= inbytes;
/* If P is aligned, write to *P directly to avoid the overhead
of copying from the buffer. */
if (ALIGNED_POINTER (p, isaac_word))
{
- isaac_word *wp = (isaac_word *) p;
+ isaac_word *wp = p;
while (ISAAC_BYTES <= size)
{
isaac_refill (&isaac->state, wp);
@@ -308,7 +310,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
return;
}
}
- p = (unsigned char *) wp;
+ p = wp;
}
isaac_refill (&isaac->state, isaac->data.w);